diff --git a/ASCOfficeDocFile_old/DocxDocConverter/BinaryStorage.h b/ASCOfficeDocFile_old/DocxDocConverter/BinaryStorage.h deleted file mode 100644 index 4b8d292ad1..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/BinaryStorage.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Common/Singleton.h" -#include "../pole/pole.h" - -namespace ASCDocFileFormat -{ - class BinaryStorage - { - struct BinaryStorageData - { - unsigned char* data; - unsigned int size; - - BinaryStorageData(): - data(NULL), size(0) - { - } - - BinaryStorageData( const unsigned char* _data, unsigned int _size ): - data(NULL), size(0) - { - if ( ( _data != NULL ) && ( _size != NULL ) ) - { - this->size = _size; - - this->data = new unsigned char[this->size]; - - if ( this->data != NULL ) - { - memset( this->data, 0, this->size ); - - memcpy( this->data, _data, this->size ); - } - } - } - - BinaryStorageData( const BinaryStorageData& _binaryStorageData ): - data(NULL), size(0) - { - if ( ( _binaryStorageData.data != NULL ) && ( _binaryStorageData.size != NULL ) ) - { - this->size = _binaryStorageData.size; - - this->data = new unsigned char[this->size]; - - if ( this->data != NULL ) - { - memset( this->data, 0, this->size ); - - memcpy( this->data, _binaryStorageData.data, this->size ); - } - } - } - - ~BinaryStorageData() - { - RELEASEARRAYOBJECTS (data); - } - }; - - protected: - POLE::Storage* pIStorage; - POLE::Stream* pIStream; - - list data; - unsigned long offset; - unsigned long startOffset; - bool ownStream; - - public: - explicit BinaryStorage( unsigned long _startOffset = 0, POLE::Stream* _pIStream = NULL ): - pIStream(_pIStream), pIStorage(NULL), offset(_startOffset), startOffset(_startOffset), ownStream(false) - { - } - - long BindToStorage( POLE::Storage* _pIStorage, const char* _stream_name ) - { - HRESULT res = S_FALSE; - - pIStorage = _pIStorage; - - if ( pIStorage != NULL ) - { - if ( ( pIStream != NULL ) && ( this->ownStream ) ) - { - delete pIStream; - pIStream = NULL; - } - - pIStream = new POLE::Stream(pIStorage,_stream_name,true); - - if (pIStream == NULL)return S_FALSE; - //res = this->pIStorage->OpenStream( _stream, NULL, ( STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE ), NULL, &(this->pIStream) ); - //{ - // res = this->pIStorage->CreateStream( _stream, ( STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE ), NULL, NULL, &(this->pIStream) ); - //} - } - - if ( SUCCEEDED( res ) ) - { - this->ownStream = true; - } - - return res; - } - - virtual ~BinaryStorage() - { - if ( ( pIStream != NULL ) && ( ownStream ) ) - { - delete pIStream; - pIStream = NULL; - } - } - - unsigned long PushData( const unsigned char* _data, unsigned int _size ) - { - this->data.push_back( BinaryStorageData( _data, _size ) ); - - unsigned long dataOffset = this->offset; - - this->offset += _size; - - return dataOffset; - } - - unsigned long ClearData() - { - this->data.clear(); - - this->offset = this->startOffset; - - return this->offset; - } - - long WriteData() - { - long res = S_OK; - ULONG writtenSize; - - POLE::uint64 pos = startOffset; - - if ( pIStream != NULL ) - { - for ( list::const_iterator iter = data.begin(); iter != data.end(); iter++ ) - { - pIStream->seek( pos); - writtenSize = pIStream->write( iter->data, iter->size ); - pos += iter->size; - } - pIStream->flush(); - } - else - { - res = S_FALSE; - } - - return res; - } - }; - - class BinaryStorageSingleton: public Singleton, public BinaryStorage - { - protected: - BinaryStorageSingleton(): BinaryStorage() {}; - virtual ~BinaryStorageSingleton() {}; - friend class Singleton; - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/BookmarkEnd.h b/ASCOfficeDocFile_old/DocxDocConverter/BookmarkEnd.h deleted file mode 100644 index 1464da8ab6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/BookmarkEnd.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IParagraphItem.h" - -namespace ASCDocFileFormat -{ - class BookmarkEnd: public IParagraphItem - { - - public: - BookmarkEnd() - { - } - - explicit BookmarkEnd (std::wstring& _id) : id (_id) - { - } - - - virtual ~BookmarkEnd() - { - } - - virtual unsigned long GetTextSize() const - { - return 0; - } - - virtual std::wstring GetAllText() const - { - return std::wstring(); - } - - virtual vector GetRunProperties (vector* runOffsets) const - { - return vector(); - } - - virtual unsigned int PrlSize() const - { - return 0; - } - - virtual vector GetAllRunsCopy( vector* runOffsets ) const - { - vector paragraphItems; - - if ( runOffsets != NULL ) - { - paragraphItems.push_back( IParagraphItemPtr( static_cast(this->Clone()) ) ); - runOffsets->push_back( 0 ); - } - - return paragraphItems; - } - - virtual IVirtualConstructor* New() const - { - return new BookmarkEnd(); - } - - virtual IVirtualConstructor* Clone() const - { - return new BookmarkEnd(*this); - } - - // - - inline std::wstring GetID() const - { - return id; - } - - private: - - std::wstring id; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/BookmarkStart.h b/ASCOfficeDocFile_old/DocxDocConverter/BookmarkStart.h deleted file mode 100644 index b408e5ec35..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/BookmarkStart.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IParagraphItem.h" - -namespace ASCDocFileFormat -{ - class BookmarkStart : public IParagraphItem - { - public: - BookmarkStart() - { - } - - explicit BookmarkStart (std::wstring& _id, std::wstring& _name) : id(_id), name(_name) - { - } - - virtual ~BookmarkStart() - { - } - - virtual unsigned long GetTextSize() const - { - return 0; - } - - virtual std::wstring GetAllText() const - { - return std::wstring(); - } - - virtual vector GetRunProperties( vector* runOffsets ) const - { - return vector(); - } - - virtual unsigned int PrlSize () const - { - return 0; - } - - virtual vector GetAllRunsCopy( vector* runOffsets ) const - { - vector paragraphItems; - - if ( runOffsets != NULL ) - { - paragraphItems.push_back( IParagraphItemPtr( static_cast(this->Clone()) ) ); - runOffsets->push_back( 0 ); - } - - return paragraphItems; - } - - virtual IVirtualConstructor* New() const - { - return new BookmarkStart(); - } - - virtual IVirtualConstructor* Clone() const - { - return new BookmarkStart(*this); - } - // - inline std::wstring GetID() const - { - return id; - } - - inline std::wstring GetName() const - { - return name; - } - - - private: - - std::wstring id; - std::wstring name; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Brc.h b/ASCOfficeDocFile_old/DocxDocConverter/Brc.h deleted file mode 100644 index 71268fb236..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Brc.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "COLORREF.h" - -namespace ASCDocFileFormat -{ - class Brc: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 8; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - Brc() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit Brc( const COLORREF& _cv, unsigned char _dptLineWidth, unsigned char _brcType, unsigned char _dptSpace, bool fShadow, bool fFrame ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - unsigned char cvSize = _cv.Size(); - - memcpy( this->bytes, (unsigned char*)_cv, cvSize ); - - unsigned char dptLineWidth = 2; - - if ( _dptLineWidth > 2 ) - { - dptLineWidth = _dptLineWidth; - } - - this->bytes[cvSize] = dptLineWidth; - this->bytes[cvSize + sizeof(dptLineWidth)] = _brcType; - - unsigned short dptSpaceAndFlags = 0; - dptSpaceAndFlags |= _dptSpace; //Set dptSpace - - if ( fShadow ) - { - dptSpaceAndFlags |= 0x20; //Set fShadow - } - - if ( fFrame ) - { - dptSpaceAndFlags |= 0x40; //Set fFrame - } - - FormatUtils::SetBytes( ( this->bytes + cvSize + sizeof(dptLineWidth) + sizeof(_brcType) ), dptSpaceAndFlags ); - } - - explicit Brc( const unsigned char* _bytes ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - if ( _bytes != NULL ) - { - memcpy( this->bytes, _bytes, SIZE_IN_BYTES ); - } - } - - Brc( const Brc& _brc ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _brc.bytes, SIZE_IN_BYTES ); - } - - Brc& operator = ( const Brc& _brc ) - { - if ( this != &_brc ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _brc.bytes, SIZE_IN_BYTES ); - } - - return *this; - } - - virtual ~Brc() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; - - class BrcOperand: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 9; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - BrcOperand() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = ( SIZE_IN_BYTES - 1 ); - } - - explicit BrcOperand( const Brc& _brc ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = ( SIZE_IN_BYTES - 1 ); - - memcpy( ( this->bytes + sizeof(unsigned char) ), (unsigned char*)_brc, _brc.Size() ); - } - - BrcOperand( const BrcOperand& _brcOperand ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _brcOperand.bytes, SIZE_IN_BYTES ); - } - - BrcOperand& operator = ( const BrcOperand& _brcOperand ) - { - if ( this != &_brcOperand ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _brcOperand.bytes, SIZE_IN_BYTES ); - } - - return *this; - } - - virtual ~BrcOperand() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Brc80MayBeNil.h b/ASCOfficeDocFile_old/DocxDocConverter/Brc80MayBeNil.h deleted file mode 100644 index 3c9284ad45..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Brc80MayBeNil.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union Brc80 - { - private: - struct - { - unsigned int dptLineWidth:8; - unsigned int brcType:8; - unsigned int ico:8; - unsigned int dptSpace:5; - unsigned int fShadow:1; - unsigned int fFrame:1; - unsigned int reserved:1; - } Brc80Struct; - unsigned int Brc80Int; - - public: - Brc80() : Brc80Int(0xFFFFFFFF) - { - } - - explicit Brc80( unsigned int _brc80 ) : Brc80Int(_brc80) - { - } - - explicit Brc80( unsigned char _dptLineWidth, unsigned char _brcType, unsigned char _ico, unsigned char _dptSpace, bool fShadow, bool fFrame ) - { - if ( _dptLineWidth < 2 ) - { - this->Brc80Struct.dptLineWidth = 2; - } - else - { - this->Brc80Struct.dptLineWidth = _dptLineWidth; - } - - if ( _brcType == 0x1A ) - { - this->Brc80Struct.brcType = 0x18; - } - else if ( _brcType == 0x1B ) - { - this->Brc80Struct.brcType = 0x19; - } - else - { - this->Brc80Struct.brcType = _brcType; - } - - if ( _ico >= 0x11 ) - { - this->Brc80Struct.ico = 0x10; - } - else - { - this->Brc80Struct.ico = _ico; - } - - this->Brc80Struct.dptSpace = _dptSpace; - - ( fShadow ) ? ( this->Brc80Struct.fShadow = 1 ) : ( this->Brc80Struct.fShadow = 0 ); - ( fFrame ) ? ( this->Brc80Struct.fFrame = 1 ) : ( this->Brc80Struct.fFrame = 0 ); - - this->Brc80Struct.reserved = 0; - } - - operator unsigned int() const - { - return Brc80Int; - } - }; - - class Brc80MayBeNil - { - private: - Brc80 brc80; - - public: - Brc80MayBeNil(): - brc80() - { - } - - explicit Brc80MayBeNil( unsigned int _brc80MayBeNil ): - brc80(_brc80MayBeNil) - { - } - - Brc80MayBeNil( unsigned char _dptLineWidth, unsigned char _brcType, unsigned char _ico, unsigned char _dptSpace, bool fShadow, bool fFrame ): brc80( _dptLineWidth, _brcType, _ico, _dptSpace, fShadow, fFrame ) - { - - } - - operator unsigned int() const - { - return this->brc80; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/BxPap.h b/ASCOfficeDocFile_old/DocxDocConverter/BxPap.h deleted file mode 100644 index a5af8a83b2..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/BxPap.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class BxPap: public IStreamWriter - { - public: - static const unsigned char RESERVED_SIZE = 12; - - private: - unsigned char bOffset; //An unsigned integer that specifies the offset of a PapxInFkp in a PapxFkp. The offset of the PapxInFkp is bOffset*2. - unsigned char reserved[RESERVED_SIZE]; - - public: - BxPap(): - bOffset(0) - { - memset( this->reserved, 0, RESERVED_SIZE ); - } - - BxPap( unsigned char _bOffset, const unsigned char* _reserved = NULL ): - bOffset(_bOffset) - { - if ( _reserved != NULL ) - { - memcpy( this->reserved, _reserved, RESERVED_SIZE ); - } - else - { - memset( this->reserved, 0, RESERVED_SIZE ); - } - } - - BxPap( const BxPap& bxp ): - bOffset(bxp.bOffset) - { - memcpy( this->reserved, bxp.reserved, RESERVED_SIZE ); - } - - virtual ~BxPap() - { - } - - bool operator == ( const BxPap& bxp ) - { - return ( ( this->bOffset == bxp.bOffset ) && ( memcmp( this->reserved, bxp.reserved, RESERVED_SIZE ) == 0 ) ); - } - - bool operator != ( const BxPap& bxp ) - { - return !( *this == bxp ); - } - - BxPap& operator = ( const BxPap& bxp ) - { - if ( *this != bxp ) - { - this->bOffset = bxp.bOffset; - memcpy( this->reserved, bxp.reserved, RESERVED_SIZE ); - } - - return *this; - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = sizeof(this->bOffset) + RESERVED_SIZE; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - bytes[0] = this->bOffset; - - memcpy( ( bytes + sizeof(this->bOffset) ), this->reserved, RESERVED_SIZE ); - } - } - - return bytes; - } - - unsigned long Size() const - { - return ( sizeof(this->bOffset) + RESERVED_SIZE ); - } - - unsigned char GetOffset() const - { - return this->bOffset; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/COLORREF.h b/ASCOfficeDocFile_old/DocxDocConverter/COLORREF.h deleted file mode 100644 index 373388cac8..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/COLORREF.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Common/IOperand.h" - -namespace ASCDocFileFormat -{ - class COLORREF : public IOperand - { - public: - static const int cvAuto = 0xFF000000; - - COLORREF() : red(0), green(0), blue(0), fAuto(0xFF) - { - this->bytes[0] = this->red; - this->bytes[1] = this->green; - this->bytes[2] = this->blue; - this->bytes[3] = this->fAuto; - } - - explicit COLORREF( unsigned char _red, unsigned char _green, unsigned char _blue, unsigned char _fAuto = 0xFF ) : red(_red), green(_green), blue(_blue), fAuto(_fAuto) - { - this->bytes[0] = this->red; - this->bytes[1] = this->green; - this->bytes[2] = this->blue; - this->bytes[3] = this->fAuto; - } - - explicit COLORREF( unsigned int _value ) : red(0), green(0), blue(0), fAuto(0) - { - this->red = ( _value >> 16 ) & 0x000000FF; - this->green = ( _value >> 8 ) & 0x000000FF; - this->blue = _value & 0x000000FF; - this->fAuto = ( _value >> 24 ) & 0x000000FF; - - this->bytes[0] = this->red; - this->bytes[1] = this->green; - this->bytes[2] = this->blue; - this->bytes[3] = this->fAuto; - } - - COLORREF( const COLORREF& _colorref ) : red(_colorref.red), green(_colorref.green), blue(_colorref.blue), fAuto(_colorref.fAuto) - { - this->bytes[0] = this->red; - this->bytes[1] = this->green; - this->bytes[2] = this->blue; - this->bytes[3] = this->fAuto; - } - - unsigned char GetRed() const - { - return this->red; - } - - unsigned char GetGreen() const - { - return this->green; - } - - unsigned char GetBlue() const - { - return this->blue; - } - - unsigned char GetAuto() const - { - return this->fAuto; - } - - virtual ~COLORREF() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - private: - - unsigned char red; - unsigned char green; - unsigned char blue; - unsigned char fAuto; - - static const unsigned char SIZE_IN_BYTES = 4; - - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/CP.h b/ASCOfficeDocFile_old/DocxDocConverter/CP.h deleted file mode 100644 index 3c0db7e6b8..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/CP.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class CP - { - private: - unsigned int cp; - - public: - CP(): - cp(0) - { - } - - explicit CP( unsigned int _cp ) - { - if ( _cp >= 0x7FFFFFFF ) - { - this->cp = 0x7FFFFFFE; - } - else - { - this->cp = _cp; - } - } - - ~CP() - { - } - - bool operator == ( const CP& _cp ) - { - return ( this->cp == _cp.cp ); - } - - bool operator != ( const CP& _cp ) - { - return ( this->cp != _cp.cp ); - } - - bool operator < ( const CP& _cp ) - { - return ( this->cp < _cp.cp ); - } - - bool operator <= ( const CP& _cp ) - { - return ( this->cp <= _cp.cp ); - } - - bool operator > ( const CP& _cp ) - { - return ( this->cp > _cp.cp ); - } - - bool operator >= ( const CP& _cp ) - { - return ( this->cp >= _cp.cp ); - } - - CP& operator = ( const CP& _cp ) - { - if ( this != &_cp ) - { - this->cp = _cp.cp; - } - - return *this; - } - - operator unsigned int() const - { - return this->cp; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/CSSAOperand.h b/ASCOfficeDocFile_old/DocxDocConverter/CSSAOperand.h deleted file mode 100644 index 6f7bcbae5a..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/CSSAOperand.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ItcFirstLim.h" -#include "Constants.h" -#include "../Common/IOperand.h" - -namespace ASCDocFileFormat -{ - class CSSA: public IOperand - { - private: - ItcFirstLim itc; - Constants::Fbrc grfbrc; - Constants::Fts ftsWidth; - unsigned short wWidth; - - static const unsigned char SIZE_IN_BYTES = 6; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - explicit CSSA( ItcFirstLim _itc, Constants::Fbrc _grfbrc, Constants::Fts _ftsWidth, unsigned short _wWidth ): itc(_itc), grfbrc(_grfbrc), ftsWidth(_ftsWidth) - { - if ( this->ftsWidth == Constants::ftsNil ) - { - this->wWidth = 0; - } - else - { - this->wWidth = _wWidth; - } - - memset( this->bytes, 0, sizeof(this->bytes) ); - memcpy( this->bytes, (void*)(&this->itc), sizeof(this->itc) ); - memcpy( ( this->bytes + sizeof(this->itc) ), &(this->grfbrc), sizeof(unsigned char) ); - memcpy( ( this->bytes + sizeof(this->itc) + sizeof(unsigned char) ), &(this->ftsWidth), sizeof(unsigned char) ); - memcpy( ( this->bytes + sizeof(this->itc) + sizeof(unsigned char) + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - CSSA( const CSSA& _cssa ): - itc(_cssa.itc), grfbrc(_cssa.grfbrc), ftsWidth(_cssa.ftsWidth), wWidth(_cssa.wWidth) - { - memset( this->bytes, 0, sizeof(this->bytes) ); - memcpy( this->bytes, (void*)(&this->itc), sizeof(this->itc) ); - memcpy( ( this->bytes + sizeof(this->itc) ), &(this->grfbrc), sizeof(unsigned char) ); - memcpy( ( this->bytes + sizeof(this->itc) + sizeof(unsigned char) ), &(this->ftsWidth), sizeof(unsigned char) ); - memcpy( ( this->bytes + sizeof(this->itc) + sizeof(unsigned char) + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - virtual ~CSSA() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; - - class CSSAOperand: public IOperand - { - private: - CSSA cssa; - - unsigned char *bytes; - - public: - explicit CSSAOperand( const CSSA& _cssa ): cssa(_cssa), bytes(NULL) - { - unsigned char cssaSize = this->cssa.Size(); - this->bytes = new unsigned char[cssaSize + 1]; - memset( this->bytes, 0, ( cssaSize + 1 ) ); - this->bytes[0] = cssaSize; - memcpy( ( this->bytes + sizeof(unsigned char) ), this->cssa, cssaSize ); - } - - CSSAOperand( const CSSAOperand& _CSSAOperand ): cssa(_CSSAOperand.cssa), bytes(NULL) - { - unsigned char cssaSize = this->cssa.Size(); - this->bytes = new unsigned char[cssaSize + 1]; - memset( this->bytes, 0, ( cssaSize + 1 ) ); - this->bytes[0] = cssaSize; - memcpy( ( this->bytes + sizeof(unsigned char) ), this->cssa, cssaSize ); - } - - virtual ~CSSAOperand() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return ( this->cssa.Size() + 1 ); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/CSymbolOperand.h b/ASCOfficeDocFile_old/DocxDocConverter/CSymbolOperand.h deleted file mode 100644 index 432ea5793f..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/CSymbolOperand.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class CSymbolOperand: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 4; - unsigned char bytes[SIZE_IN_BYTES]; - - unsigned short ftc; - wchar_t xchar; - - public: - CSymbolOperand(): - ftc(0), xchar(0) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit CSymbolOperand( unsigned short _ftc, wchar_t _xchar ): - ftc(_ftc), xchar(_xchar) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( this->bytes, this->ftc ); - FormatUtils::SetBytes( ( this->bytes + sizeof(this->ftc) ), (unsigned short)this->xchar ); - } - - CSymbolOperand( const CSymbolOperand& _cSymbolOperand ): - ftc(_cSymbolOperand.ftc), xchar(_cSymbolOperand.xchar) - { - memset( this->bytes, 0, sizeof(this->bytes) ); - - memcpy( this->bytes, _cSymbolOperand.bytes, sizeof(_cSymbolOperand.bytes) ); - } - - virtual ~CSymbolOperand() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/CellRangeVertAlign.h b/ASCOfficeDocFile_old/DocxDocConverter/CellRangeVertAlign.h deleted file mode 100644 index c64796ce2b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/CellRangeVertAlign.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ItcFirstLim.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class CellRangeVertAlign: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 4; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - CellRangeVertAlign() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = ( SIZE_IN_BYTES - 1 ); - } - - explicit CellRangeVertAlign( const ItcFirstLim& _itc, Constants::VerticalAlign _valign ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = ( SIZE_IN_BYTES - 1 ); - - FormatUtils::SetBytes( ( this->bytes + sizeof(unsigned char) ), (short)_itc ); - this->bytes[sizeof(unsigned char) + sizeof(short)] = (unsigned char)_valign; - } - - CellRangeVertAlign( const CellRangeVertAlign& _cellRangeVertAlign ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _cellRangeVertAlign.bytes, SIZE_IN_BYTES ); - } - - virtual ~CellRangeVertAlign() - { - } - - virtual unsigned int Size() const - { - return (unsigned int)sizeof(this->bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Chpx.h b/ASCOfficeDocFile_old/DocxDocConverter/Chpx.h deleted file mode 100644 index 3099456fa3..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Chpx.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -#include - -namespace ASCDocFileFormat -{ - class Chpx : public IStreamWriter - { - - public: - Chpx() : cb(0) - { - } - - Chpx(const std::vector& _grpprl) : cb(0) - { - for (unsigned int i = 0; i < _grpprl.size(); ++i) - { - unsigned char grpprlSize = (unsigned char)_grpprl[i].Size(); - if( this->cb + grpprlSize >= 256 ) - break; - this->cb += grpprlSize; - this->grpprl.push_back( _grpprl[i] ); - } - } - - Chpx(const Chpx& chpx) : cb(0) - { - this->cb = chpx.cb; - - for ( unsigned int i = 0; i < chpx.grpprl.size(); i++ ) - { - this->grpprl.push_back( chpx.grpprl[i] ); - } - } - - virtual ~Chpx() - { - } - - bool operator == (const Chpx& chpx) - { - if ( ( this->cb != chpx.cb ) || ( this->grpprl.size() != chpx.grpprl.size() ) ) - { - return false; - } - else - { - unsigned int minPrlCount = min( this->grpprl.size(), chpx.grpprl.size() ); - - for ( unsigned int i = 0; i < minPrlCount; i++ ) - { - if ( this->grpprl[i] != chpx.grpprl[i] ) - { - return false; - } - } - } - - return true; - } - - bool operator != (const Chpx& chpx) - { - return !( *this == chpx ); - } - - Chpx& operator = (const Chpx& chpx) - { - if ( *this != chpx ) - { - this->cb = chpx.cb; - - this->grpprl.clear(); - - for ( unsigned int i = 0; i < chpx.grpprl.size(); i++ ) - { - this->grpprl.push_back( chpx.grpprl[i] ); - } - } - - return *this; - } - - virtual unsigned char* GetBytes(unsigned long* size) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = sizeof(this->cb) + this->cb; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - bytes[0] = this->cb; - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( unsigned int i = 0; i < this->grpprl.size(); i++ ) - { - prlBytes = this->grpprl[i].GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( bytes + sizeof(this->cb) + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - - return bytes; - } - - unsigned long Size() const - { - return ( sizeof(this->cb) + this->cb ); - } - - inline size_t GetPrlSize () - { - return grpprl.size(); - } - - private: - - unsigned char cb; //Size in bytes of the grpprl - std::vector grpprl; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ChpxFkp.h b/ASCOfficeDocFile_old/DocxDocConverter/ChpxFkp.h deleted file mode 100644 index d5c86b50ec..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ChpxFkp.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Chpx.h" - -namespace ASCDocFileFormat -{ - class ChpxFkp : public IStreamWriter - { - public: - static const unsigned short CHPX_FKP_SIZE = 512; - static const unsigned char CHPX_FKP_MAX_CRUN = 0x65; - - ChpxFkp(const vector& inRgfc, const vector& arrChpxs) : crun(0) - { - crun = arrChpxs.size(); - rgfc = inRgfc; - - unsigned long chpxSizeInBytes = 0; - - chpxs.push_back( arrChpxs[0] ); - chpxSizeInBytes = chpxs[0].Size(); - rgb.push_back( (unsigned char)( ( CHPX_FKP_SIZE - 1 - chpxSizeInBytes ) / 2 ) ); - - for (int i = 1; i < crun; ++i) - { - chpxs.push_back( arrChpxs[i] ); - chpxSizeInBytes = chpxs[i].Size(); - rgb.push_back( (unsigned char)( rgb[i-1] - 1 - ( chpxSizeInBytes / 2 ) ) ); - } - } - - virtual ~ChpxFkp() - { - } - - // - virtual unsigned char* GetBytes(unsigned long* size) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = 512; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - int i = 0; - - for (; i < (crun + 1); ++i) - { - FormatUtils::SetBytes((bytes + (i * sizeof(rgfc[i]))), (int)rgfc[i]); - } - - i = (crun + 1) * sizeof(rgfc[i]); - - unsigned char *chpxsbytes = NULL; - unsigned long chpxssize = 0; - - for (int j = 0; j < crun; ++j, ++i) - { - bytes[i] = rgb[j]; - unsigned char *chpxsbytes = chpxs[j].GetBytes(&chpxssize); - - if ( chpxsbytes != NULL ) - { - memcpy((bytes + ( bytes[i] * 2 ) ), chpxsbytes, chpxssize); - RELEASEARRAYOBJECTS (chpxsbytes); - } - } - - bytes[511] = crun; - } - } - - return bytes; - } - - inline unsigned int GetEndOffset() const - { - return (*(rgfc.end() - 1)); - } - - // - static vector GetAllChpxFkps(const vector& inRgfc, const vector& arrChpxs) - { - vector allChpxFkps; - vector rgfc; - vector chpxs; - - rgfc.push_back( inRgfc[0] ); - unsigned int allChpxsSize = 0; - unsigned int rgfcCount = 2; - - for (unsigned int i = 0; i < arrChpxs.size(); ++i) - { - unsigned int chpxSize = arrChpxs[i].Size(); - allChpxsSize += chpxSize; - - //Check if all rgfcs and rgbs + Chpxs less then 512 bytes - if ( ( ( rgfcCount * sizeof(unsigned int) + ( rgfcCount - 1 ) * sizeof(unsigned int) ) >= ( CHPX_FKP_SIZE / 2 ) ) || - ( allChpxsSize >= ( CHPX_FKP_SIZE / 2 ) ) ) - { - ChpxFkp chpxFkp(rgfc, chpxs); - allChpxFkps.push_back(chpxFkp); - rgfc.clear(); - chpxs.clear(); - rgfc.push_back(inRgfc[i]); - allChpxsSize = chpxSize; - rgfcCount = 2; - } - - rgfc.push_back(inRgfc[i+1]); - chpxs.push_back(arrChpxs[i]); - ++rgfcCount; - } - - if (!rgfc.empty() && !chpxs.empty()) - { - ChpxFkp chpxFkp(rgfc, chpxs); - allChpxFkps.push_back(chpxFkp); - - rgfc.clear(); - chpxs.clear(); - } - - return allChpxFkps; - } - - private: - - unsigned char crun; - - vector rgfc; - vector rgb; - vector chpxs; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Clx.h b/ASCOfficeDocFile_old/DocxDocConverter/Clx.h deleted file mode 100644 index 3a412e9366..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Clx.h +++ /dev/null @@ -1,435 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class PrcData: public IOperand - { - public: - PrcData( const vector& _grpPrl ) : cbGrpprl(0), bytes(NULL), sizeInBytes(0) - { - short _cbGrpprl = 0; - - for ( vector::const_iterator iter = _grpPrl.begin(); iter != _grpPrl.end(); iter++ ) - { - _cbGrpprl += (short)iter->Size(); - - if ( _cbGrpprl > 0x3FA2 ) - { - break; - } - - this->GrpPrl.push_back( *iter ); - - this->cbGrpprl = _cbGrpprl; - } - - this->sizeInBytes = (unsigned int)( sizeof(this->cbGrpprl) + this->cbGrpprl ); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, this->cbGrpprl ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( unsigned int i = 0; i < this->GrpPrl.size(); i++ ) - { - prlBytes = this->GrpPrl[i].GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + sizeof(this->cbGrpprl) + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - } - - PrcData( const PrcData& _prcData ) : cbGrpprl(_prcData.cbGrpprl), GrpPrl(_prcData.GrpPrl), bytes(NULL), sizeInBytes(_prcData.sizeInBytes) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _prcData.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PrcData() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - short cbGrpprl; - vector GrpPrl; - unsigned char* bytes; - unsigned int sizeInBytes; - }; - - class Prc: public IStreamWriter - { - public: - Prc( const PrcData& _prcData ) : data(_prcData) - { - - } - - Prc( const Prc& _prc ) : data(_prc.data) - { - - } - - virtual ~Prc() - { - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = sizeof(clxt) + this->data.Size(); - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - bytes[0] = clxt; - - memcpy( ( bytes + sizeof(clxt) ), (unsigned char*)this->data, this->data.Size() ); - } - } - - return bytes; - } - - unsigned int Size() const - { - return (unsigned int)( sizeof(clxt) + this->data.Size() ); - } - private: - static const unsigned char clxt = 0x01; - PrcData data; - }; - - union FcCompressed - { - struct - { - unsigned int fc:30; - unsigned int fCompressed:1; - unsigned int r1:1; - } FcCompressedStruct; - unsigned int FcCompressedInt; - - FcCompressed( unsigned int _fcCompressedInt ): - FcCompressedInt(_fcCompressedInt) - { - } - - static const unsigned int SIZE_IN_BYTES = sizeof(unsigned int); - }; - - union Prm - { - struct - { - unsigned int fComplex:1; //MUST be 0 - unsigned int isprm:7; - unsigned int val:8; - } Prm0Struct; - struct - { - unsigned int fComplex:1; // MUST be 1 - unsigned int igrpprl:15; - } Prm1Struct; - short PrmShort; - - Prm( short _prmShort): - PrmShort(_prmShort) - { - } - - static const unsigned int SIZE_IN_BYTES = sizeof(short); - }; - - struct Pcd - { - union - { - struct - { - unsigned int fNoParaLast:1; - unsigned int fR1:1; - unsigned int fDirty:1; - unsigned int fR2:13; - } NoParaStruct; - short NoParaShort; - } NoPara; - FcCompressed fc; - Prm prm; - - Pcd( bool _fNoParaLast, FcCompressed _fc, Prm _prm ): - fc(_fc), prm(_prm) - { - this->NoPara.NoParaShort = 0; - ( _fNoParaLast ) ? ( this->NoPara.NoParaStruct.fNoParaLast = 1 ) : ( this->NoPara.NoParaStruct.fNoParaLast = 0 ); - } - - static const unsigned int SIZE_IN_BYTES = ( sizeof(short) + FcCompressed::SIZE_IN_BYTES + Prm::SIZE_IN_BYTES ); - }; - - class PlcPcd : public IStreamWriter - { - public: - PlcPcd( const vector& _aCP, const vector& _aPcd ) : aCP(_aCP), aPcd(_aPcd), sizeInBytes(0) - { - this->sizeInBytes = ( ( this->aCP.size() * sizeof(unsigned int) ) + ( this->aPcd.size() * Pcd::SIZE_IN_BYTES ) ); - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = this->sizeInBytes; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - unsigned int i = 0; - - for ( vector::const_iterator iter = this->aCP.begin(); iter != this->aCP.end(); iter++ ) - { - FormatUtils::SetBytes( ( bytes + i ), (int)(*iter) ); - i += sizeof(unsigned int); - } - - for ( vector::const_iterator iter = this->aPcd.begin(); iter != this->aPcd.end(); iter++ ) - { - FormatUtils::SetBytes( ( bytes + i ), iter->NoPara.NoParaShort ); - i += sizeof(iter->NoPara.NoParaShort); - - FormatUtils::SetBytes( ( bytes + i ), (int)iter->fc.FcCompressedInt ); - i += sizeof(iter->fc.FcCompressedInt); - - FormatUtils::SetBytes( ( bytes + i ), iter->prm.PrmShort ); - i += sizeof(iter->prm.PrmShort); - } - } - } - - return bytes; - } - - unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - vector aCP; - vector aPcd; - unsigned int sizeInBytes; - }; - - class Pcdt : public IStreamWriter - { - public: - Pcdt( const PlcPcd& _plcPcd ) : lcb(0), plcPcd(_plcPcd) - { - this->lcb = this->plcPcd.Size(); - } - - Pcdt( const vector& _aCP, const vector& _aPcd ): lcb(0), plcPcd( _aCP, _aPcd ) - { - this->lcb = this->plcPcd.Size(); - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = ( sizeof(clxt) + sizeof(this->lcb) + this->plcPcd.Size() ); - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - bytes[0] = clxt; - - FormatUtils::SetBytes( ( bytes + sizeof(clxt) ), (int)this->lcb ); - - unsigned char* plcPcdBytes = NULL; - unsigned long plcPcdSize = 0; - - plcPcdBytes = this->plcPcd.GetBytes( &plcPcdSize ); - - if ( plcPcdBytes != NULL ) - { - int size = sizeof(clxt) + sizeof(this->lcb); - memcpy( ( bytes + sizeof(clxt) + sizeof(this->lcb) ), plcPcdBytes, plcPcdSize ); - RELEASEARRAYOBJECTS (plcPcdBytes); - } - } - } - - return bytes; - } - - unsigned int Size() const - { - return ( sizeof(clxt) + sizeof(this->lcb) + this->plcPcd.Size() ); - } - private: - - static const unsigned char clxt = 0x02; - unsigned int lcb; - PlcPcd plcPcd; - }; - - class Clx : public IStreamWriter - { - public: - - Clx (const vector* _rgPrc, const Pcdt& _pcdt ) : pcdt(_pcdt), sizeInBytes(0) - { - if ( _rgPrc != NULL ) - { - this->RgPrc = *_rgPrc; - } - - this->sizeInBytes = this->pcdt.Size(); - - for ( vector::iterator iter = this->RgPrc.begin(); iter != this->RgPrc.end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = this->sizeInBytes; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - unsigned char* prcBytes = NULL; - unsigned long prcSize = 0; - unsigned int prcPrevSize = 0; - - for ( unsigned int i = 0; i < this->RgPrc.size(); i++ ) - { - prcBytes = this->RgPrc[i].GetBytes( &prcSize ); - - if ( prcBytes != NULL ) - { - memcpy( ( bytes + prcPrevSize ), prcBytes, prcSize ); - prcPrevSize += prcSize; - RELEASEARRAYOBJECTS (prcBytes); - } - } - - unsigned char* pcdtBytes = NULL; - unsigned long pcdtSize = 0; - - pcdtBytes = this->pcdt.GetBytes( &pcdtSize ); - - if ( pcdtBytes != NULL ) - { - memcpy( ( bytes + prcPrevSize ), pcdtBytes, pcdtSize ); - RELEASEARRAYOBJECTS (pcdtBytes); - } - } - } - - return bytes; - } - - unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - vector RgPrc; - Pcdt pcdt; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Constants.h b/ASCOfficeDocFile_old/DocxDocConverter/Constants.h deleted file mode 100644 index e9798c6db0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Constants.h +++ /dev/null @@ -1,428 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -//For the font character set and a Panose. - -namespace ASCDocFileFormat -{ - namespace Constants - { - enum HorzMerge - { - horzMergeNotMerged = 0, - horzMergeHorizontallyMerged = 1, - horzMergeFirstCell2 = 2, - horzMergeFirstCell3 = 3 - }; - - enum TextFlow - { - grpfTFlrtb = 0x0000, - grpfTFtbrl = 0x0001, - grpfTFbtlr = 0x0003, - grpfTFlrtbv = 0x0004, - grpfTFtbrlv = 0x0005 - }; - - enum VerticalMergeFlag - { - fvmClear = 0x00, - fvmMerge = 0x01, - fvmRestart = 0x03 - }; - - enum VerticalAlign - { - vaTop = 0x00, - vaCenter = 0x01, - vaBottom = 0x02 - }; - - enum Fts - { - ftsNil = 0x00, - ftsAuto = 0x01, - ftsPercent = 0x02, - ftsDxa = 0x03, - ftsDxaSys = 0x13 //??? - }; - - enum Fbrc - { - fbrcTop = 0x01, - fbrcLeft = 0x02, - fbrcBottom = 0x04, - fbrcRight = 0x08 - }; - - enum Itl - { - itlNil = -1, - itlNone = 0 - }; - - enum CharacterPitch - { - characterPitchDefault = 0x00, - characterPitchFixed = 0x01, - characterPitchVariable = 0x02 - }; - - enum FontFamilyType - { - fontFamilyTypeUnspecified = 0x00, - fontFamilyTypeRomanSerif = 0x01, - fontFamilyTypeSwissSansSerif = 0x02, - fontFamilyTypeModernMonospace = 0x03, - fontFamilyTypeScriptCursive = 0x04, - fontFamilyTypeDecorativeFantasy = 0x05 - }; - - enum StyleType - { - styleTypeParagraph = 1, - styleTypeCharacter = 2, - styleTypeTable = 3, - styleTypeNumbering = 4 - }; - - enum NumberingFormat - { - numberingFormatNone = 0x7FFF, - numberingFormatBlackCircle = 0x0000, - numberingFormatWhiteCircle = 0x0001, - numberingFormatBlackSquare = 0x0002, - numberingFormatWhiteSquare = 0x0003, - numberingFormatFourRhombuses = 0x0004, - numberingFormatRightArrow = 0x0005, - numberingFormatDaw = 0x0006, - numberingFormatArabianNumberDot = 0x0007, - numberingFormatArabianNumberBracket = 0x0008, - numberingFormatLargeRomanNumberDot = 0x0009, - numberingFormatLargeLetterDot = 0x000A, - numberingFormatSmallLetterBracket = 0x000B, - numberingFormatSmallLetterDot = 0x000C, - numberingFormatSmallRomanNumberDot = 0x000D - }; - - enum MSONFC - { - msonfcArabic = 0x00, //decimal - msonfcUCRoman = 0x01, //upperRoman - msonfcLCRoman = 0x02, //lowerRoman - msonfcUCLetter = 0x03, //upperLetter - msonfcLCLetter = 0x04, //lowerLetter - msonfcOrdinal = 0x05, //ordinal - msonfcCardtext = 0x06, //cardinalText - msonfcOrdtext = 0x07, //ordinalText - msonfcHex = 0x08, //hex - msonfcChiManSty = 0x09, //chicago - msonfcDbNum1 = 0x0A, //ideographDigital - msonfcDbNum2 = 0x0B, //japaneseCounting - msonfcAiueo = 0x0C, //Aiueo - msonfcIroha = 0x0D, //Iroha - msonfcDbChar = 0x0E, //decimalFullWidth - msonfcSbChar = 0x0F, //decimalHalfWidth - msonfcDbNum3 = 0x10, //japaneseLegal - msonfcDbNum4 = 0x11, //japaneseDigitalTenThousand - msonfcCirclenum = 0x12, //decimalEnclosedCircle - msonfcDArabic = 0x13, //decimalFullWidth2 - msonfcDAiueo = 0x14, //aiueoFullWidth - msonfcDIroha = 0x15, //irohaFullWidth - msonfcArabicLZ = 0x16, //decimalZero - msonfcBullet = 0x17, //bullet - msonfcGanada = 0x18, //ganada - msonfcChosung = 0x19, //chosung - msonfcGB1 = 0x1A, //decimalEnclosedFullstop - msonfcGB2 = 0x1B, //decimalEnclosedParen - msonfcGB3 = 0x1C, //decimalEnclosedCircleChinese - msonfcGB4 = 0x1D, //ideographEnclosedCircle - msonfcZodiac1 = 0x1E, //ideographTraditional - msonfcZodiac2 = 0x1F, //ideographZodiac - msonfcZodiac3 = 0x20, //ideographZodiacTraditional - msonfcTpeDbNum1 = 0x21, //taiwaneseCounting - msonfcTpeDbNum2 = 0x22, //ideographLegalTraditional - msonfcTpeDbNum3 = 0x23, //taiwaneseCountingThousand - msonfcTpeDbNum4 = 0x24, //taiwaneseDigital - msonfcChnDbNum1 = 0x25, //chineseCounting - msonfcChnDbNum2 = 0x26, //chineseLegalSimplified - msonfcChnDbNum3 = 0x27, //chineseCountingThousand - msonfcChnDbNum4 = 0x28, //decimal - msonfcKorDbNum1 = 0x29, //koreanDigital - msonfcKorDbNum2 = 0x2A, //koreanCounting - msonfcKorDbNum3 = 0x2B, //koreanLegal - msonfcKorDbNum4 = 0x2C, //koreanDigital2 - msonfcHebrew1 = 0x2D, //hebrew1 - msonfcArabic1 = 0x2E, //arabicAlpha - msonfcHebrew2 = 0x2F, //hebrew2 - msonfcArabic2 = 0x30, //arabicAbjad - msonfcHindi1 = 0x31, //hindiVowels - msonfcHindi2 = 0x32, //hindiConsonants - msonfcHindi3 = 0x33, //hindiNumbers - msonfcHindi4 = 0x34, //hindiCounting - msonfcThai1 = 0x35, //thaiLetters - msonfcThai2 = 0x36, //thaiNumbers - msonfcThai3 = 0x37, //thaiCounting - msonfcViet1 = 0x38, //vietnameseCounting - msonfcNumInDash = 0x39, //numberInDash - msonfcLCRus = 0x3A, //russianLower - msonfcUCRus = 0x3B, //russianUpper - msonfcNone = 0xFF //Specifies that the sequence shall not display any numbering. - }; - - enum LevelJustification - { - levelJustificationLeft = 0x0, - levelJustificationCenter = 0x1, - levelJustificationRight = 0x2 - }; - - enum CharacterFollows - { - characterFollowsTab = 0x0, - characterFollowsSpace = 0x1, - characterFollowsNothing = 0x2 - }; - - enum LFOField - { - lfoFieldNotUsed00 = 0x00, - lfoFieldAUTONUMLGL = 0xFC, - lfoFieldAUTONUMOUT = 0xFD, - lfoFieldAUTONUM = 0xFE, - lfoFieldNotUsedFF = 0xFF - }; - - enum SBkcOperand - { - bkcContinuous = 0x00, //Continuous section break. The next section starts on the next line. - bkcNewColumn = 0x01, //New column section break. The next section starts in the next column. - bkcNewPage = 0x02, //New page section break. The next section starts on the next page. - bkcEvenPage = 0x03, //Even page section break. The next section starts on an even page. - bkcOddPage = 0x04 //Odd page section break. The next section starts on an odd page. - }; - - enum SBOrientationOperand - { - dmOrientPortrait = 0x01, //Portrait orientation. - dmOrientLandscape = 0x02 //Landscape orientation. - }; - - enum SClmOperand - { - clmUseDefault = 0x0000, //Specifies that document grid is disabled. - clmCharsAndLines = 0x0001, //Specifies a document grid enforcing both character spacing and line pitch. The line pitch and character spacing are specified by sprmSDyaLinePitch and sprmSDxtCharSpace respectively. - clmLinesOnly = 0x0002, //Specifies a document grid enforcing only line pitch. Line pitch is specified by sprmSDyaLinePitch. - clmEnforceGrid = 0x0003 //Specifies a document grid enforcing both character spacing and line pitch. The line pitch and character spacing are specified by sprmSDyaLinePitch and sprmSDxtCharSpace respectively. Each full-width character MUST occupy its own grid square. - }; - - enum PictureDataFormat - { - MM_SHAPE = 0x0064, //Shape object - MM_SHAPEFILE = 0x0066 //Shape file - }; - - enum SuperSubScript - { - superSubScriptNormalText = 0x00, - superSubScriptSuperscript = 0x01, - superSubScriptSubscript = 0x02 - }; - - enum BordersToApply - { - bordersToApplyTopBorder = 0x01, - bordersToApplyLogicalLeftBorder = 0x02, - bordersToApplyBottomBorder = 0x04, - bordersToApplyLogicalRightBorder = 0x08, - bordersToApplyFromTopLeftToBottomRight = 0x10, - bordersToApplyFromTopRightToBottomLeft = 0x20 - }; - - enum flt - { - fltUnable = 0x01, //Specifies that the field was unable to be parsed. - fltREFKeywordOmitted = 0x02, //Specifies that the field represents a REF field where the keyword has been omitted. - fltREF = 0x03, - fltFTNREF = 0x05, - fltSET = 0x06, - fltIF = 0x07, - fltINDEX = 0x08, - fltSTYLEREF = 0x0A, - fltSEQ = 0x0C, - fltTOC = 0x0D, - fltINFO = 0x0E, - fltTITLE = 0x0F, - fltSUBJECT = 0x10, - fltAUTHOR = 0x11, - fltKEYWORDS = 0x12, - fltCOMMENTS = 0x13, - fltLASTSAVEDBY = 0x14, - fltCREATEDATE = 0x15, - fltSAVEDATE = 0x16, - fltPRINTDATE = 0x17, - fltREVNUM = 0x18, - fltEDITTIME = 0x19, - fltNUMPAGES = 0x1A, - fltNUMWORDS = 0x1B, - fltNUMCHARS = 0x1C, - fltFILENAME = 0x1D, - fltTEMPLATE = 0x1E, - fltDATE = 0x1F, - fltTIME = 0x20, - fltPAGE = 0x21, - fltEqual = 0x22, - fltQUOTE = 0x23, - fltINCLUDE = 0x24, - fltPAGEREF = 0x25, - fltASK = 0x26, - fltFILLIN = 0x27, - fltDATA = 0x28, - fltNEXT = 0x29, - fltNEXTIF = 0x2A, - fltSKIPIF = 0x2B, - fltMERGEREC = 0x2C, - fltDDE = 0x2D, - fltDDEAUTO = 0x2E, - fltGLOSSARY = 0x2F, - fltPRINT = 0x30, - fltEQ = 0x31, - fltGOTOBUTTON = 0x32, - fltMACROBUTTON = 0x33, - fltAUTONUMOUT = 0x34, - fltAUTONUMLGL = 0x35, - fltAUTONUM = 0x36, - fltIMPORT = 0x37, - fltLINK = 0x38, - fltSYMBOL = 0x39, - fltEMBED = 0x3A, - fltMERGEFIELD = 0x3B, - fltUSERNAME = 0x3C, - fltUSERINITIALS = 0x3D, - fltUSERADDRESS = 0x3E, - fltBARCODE = 0x3F, - fltDOCVARIABLE = 0x40, - fltSECTION = 0x41, - fltSECTIONPAGES = 0x42, - fltINCLUDEPICTURE = 0x43, - fltINCLUDETEXT = 0x44, - fltFILESIZE = 0x45, - fltFORMTEXT = 0x46, - fltFORMCHECKBOX = 0x47, - fltNOTEREF = 0x48, - fltTOA = 0x49, - fltMERGESEQ = 0x4B, - fltAUTOTEXT = 0x4F, - fltCOMPARE = 0x50, - fltADDIN = 0x51, - fltFORMDROPDOWN = 0x53, - fltADVANCE = 0x54, - fltDOCPROPERTY = 0x55, - fltCONTROL = 0x57, - fltHYPERLINK = 0x58, - fltAUTOTEXTLIST = 0x59, - fltLISTNUM = 0x5A, - fltHTMLCONTROL = 0x5B, - fltBIDIOUTLINE = 0x5C, - fltADDRESSBLOCK = 0x5D, - fltGREETINGLINE = 0x5E, - fltSHAPE = 0x5F - }; - - enum fpc - { - fpcEndOfSection = 0, - fpcBottomMargin = 1, - fpcLastLine = 2 - }; - - enum rncFtn - { - rncFtnPreviousSection = 0, - rncFtnUniqueSection = 1, - rncFtnUniquePage = 2 - }; - - enum rncEdn - { - rncEdnPreviousSection = 0, - rncEdnUniqueSection = 1, - rncEdnUniquePage = 2 - }; - - enum epc - { - epcEndOfSection = 0, - epcEndofTheCurrentDocument = 3 - }; - - enum ViewingMode - { - viewingModeNone = 0, - viewingModePrint = 1, - viewingModeOutline = 2, - viewingModeMasterPages = 3, - viewingModeNormal = 4, - viewingModeWeb = 5 - }; - - enum ZoomType - { - zoomTypeNone = 0, - zoomTypeFullPage = 1, - zoomTypeBestFit = 2, - zoomTypeTextFit = 3 - }; - - enum TabJC - { - jcLeft = 0x0, //Left justification - jcCenter = 0x1, //Center justification - jcRight = 0x2, //Right justification - jcDecimal = 0x3, //Specifies that the current tab stop results in a location in the document where all following text is aligned around the first decimal separator in the following text runs. If there is no decimal separator, text is aligned around the implicit decimal separator after the last digit of the first numerical value appearing in the following text. All text runs before the first decimal character appear before the tab stop, all text runs after it appear after the tab stop location. - jcBar = 0x4, //Specifies that the current tab is a bar tab. - jcList = 0x6 //Specifies that the current tab is a list tab. - }; - - enum TabLC - { - tlcNone = 0x0, //No leader. - tlcDot = 0x1, //Dot leader. - tlcHyphen = 0x2, //Dashed leader. - tlcUnderscore = 0x3, //Underscore leader. - tlcHeavy = 0x4, //Same as tlcUnderscore. - tlcMiddleDot = 0x5, //Centered dot leader. - tlcDefault = 0x7 //Same as tlcNone. - }; - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Copts60.h b/ASCOfficeDocFile_old/DocxDocConverter/Copts60.h deleted file mode 100644 index 323dda87a8..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Copts60.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union Copts60 - { - private: - struct - { - unsigned short fNoTabForInd:1; - unsigned short fNoSpaceRaiseLower:1; - unsigned short fSuppressSpBfAfterPgBrk:1; - unsigned short fWrapTrailSpaces:1; - unsigned short fMapPrintTextColor:1; - unsigned short fNoColumnBalance:1; - unsigned short fConvMailMergeEsc:1; - unsigned short fSuppressTopSpacing:1; - unsigned short fOrigWordTableRules:1; - unsigned short unused14:1; - unsigned short fShowBreaksInFrames:1; - unsigned short fSwapBordersFacingPgs:1; - unsigned short fLeaveBackslashAlone:1; - unsigned short fExpShRtn:1; - unsigned short fDntULTrlSpc:1; - unsigned short fDntBlnSbDbWid:1; - } Copts60Struct; - unsigned short Copts60Short; - - public: - explicit Copts60( unsigned short _copts60 = 0 ): - Copts60Short(_copts60) - { - } - - Copts60( bool _fNoTabForInd, bool _fNoSpaceRaiseLower, bool _fSuppressSpBfAfterPgBrk, bool _fWrapTrailSpaces, - bool _fMapPrintTextColor, bool _fNoColumnBalance, bool _fConvMailMergeEsc, bool _fSuppressTopSpacing, - bool _fOrigWordTableRules, bool _fShowBreaksInFrames, bool _fSwapBordersFacingPgs, bool _fLeaveBackslashAlone, - bool _fExpShRtn, bool _fDntULTrlSpc, bool _fDntBlnSbDbWid ): - Copts60Short(0) - { - this->Copts60Struct.fNoTabForInd = ( ( _fNoTabForInd ) ? (1) : (0) ); - this->Copts60Struct.fNoSpaceRaiseLower = ( ( _fNoSpaceRaiseLower ) ? (1) : (0) ); - this->Copts60Struct.fSuppressSpBfAfterPgBrk = ( ( _fSuppressSpBfAfterPgBrk ) ? (1) : (0) ); - this->Copts60Struct.fWrapTrailSpaces = ( ( _fWrapTrailSpaces ) ? (1) : (0) ); - this->Copts60Struct.fMapPrintTextColor = ( ( _fMapPrintTextColor ) ? (1) : (0) ); - this->Copts60Struct.fNoColumnBalance = ( ( _fNoColumnBalance ) ? (1) : (0) ); - this->Copts60Struct.fConvMailMergeEsc = ( ( _fConvMailMergeEsc ) ? (1) : (0) ); - this->Copts60Struct.fSuppressTopSpacing = ( ( _fSuppressTopSpacing ) ? (1) : (0) ); - this->Copts60Struct.fOrigWordTableRules = ( ( _fOrigWordTableRules ) ? (1) : (0) ); - this->Copts60Struct.unused14 = 0; - this->Copts60Struct.fShowBreaksInFrames = ( ( _fShowBreaksInFrames ) ? (1) : (0) ); - this->Copts60Struct.fSwapBordersFacingPgs = ( ( _fSwapBordersFacingPgs ) ? (1) : (0) ); - this->Copts60Struct.fLeaveBackslashAlone = ( ( _fLeaveBackslashAlone ) ? (1) : (0) ); - this->Copts60Struct.fExpShRtn = ( ( _fExpShRtn ) ? (1) : (0) ); - this->Copts60Struct.fDntULTrlSpc = ( ( _fDntULTrlSpc ) ? (1) : (0) ); - this->Copts60Struct.fDntBlnSbDbWid = ( ( _fDntBlnSbDbWid ) ? (1) : (0) ); - } - - operator unsigned short () const - { - return this->Copts60Short; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DTTM.h b/ASCOfficeDocFile_old/DocxDocConverter/DTTM.h deleted file mode 100644 index d37450550a..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DTTM.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union DTTM - { - private: - struct - { - unsigned int mint:6; - unsigned int hr:5; - unsigned int dom:5; - unsigned int mon:4; - unsigned int yr:9; - unsigned int wdy:3; - } DTTMStruct; - unsigned int DTTMUnsignedInt; - - public: - explicit DTTM( unsigned int _dttm = 0 ): - DTTMUnsignedInt(_dttm) - { - } - - DTTM( unsigned char _mint, unsigned char _hr, unsigned char _dom, unsigned char _mon, unsigned short _yr, unsigned char _wdy ): - DTTMUnsignedInt(0) - { - this->DTTMStruct.mint = _mint; - this->DTTMStruct.hr = _hr; - this->DTTMStruct.dom = _dom; - this->DTTMStruct.mon = _mon; - this->DTTMStruct.yr = _yr; - this->DTTMStruct.wdy = _wdy; - } - - operator unsigned int () const - { - return this->DTTMUnsignedInt; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DefTableShd80Operand.h b/ASCOfficeDocFile_old/DocxDocConverter/DefTableShd80Operand.h deleted file mode 100644 index f855500dd9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DefTableShd80Operand.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Shd80.h" - -namespace ASCDocFileFormat -{ - class DefTableShd80Operand: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - DefTableShd80Operand(): - bytes(0), sizeInBytes(1) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - } - - explicit DefTableShd80Operand( const vector& _rgShd80 ): - bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = ( ( _rgShd80.size() * 2 ) + sizeof(unsigned char) ); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - this->bytes[0] = ( this->sizeInBytes - sizeof(unsigned char) ); - - unsigned int offset = sizeof(unsigned char); - - for ( vector::const_iterator iter = _rgShd80.begin(); iter != _rgShd80.end(); iter++ ) - { - unsigned short value = (unsigned short)(*iter); - - memcpy( ( this->bytes + offset ), &value, sizeof(unsigned short) ); - offset += sizeof(unsigned short); - } - } - } - } - - DefTableShd80Operand( const DefTableShd80Operand& _defTableShd80Operand ): - bytes(NULL), sizeInBytes(_defTableShd80Operand.sizeInBytes) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _defTableShd80Operand.bytes, this->sizeInBytes ); - } - } - } - - virtual ~DefTableShd80Operand() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; - - -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DefTableShdOperand.h b/ASCOfficeDocFile_old/DocxDocConverter/DefTableShdOperand.h deleted file mode 100644 index 57ff9c31e6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DefTableShdOperand.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "SHDOperand.h" - -namespace ASCDocFileFormat -{ - class DefTableShdOperand: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - DefTableShdOperand() : bytes(0), sizeInBytes(1) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - } - - explicit DefTableShdOperand( const vector& _rgShd ) : bytes(NULL), sizeInBytes(0) - { - if ( _rgShd.size() <= 22 ) - { - this->sizeInBytes = ( ( _rgShd.size() * 10 ) + sizeof(unsigned char) ); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - this->bytes[0] = ( this->sizeInBytes - sizeof(unsigned char) ); - - unsigned int offset = sizeof(unsigned char); - - for ( vector::const_iterator iter = _rgShd.begin(); iter != _rgShd.end(); iter++ ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(*iter), iter->Size() ); - offset += iter->Size(); - } - } - } - } - } - - DefTableShdOperand( const DefTableShdOperand& _defTableShdOperand ) : bytes(NULL), sizeInBytes(_defTableShdOperand.sizeInBytes) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _defTableShdOperand.bytes, this->sizeInBytes ); - } - } - } - - virtual ~DefTableShdOperand() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Defines.h b/ASCOfficeDocFile_old/DocxDocConverter/Defines.h deleted file mode 100644 index 2712455407..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Defines.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - namespace FIB_OFFSET - { - enum FIB - { - csw = 32, - cslw = 62, - cbRgFcLcb = 152 - }; - - enum FibBase - { - wIdent = 0, - nFib = 2, - lid = 6, - pnNext = 8, - nFibBack = 12, - lKey = 14, - envr = 18 - }; - - enum FibRgLw97 - { - cbMac = 64, - ccpText = 76, - ccpFtn = 80, - ccpHdd = 84, - ccpAtn = 92, - ccpEdn = 96, - ccpTxbx = 100, - ccpHdrTxbx = 104 - }; - - enum FibRgFcLcb97 // FibRgFcLcb97 - { - fcStshfOrig = 154, // This value is undefined and MUST be ignored. - lcbStshfOrig = 158, // This value is undefined and MUST be ignored. - fcStshf = 162, // specifies the style sheet for this document begins at this offset - lcbStshf = 166, // An unsigned integer that specifies the size, in bytes, of the STSH that begins at offset fcStshf in the Table Stream. This MUST be a nonzero value - fcPlcfSed = 202, - lcbPlcfSed = 206, - fcSttbfFfn = 274, - lcbSttbfFfn = 278, - fcDop = 402, // An unsigned integer that specifies an offset in the Table Stream. A Dopbegins at this offset. - lcbDop = 406, // An unsigned integer that specifies the size, in bytes, of the Dopat fcDop. This value MUST NOT be zero. - fcClx = 418, // An unsigned integer that specifies an offset in the Table Stream. A Clx begins at this offset. - lcbClx = 422, // An unsigned integer that specifies the size, in bytes, of the Clx at offset fcClx in the Table Stream. This value MUST be greater than zero. - fcPlcSpaMom = 474, // An unsigned integer that specifies an offset in the Table Stream. A PlcfSpa begins at this offset. The PlcfSpa contains shape information for the Main Document - lcbPlcSpaMom = 478, // An unsigned integer that specifies the size, in bytes, of the PlcfSpa at offset fcPlcSpaMom - fcPlcSpaHdr = 482, // A PlcfSpa begins at this offset. The PlcfSpa contains shape information for the Header Document. - lcbPlcSpaHdr = 486, // An unsigned integer that specifies the size, in bytes, of the PlcfSpa at the offset fcPlcSpaHdr - fcDggInfo = 554, // An OfficeArtContent that contains information about the drawings in the document begins at this offset. - lcbDggInfo = 558, // An unsigned integer that specifies the size, in bytes, of the OfficeArtContent at the offset fcDggInfo. If lcbDggInfo is zero, there MUST NOT be any drawings in the document. - - fcPlcftxbxTxt = 602, // - lcbPlcftxbxTxt = 606, - - fcPlcfHdrtxbxTxt = 618, - lcbPlcfHdrtxbxTxt = 622, - - fcPlcfTxbxBkd = 754, // смещение в стриме для структур описывающих текст в автофигурах (main document) - lcbPlcfTxbxBkd = 758, - fcPlcfTxbxHdrBkd = 762, // смещение в стриме для структур описывающих текст в автофигурах (header) - lcbPlcfTxbxHdrBkd = 766 - - }; - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DocFile.cpp b/ASCOfficeDocFile_old/DocxDocConverter/DocFile.cpp deleted file mode 100644 index 01866a2292..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DocFile.cpp +++ /dev/null @@ -1,2070 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "DocFile.h" - -#include - - -#define WRITE_STREAM_WORD(VAR) hr=STREAMS::CSWordWriter::Instance()->Write(FIB_OFFSET::VAR,&VAR,sizeof(VAR)) -#define WRITE_STREAM_TABLE(VAR,BUFFER) m_nBuffOk=0;hr=Write(m_pTableStream,fc##VAR,(unsigned char*)BUFFER,lcb##VAR,&m_nBuffOk); - -#define TEXT_OFFSET_POSITION 2048 - -namespace ASCDocFileFormat -{ - CDocFile::CDocFile() : m_oFontTable(), listFormatInfo(), listFormatOverrideInfo() - { - ccpText = 0; - ccpFtn = 0; - ccpHdd = 0; - ccpAtn = 0; - ccpEdn = 0; - ccpTxbx = 0; - ccpHdrTxbx = 0; - - m_pIStorage = NULL; - - m_pTableStream = NULL; - m_pSummaryInformationStream = NULL; - m_pDocumentSummaryInformationStream = NULL; - } - - CDocFile::~CDocFile() - { - RELEASEOBJECT(m_pIStorage); - RELEASEOBJECT(m_pTableStream); - - RELEASEOBJECT(m_pSummaryInformationStream); - RELEASEOBJECT(m_pDocumentSummaryInformationStream); - } -} - -namespace ASCDocFileFormat -{ - void CDocFile::AddTextItem (const ITextItem& oItem) - { - textItems.push_back (TextItem(oItem)); - } - - void CDocFile::AddFootnote (const Footnote& oFootnote) - { - m_Footnotes.push_back (TextItem(oFootnote)); - } - - void CDocFile::AddEndnote (const Endnote& oEndnote) - { - endnotes.push_back (TextItem(oEndnote)); - } - - void CDocFile::AddSectionProperties (const SectionProperties& oSectionProperties) - { - sectionProperties.push_back(oSectionProperties); - } - - CP CDocFile::OffsetToCP (unsigned int offset) const - { - return CP( ( offset - TEXT_OFFSET_POSITION ) / sizeof(wchar_t) ); - } -} - -namespace ASCDocFileFormat -{ - long CDocFile::WriteInformationBlock () - { - long hr = S_FALSE; - - STREAMS::CSWordWriter* pBin = STREAMS::CSWordWriter::Instance(); - if (NULL == pBin) - return S_FALSE; - -#define WRITE_FIELD(OFFSET,POINTER,SIZE) hr=pBin->Write(OFFSET,&POINTER,SIZE) - -#define SIZE_F 4096 // 2048 // начальную область обнуляем - unsigned char NILL[SIZE_F]; memset(NILL, 0, SIZE_F); WRITE_FIELD(0,NILL,SIZE_F); - - // FibBase - - Bool16 wIdent = 0xA5EC; WRITE_FIELD(FIB_OFFSET::wIdent, wIdent, sizeof(Bool16)); - Bool16 nFib = 0x00C1; WRITE_FIELD(FIB_OFFSET::nFib, nFib, sizeof(Bool16)); - Bool16 nUnused = 0; WRITE_FIELD(FIB_OFFSET::nFib + 2, nUnused, sizeof(Bool16)); - Bool16 lid = 0x419; WRITE_FIELD(FIB_OFFSET::lid, lid, sizeof(Bool16)); - Bool16 pnNext = 0; WRITE_FIELD(FIB_OFFSET::pnNext, pnNext, sizeof(Bool16)); - - ASCDocFormatUtils::BitSet oBits(1); - - oBits.SetBit(false,0); // fDot - oBits.SetBit(false,1); // fGlsy - oBits.SetBit(false,2); // fComplex - oBits.SetBit(false,3); // fHasPic - oBits.SetBits(0xF,4,4); // cQuickSaves - - ASCDocFormatUtils::BitSet oBits2(1); - - oBits2.SetBit(false,0); // fEncrypted - oBits2.SetBit(true, 1); //+ fWhichTblStm - oBits2.SetBit(false,2); // fReadOnlyRecommended - oBits2.SetBit(false,3); // fWriteReservation - oBits2.SetBit(true, 4); //+ fExtChar - oBits2.SetBit(false,5); // fLoadOverride - oBits2.SetBit(false,6); // fFarEast - oBits2.SetBit(false,7); // fObfuscated - - Bool16 buf0 = (Bool16)(*oBits.GetBytes()); WRITE_FIELD(FIB_OFFSET::pnNext + 2, buf0, sizeof(Bool16)); - Bool16 buf2 = (Bool16)(*oBits2.GetBytes()); WRITE_FIELD(FIB_OFFSET::pnNext + 3, buf2, sizeof(Bool16)); - - Bool16 nFibBack = 0x00BF; WRITE_FIELD(FIB_OFFSET::nFibBack, nFibBack, sizeof(Bool16)); - Bool32 lKey = 0; WRITE_FIELD(FIB_OFFSET::lKey, lKey, sizeof(Bool32)); - Bool16 envr = 0; WRITE_FIELD(FIB_OFFSET::envr, envr, sizeof(Bool16)); - - ASCDocFormatUtils::BitSet oBits3(1); - - oBits3.SetBit(false,0); // fMac - oBits3.SetBit(false,1); // fEmptySpecial - oBits3.SetBit(false,2); // fLoadOverridePage - oBits3.SetBit(false,3); // - fFutureSavedUndo (reserved) - oBits3.SetBit(true, 4); // - fWord97Saved (reserved) - oBits3.SetBit(false,5); // fSpare0 - oBits3.SetBit(false,6); // fSpare0 - oBits3.SetBit(false,7); // fSpare0 - - Bool8 buf3 = (Bool8)(*oBits3.GetBytes()); WRITE_FIELD(FIB_OFFSET::envr + 1, buf3, sizeof(Bool8)); - - // Fib - - Bool16 csw = 0x000E; WRITE_FIELD(FIB_OFFSET::csw, csw, sizeof(Bool16)); - - // FibRgW97 (fibRgW) - 28 bytes - //unsigned char fibRgW[88]; memset(fibRgW, 0x0, 28); WRITE_FIELD(FIB_OFFSET::csw + 2, fibRgW, 28); - - // Fib - - Bool16 cslw = 0x0016; WRITE_FIELD(FIB_OFFSET::cslw, cslw, sizeof(Bool16)); - - // FibRgLw97 (fibRgLw) - 88 bytes - //unsigned char fibRgLw[88]; memset(fibRgLw, 0x0, 88); WRITE_FIELD(FIB_OFFSET::cbMac, fibRgLw, 88); - - //Bool32 cbMac = 0; WRITE_FIELD(FIB_OFFSET::cbMac, cbMac, sizeof(Bool32)); - //Bool32 ccpText = 0; WRITE_FIELD(FIB_OFFSET::ccpText, ccpText, sizeof(Bool32)); - //Bool32 ccpFtn = 0; WRITE_FIELD(FIB_OFFSET::ccpFtn, ccpFtn, sizeof(Bool32)); - //Bool32 ccpHdd = 0; WRITE_FIELD(FIB_OFFSET::ccpHdd, ccpHdd, sizeof(Bool32)); - //Bool32 ccpAtn = 0; WRITE_FIELD(FIB_OFFSET::ccpAtn, ccpAtn, sizeof(Bool32)); - //Bool32 ccpEdn = 0; WRITE_FIELD(FIB_OFFSET::ccpEdn, ccpEdn, sizeof(Bool32)); - //Bool32 ccpTxbx = 0; WRITE_FIELD(FIB_OFFSET::ccpTxbx, ccpTxbx, sizeof(Bool32)); - //Bool32 ccpHdrTxbx = 0; WRITE_FIELD(FIB_OFFSET::ccpHdrTxbx, ccpHdrTxbx, sizeof(Bool32)); - - // 0x00B7 - 0x00C1 - FibRgFcLcb97 - ошибка в спецификации, перепутаны значения по умолчанию - - Bool16 cbRgFcLcb = 0x00B7; WRITE_FIELD(FIB_OFFSET::cbRgFcLcb, cbRgFcLcb, sizeof(Bool16)); - - // FibRgFcLcb97 - 186 * 4 bytes - - // unsigned char FibRgFcLcb97[186*4]; - // memset(FibRgFcLcb97, 0x0, 186*4); WRITE_FIELD(FIB_OFFSET::cbRgFcLcb + 2, FibRgFcLcb97, 186*4); - - // Bool16 cswNew = 0; WRITE_FIELD(FIB_OFFSET::cbRgFcLcb + 2 + 186*4, cswNew, sizeof(Bool16)); - - // TODO : fill default values - - return S_OK; - } - - long CDocFile::WriteDocument() - { - long hr = S_FALSE; - - STREAMS::CSWordWriter* pBin = STREAMS::CSWordWriter::Instance(); - if (NULL == pBin) - return hr; - - m_arChpx.clear(); - m_arRunsOffsets.clear(); - m_arParagraphsOffSets.clear(); - m_arPapxInFkp.clear(); - - unsigned long writtenSize = 0; - unsigned int textPosition = TEXT_OFFSET_POSITION; - - writtenSize = 0; - - ccpText = GetFibRgLw97_ccpText(); - if (ccpText) - { - m_oartStorage = COArtStorage::Instance(); - - vector AllFootnotesReferences; - vector AllEndnotesReferences; - - WriteMainDocument(&textPosition, &AllFootnotesReferences, &AllEndnotesReferences); - - if ((!AllFootnotesReferences.empty()) && (!m_Footnotes.empty())) - { - WriteFootnoteDocument(&textPosition, &AllFootnotesReferences); - } - - WriteHeadersAndFootersDocument (&textPosition); - - if ((!AllEndnotesReferences.empty()) && (!endnotes.empty())) - { - WriteEndnoteDocument(&textPosition, &AllEndnotesReferences); - } - - //if ((!m_Footnotes.empty()) || (!endnotes.empty()) || (ccpHdd > 0)) - //{ - // hr = Write (pBin->Get(), textPosition, std::wstring(&TextMark::ParagraphEnd).c_str(), (std::wstring( &TextMark::ParagraphEnd ).size() * sizeof(wchar_t)), &writtenSize); - // textPosition += writtenSize; - //} - - CalculateOffTbRefs (textPosition); - textPosition += WriteStrTbRefs (textPosition); - - WriteFibMainTBRefs(); - WriteFibHeadTBRefs(); - - m_arParagraphsOffSets.push_back (textPosition); - m_arRunsOffsets.push_back (textPosition); - - // Write fcMin in FIB - unsigned int fcMin = TEXT_OFFSET_POSITION; - hr = pBin->Write (24, &fcMin, sizeof(fcMin)); - - // Write fcMac in FIB - unsigned int fcMac = textPosition; - hr = pBin->Write (28, &fcMac, sizeof(fcMac)); - - //write Clx - vector aCP; - vector aPcd; - - aCP.push_back(0); - - unsigned int lastACP = (ccpText + ccpFtn + ccpHdd + ccpAtn + ccpEdn + ccpTxbx + ccpHdrTxbx); - - if ( ( ccpFtn != 0 ) || ( ccpHdd != 0 ) || ( ccpAtn != 0 ) || ( ccpEdn != 0 ) ) - { - lastACP++; - } - - aCP.push_back( lastACP ); - - aPcd.push_back( Pcd( false, TEXT_OFFSET_POSITION, 0 ) ); - - Clx clx( NULL, Pcdt( aCP, aPcd ) ); - - unsigned int fcClx = m_pTableStream->size(); - unsigned int lcbClx = clx.Size(); - - WRITE_STREAM_WORD(fcClx); // 418 - WRITE_STREAM_WORD(lcbClx); // 422 - - clx.WriteToStream( m_pTableStream, fcClx ); - - const unsigned int PapxFkpOffset = ( ( ( textPosition ) / 512 ) + 1 ); - unsigned long ChpxFkpOffset = ( PapxFkpOffset + 1 ); - - const unsigned int PlcBteOffset = m_pTableStream->size(); - - // Write paragraphs properties - vector allPapxFkps = PapxFkp::GetAllPapxFkps(m_arParagraphsOffSets, m_arPapxInFkp); - - vector _aFC; - vector aPnBtePapx; - - _aFC.push_back( TEXT_OFFSET_POSITION ); - - for (unsigned int i = 0; i < allPapxFkps.size(); ++i) - { - allPapxFkps[i].WriteToStream (pBin->Get(), ( ( PapxFkpOffset * 512 ) + ( 512 * i ) )); - - textPosition = ( ( PapxFkpOffset * 512 ) + ( 512 * i ) ) + allPapxFkps[i].GetEndOffset(); - - _aFC.push_back( allPapxFkps[i].GetEndOffset() ); - aPnBtePapx.push_back( PapxFkpOffset + i ); - ChpxFkpOffset = ( PapxFkpOffset + 1 + i ); - } - - // Write lcbPlcfBtePapx - unsigned int lcbPlcfBtePapx = ( ( ( _aFC.size() - 1 ) * 8 ) + 4 ); - hr = pBin->Write (262, &lcbPlcfBtePapx, sizeof(lcbPlcfBtePapx) ); - - // Write fcPlcfBtePapx - unsigned int fcPlcfBtePapx = PlcBteOffset; - hr = pBin->Write (258, &fcPlcfBtePapx, sizeof(fcPlcfBtePapx) ); - - PlcBtePapx plcBtePapx( _aFC, aPnBtePapx ); - plcBtePapx.WriteToStream( m_pTableStream, PlcBteOffset ); - - //write runs properties - vector allChpxFkps = ChpxFkp::GetAllChpxFkps(m_arRunsOffsets, m_arChpx); - - _aFC.clear(); - vector aPnBteChpx; - - _aFC.push_back(TEXT_OFFSET_POSITION); - - for (unsigned int i = 0; i < allChpxFkps.size(); ++i) - { - allChpxFkps[i].WriteToStream( pBin->Get(), ( ( ChpxFkpOffset * 512 ) + ( 512 * i ) ) ); - - textPosition = ( ( ChpxFkpOffset * 512 ) + ( 512 * i ) ) + allChpxFkps[i].GetEndOffset(); - - _aFC.push_back( allChpxFkps[i].GetEndOffset() ); - aPnBteChpx.push_back( ChpxFkpOffset + i ); - } - - unsigned int lcbPlcfBteChpx = ( ( ( _aFC.size() - 1 ) * 8 ) + 4 ); - hr = pBin->Write (254, &lcbPlcfBteChpx, sizeof(lcbPlcfBteChpx) ); - - unsigned int fcPlcfBteChpx = ( PlcBteOffset + lcbPlcfBtePapx ); - hr = pBin->Write (250, &fcPlcfBteChpx, sizeof(fcPlcfBteChpx) ); - - PlcBteChpx plcBteChpx(_aFC, aPnBteChpx); - plcBteChpx.WriteToStream(m_pTableStream, (PlcBteOffset + lcbPlcfBtePapx)); - - pBin->SetPosition (textPosition); - - // дописываем в поток все изображения - - if (m_oartStorage) - m_oartStorage->WriteBlips (); - } - - return hr; - } - - long CDocFile::WriteMainDocument (unsigned int* _textPosition, vector* _AllFootnotesReferences, vector* _AllEndnotesReferences) - { - long hr = S_FALSE; - - if ( ( _textPosition != NULL ) && ( _AllFootnotesReferences != NULL ) && ( _AllEndnotesReferences != NULL )) - { - unsigned long writtenSize = 0; - - WriteFibRgLw97 (); - - map cpFldMap; - vector> bookmarksStartsCPsWithIDs; - vector> bookmarksEndsCPsWithIDs; - vector bookmarksNames; - - //write all text to the document - for (list::iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - vector allTextItemOffsets; - vector allTextItemProperties = (*iter)->GetAllParagraphsProperties( &allTextItemOffsets ); - - for (unsigned int i = 0; i < allTextItemProperties.size(); ++i) - { - m_arPapxInFkp.push_back(allTextItemProperties[i]); - m_arParagraphsOffSets.push_back(*_textPosition + allTextItemOffsets[i]); - } - - vector allTextItemRunsOffsets; - vector allTextItemChpxs = (*iter)->GetAllRunProperties( &allTextItemRunsOffsets ); - - for (unsigned int i = 0; i < allTextItemChpxs.size(); ++i) - { - m_arChpx.push_back(allTextItemChpxs[i]); - m_arRunsOffsets.push_back(*_textPosition + allTextItemRunsOffsets[i]); - } - - vector allTextItemFootnotes = iter->GetAllRunItemsByType(); - - for (vector::const_iterator footnotesIter = allTextItemFootnotes.begin(); footnotesIter != allTextItemFootnotes.end(); ++footnotesIter) - { - _AllFootnotesReferences->push_back(OffsetToCP( *_textPosition + footnotesIter->GetOffset())); - } - - vector allTextItemEndnotes = iter->GetAllRunItemsByType(); - - for (vector::const_iterator endnotesIter = allTextItemEndnotes.begin(); endnotesIter != allTextItemEndnotes.end(); ++endnotesIter) - { - _AllEndnotesReferences->push_back(OffsetToCP( *_textPosition + endnotesIter->GetOffset() ) ); - } - - vector allTextItemBookmarksStarts = iter->GetAllParagraphItemsByType(); - - for ( vector::const_iterator bookmarksStartsIter = allTextItemBookmarksStarts.begin(); bookmarksStartsIter != allTextItemBookmarksStarts.end(); bookmarksStartsIter++ ) - { - if ( bookmarksStartsIter->is() ) - { - const BookmarkStart& bookmarkStart = bookmarksStartsIter->as(); - - bookmarksStartsCPsWithIDs.push_back( make_pair(OffsetToCP( *_textPosition + bookmarksStartsIter->GetOffset() ), bookmarkStart.GetID() ) ); - bookmarksNames.push_back( bookmarkStart.GetName() ); - } - } - - vector allTextItemBookmarksEnds = iter->GetAllParagraphItemsByType(); - - for ( vector::const_iterator bookmarksEndsIter = allTextItemBookmarksEnds.begin(); bookmarksEndsIter != allTextItemBookmarksEnds.end(); bookmarksEndsIter++ ) - { - if ( bookmarksEndsIter->is() ) - { - const BookmarkEnd& bookmarkEnd = bookmarksEndsIter->as(); - - bookmarksEndsCPsWithIDs.push_back( make_pair(OffsetToCP( *_textPosition + bookmarksEndsIter->GetOffset() ), bookmarkEnd.GetID() ) ); - } - } - - AddFldCharsData (*_textPosition, (*iter), &cpFldMap); - AddHyperlinksData (*_textPosition, (*iter), &cpFldMap); - AddInlineShapesData (*_textPosition, (*iter), &cpFldMap); - - std::wstring strText = (*iter)->GetAllText(); - - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), *_textPosition, strText.c_str(), (sizeof(wchar_t) * strText.size()), &writtenSize); - *_textPosition += writtenSize; - } - - hr = WriteMainDocumentFields(cpFldMap); - hr = WriteBookmarks(bookmarksStartsCPsWithIDs, bookmarksEndsCPsWithIDs, bookmarksNames); - } - - return hr; - } - - void CDocFile::AddFldCharsData (unsigned int nTextPos, const TextItem& oItem, map* cpFldMap) - { - if(cpFldMap) - { - vector& arrFldChars = oItem.GetAllRunItemsByType(); - if (arrFldChars.empty()) - return; - - for (vector::const_iterator fldCharsIter = arrFldChars.begin(); fldCharsIter != arrFldChars.end(); ++fldCharsIter) - { - if (fldCharsIter->is()) - { - const Run& run = fldCharsIter->as(); - - for (list::const_iterator runIter = run.begin(); runIter != run.end(); ++runIter) - { - if (runIter->is()) - { - const FldChar& fldChar = runIter->as(); - - cpFldMap->insert( make_pair( OffsetToCP( nTextPos + fldCharsIter->GetOffset() ), fldChar.GetField() ) ); - } - } - } - } - } - } - - void CDocFile::AddHyperlinksData (unsigned int nTextPos, const TextItem& oItem, map* cpFldMap) - { - if (cpFldMap) - { - const vector& oHyperlinks = oItem.GetAllParagraphItemsByType(); - if (oHyperlinks.empty()) - return; - - for (size_t j = 0; j < oHyperlinks.size(); ++j) - { - if (oHyperlinks[j].is()) - { - Hyperlink oHyperlink = oHyperlinks[j].as(); - - vector hyperlinkACP = oHyperlink.GetFieldCharactersPositions(); - vector hyperlinkAFld = oHyperlink.GetFieldCharactersProperties(); - - for (size_t i = 0; i < hyperlinkACP.size(); ++i) - { - cpFldMap->insert ( make_pair( CP(OffsetToCP(nTextPos + oHyperlinks[j].GetOffset()) + hyperlinkACP[i] ), hyperlinkAFld[i])); - } - } - } - } - } - - - void CDocFile::AddInlineShapesData (unsigned int nTextPos, const TextItem& oItem, map* cpFldMap) - { - if (cpFldMap) - { - const vector& oInlineShapes = oItem.GetAllParagraphItemsByType(); - if (oInlineShapes.empty()) - return; - - for (size_t j = 0; j < oInlineShapes.size(); ++j) - { - if (oInlineShapes[j].is()) - { - InlineShape oShape = oInlineShapes[j].as(); - - vector oShapeACP = oShape.GetFieldCharactersPositions(); - vector oShapeAFld = oShape.GetFieldCharactersProperties(); - - for (size_t i = 0; i < oShapeACP.size(); ++i) - { - cpFldMap->insert ( make_pair( CP(OffsetToCP(nTextPos + oInlineShapes[j].GetOffset()) + oShapeACP[i] ), oShapeAFld[i])); - } - } - } - } - } - - - - long CDocFile::WriteMainDocumentFields( const map& _cpFldMap ) - { - long hr = S_FALSE; - - if ( !_cpFldMap.empty() ) - { - vector _aCP; - vector _aFld; - - for ( map::const_iterator iter = _cpFldMap.begin(); iter != _cpFldMap.end(); iter++ ) - { - _aCP.push_back( iter->first ); - _aFld.push_back( iter->second ); - } - - _aCP.push_back(CP(ccpText + 1)); - - ULONG writtenSize = 0; - - Plcfld plcfld( _aCP, _aFld ); - - unsigned int fcPlcfFldMom = m_pTableStream->size(); - unsigned int lcbPlcfFldMom = plcfld.Size(); - - hr = Write(m_pTableStream, fcPlcfFldMom, plcfld, lcbPlcfFldMom, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (282, &fcPlcfFldMom, sizeof(fcPlcfFldMom)); - hr = STREAMS::CSWordWriter::Instance()->Write (286, &lcbPlcfFldMom, sizeof(lcbPlcfFldMom)); - } - - return hr; - } - - long CDocFile::WriteFootnoteDocumentFields (const map& _cpFldMap) - { - long hr = S_FALSE; - - if ( !_cpFldMap.empty() ) - { - std::vector _aCP; - std::vector _aFld; - - for (map::const_iterator iter = _cpFldMap.begin(); iter != _cpFldMap.end(); ++iter) - { - _aCP.push_back(iter->first); - _aFld.push_back(iter->second); - } - - _aCP.push_back(CP(ccpFtn + 1)); - - ULONG writtenSize = 0; - - Plcfld plcfld(_aCP, _aFld); - - unsigned int fcPlcfFldFtn = m_pTableStream->size(); - unsigned int lcbPlcfFldFtn = plcfld.Size(); - - hr = Write(m_pTableStream, fcPlcfFldFtn, plcfld, lcbPlcfFldFtn, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (298, &fcPlcfFldFtn, sizeof(fcPlcfFldFtn)); - hr = STREAMS::CSWordWriter::Instance()->Write (302, &lcbPlcfFldFtn, sizeof(lcbPlcfFldFtn)); - } - - return hr; - } - - long CDocFile::WriteEndnoteDocumentFields( const map& _cpFldMap ) - { - long hr = S_FALSE; - - if ( !_cpFldMap.empty() ) - { - vector _aCP; - vector _aFld; - - for (map::const_iterator iter = _cpFldMap.begin(); iter != _cpFldMap.end(); ++iter) - { - _aCP.push_back( iter->first ); - _aFld.push_back( iter->second ); - } - - _aCP.push_back(CP(ccpEdn + 1)); - - ULONG writtenSize = 0; - - Plcfld plcfld( _aCP, _aFld ); - - unsigned int fcPlcfFldEdn = m_pTableStream->size(); - unsigned int lcbPlcfFldEdn = plcfld.Size(); - - hr = Write(m_pTableStream, fcPlcfFldEdn, plcfld, lcbPlcfFldEdn, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (538, &fcPlcfFldEdn, sizeof(fcPlcfFldEdn)); - hr = STREAMS::CSWordWriter::Instance()->Write (542, &lcbPlcfFldEdn, sizeof(lcbPlcfFldEdn)); - } - - return hr; - } - - long CDocFile::WriteHeadersAndFootersDocumentFields( const map& _cpFldMap ) - { - long hr = S_FALSE; - - if ( !_cpFldMap.empty() ) - { - vector _aCP; - vector _aFld; - - for (map::const_iterator iter = _cpFldMap.begin(); iter != _cpFldMap.end(); ++iter) - { - _aCP.push_back( iter->first ); - _aFld.push_back( iter->second ); - } - - _aCP.push_back(CP(ccpHdd + 1)); - - ULONG writtenSize = 0; - - Plcfld plcfld(_aCP, _aFld); - - unsigned int fcPlcfFldHdr = m_pTableStream->size(); - unsigned int lcbPlcfFldHdr = plcfld.Size(); - - hr = Write(m_pTableStream, fcPlcfFldHdr, plcfld, lcbPlcfFldHdr, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (290, &fcPlcfFldHdr, sizeof(fcPlcfFldHdr)); - hr = STREAMS::CSWordWriter::Instance()->Write (294, &lcbPlcfFldHdr, sizeof(lcbPlcfFldHdr)); - } - - return hr; - } - - long CDocFile::WriteBookmarks( const vector>& _bookmarksStartsCPsWithIDs, const vector>& _bookmarksEndsCPsWithIDs, const vector& _bookmarksNames ) - { - long hr = S_FALSE; - - if ( ( !_bookmarksStartsCPsWithIDs.empty() ) && ( !_bookmarksEndsCPsWithIDs.empty() ) && ( !_bookmarksNames.empty() ) ) - { - vector aCP; - vector aData; - vector bookmarksNamesPresent( _bookmarksNames.size(), false ); - vector bookmarksEndsPresent( _bookmarksEndsCPsWithIDs.size(), false ); - - for ( unsigned int i = 0; i < _bookmarksStartsCPsWithIDs.size(); i++ ) - { - short index = this->GetBookmarkIndexByID( _bookmarksStartsCPsWithIDs[i].second, _bookmarksEndsCPsWithIDs ); - - if ( index != -1 ) - { - aCP.push_back( _bookmarksStartsCPsWithIDs[i].first ); - aData.push_back( FBKF( index, BKC() ) ); - bookmarksNamesPresent[i] = true; - bookmarksEndsPresent[index] = true; - } - } - - aCP.push_back(CP(ccpText + 1)); - - ULONG writtenSize = 0; - - Plcfbkf plcfbkf(aCP, aData ); - - unsigned int fcPlcfBkf = m_pTableStream->size(); - unsigned int lcbPlcfBkf = plcfbkf.Size(); - - hr = Write(m_pTableStream, fcPlcfBkf, plcfbkf, lcbPlcfBkf, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (330, &fcPlcfBkf, sizeof(fcPlcfBkf)); - hr = STREAMS::CSWordWriter::Instance()->Write (334, &lcbPlcfBkf, sizeof(lcbPlcfBkf)); - - aCP.clear(); - aData.clear(); - - for ( unsigned int i = 0; i < _bookmarksEndsCPsWithIDs.size(); i++ ) - { - if ( bookmarksEndsPresent[i] ) - { - aCP.push_back( _bookmarksEndsCPsWithIDs[i].first ); - } - } - - aCP.push_back( CP( this->ccpText + 1 ) ); - - Plcfbkl plcfbkl( aCP ); - - - unsigned int fcPlcfBkl = m_pTableStream->size(); - unsigned int lcbPlcfBkl = plcfbkl.Size(); - - hr = Write(m_pTableStream, fcPlcfBkl, plcfbkl, lcbPlcfBkl, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (338, &fcPlcfBkl, sizeof(fcPlcfBkl)); - hr = STREAMS::CSWordWriter::Instance()->Write (342, &lcbPlcfBkl, sizeof(lcbPlcfBkl)); - - vector bookmarksNames; - - for ( unsigned int i = 0; i < _bookmarksNames.size(); i++ ) - { - if ( bookmarksNamesPresent[i] ) - { - bookmarksNames.push_back( BookmarkName( _bookmarksNames[i].c_str() ) ); - } - } - - SttbfBkmk sttbfBkmk( true, &bookmarksNames ); - - unsigned int fcSttbfBkmk = m_pTableStream->size(); - unsigned int lcbSttbfBkmk = sttbfBkmk.Size(); - - hr = Write(m_pTableStream, fcSttbfBkmk, sttbfBkmk, lcbSttbfBkmk, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (322, &fcSttbfBkmk, sizeof(fcSttbfBkmk)); - hr = STREAMS::CSWordWriter::Instance()->Write (326, &lcbSttbfBkmk, sizeof(lcbSttbfBkmk)); - } - - return hr; - } - - short CDocFile::GetBookmarkIndexByID(const wstring& _id, const vector>& _bookmarksCPsWithIDs) - { - for ( short index = 0; index < (short)_bookmarksCPsWithIDs.size(); index++ ) - { - if ( _bookmarksCPsWithIDs[index].second == _id ) - { - return index; - } - } - - return -1; - } - - long CDocFile::WriteFootnoteDocument( unsigned int* _textPosition, vector* _AllFootnotesReferences ) - { - long hr = S_FALSE; - - if ( ( _textPosition != NULL ) && ( _AllFootnotesReferences != NULL )) - { - ULONG writtenSize = 0; - //STATSTG stg; - - if ( !m_Footnotes.empty() ) - { - Paragraph footnotesEndParagraph; - footnotesEndParagraph.AddParagraphItem( Run() ); - Footnote& lastFootnote = m_Footnotes.back().as(); - lastFootnote.AddTextItem( footnotesEndParagraph ); - lastFootnote.AddTextItem( footnotesEndParagraph ); - } - - wstring allFootnotesText; - map cpFldMap; - vector allFootnotesIndexes; - vector allFootnotesOffsets; - unsigned int footnotesOffset = *_textPosition; - unsigned int footnoteOffset = 0; - - for (list::const_iterator iter = m_Footnotes.begin(); iter != m_Footnotes.end(); ++iter) - { - Footnote footnoteIter = iter->as(); - - vector allFootnoteOffsets; - vector allFootnoteProperties = footnoteIter.GetAllParagraphsProperties( &allFootnoteOffsets ); - - for (unsigned int i = 0; i < allFootnoteProperties.size(); ++i) - { - m_arPapxInFkp.push_back(allFootnoteProperties[i]); - m_arParagraphsOffSets.push_back( footnotesOffset + allFootnoteOffsets[i] ); - } - - vector allFootnoteRunsOffsets; - vector allFootnoteChpxs = footnoteIter.GetAllRunProperties( &allFootnoteRunsOffsets ); - - for (unsigned int i = 0; i < allFootnoteChpxs.size(); ++i) - { - m_arChpx.push_back(allFootnoteChpxs[i]); - m_arRunsOffsets.push_back(footnotesOffset + allFootnoteRunsOffsets[i]); - } - - allFootnotesIndexes.push_back(footnoteIter.GetIndex()); - allFootnotesOffsets.push_back(CP( allFootnotesText.size())); - - AddFldCharsData (( TEXT_OFFSET_POSITION + footnoteOffset ), (*iter), &cpFldMap); - AddHyperlinksData(( TEXT_OFFSET_POSITION + footnoteOffset ), (*iter), &cpFldMap); - AddInlineShapesData(( TEXT_OFFSET_POSITION + footnoteOffset ), (*iter), &cpFldMap); - - footnoteOffset += ( footnoteIter.GetAllText().size() * sizeof(wchar_t) ); - allFootnotesText += footnoteIter.GetAllText(); - footnotesOffset = ( *_textPosition + footnoteOffset ); - } - - WriteFootnoteDocumentFields(cpFldMap); - - allFootnotesOffsets.push_back( CP( allFootnotesText.size() - 1 ) ); - allFootnotesOffsets.push_back( CP( allFootnotesText.size() + 1 ) ); - - //write ccpFtn in FIB - ccpFtn = allFootnotesText.size(); - - if (ccpFtn > 0) - { - PlcffndTxt plcffndTxt( allFootnotesOffsets ); - _AllFootnotesReferences->push_back( CP( this->ccpText + this->ccpFtn + 1 ) ); - PlcffndRef plcffndRef( *_AllFootnotesReferences, allFootnotesIndexes ); - - //m_pTableStream->Stat( &stg, STATFLAG_NONAME ); - - unsigned int fcPlcffndTxt = 0;//stg.cbSize.LowPart; - unsigned int lcbPlcffndTxt = plcffndTxt.Size(); - - hr = Write(m_pTableStream, fcPlcffndTxt, plcffndTxt, lcbPlcffndTxt, &writtenSize ); - - //m_pTableStream->Stat( &stg, STATFLAG_NONAME ); - - unsigned int fcPlcffndRef = 0;//stg.cbSize.LowPart; - unsigned int lcbPlcffndRef = plcffndRef.Size(); - - hr = Write(m_pTableStream, fcPlcffndRef, plcffndRef, lcbPlcffndRef, &writtenSize ); - - hr = STREAMS::CSWordWriter::Instance()->Write (80, &(this->ccpFtn), sizeof(this->ccpFtn)); - hr = STREAMS::CSWordWriter::Instance()->Write (178, &fcPlcffndTxt, sizeof(fcPlcffndTxt)); - hr = STREAMS::CSWordWriter::Instance()->Write (182, &lcbPlcffndTxt, sizeof(lcbPlcffndTxt)); - hr = STREAMS::CSWordWriter::Instance()->Write (170, &fcPlcffndRef, sizeof(fcPlcffndRef)); - hr = STREAMS::CSWordWriter::Instance()->Write (174, &lcbPlcffndRef, sizeof(lcbPlcffndRef)); - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), ( *_textPosition ), allFootnotesText.c_str(), ( allFootnotesText.size() * sizeof(wchar_t) ), &writtenSize ); - - *_textPosition += writtenSize; - } - } - - return hr; - } - - long CDocFile::WriteEndnoteDocument( unsigned int* _textPosition, vector* _AllEndnotesReferences) - { - long hr = S_FALSE; - - if ( ( _textPosition != NULL ) && ( _AllEndnotesReferences != NULL )) - { - ULONG writtenSize = 0; - //STATSTG stg; - - if ( !this->endnotes.empty() ) - { - Paragraph endnotesEndParagraph; - endnotesEndParagraph.AddParagraphItem( Run() ); - Endnote& lastEndnote = this->endnotes.back().as(); - lastEndnote.AddTextItem( endnotesEndParagraph ); - lastEndnote.AddTextItem( endnotesEndParagraph ); - } - - wstring allEndnotesText; - map cpFldMap; - vector allEndnotesIndexes; - vector allEndnotesOffsets; - unsigned int endnotesOffset = *_textPosition; - unsigned int endnoteOffset = 0; - - for (std::list::const_iterator iter = endnotes.begin(); iter != endnotes.end(); ++iter) - { - Endnote endnoteIter = iter->as(); - - vector allEndnoteOffsets; - vector allEndnoteProperties = endnoteIter.GetAllParagraphsProperties( &allEndnoteOffsets ); - - for ( unsigned int i = 0; i < allEndnoteProperties.size(); i++ ) - { - m_arPapxInFkp.push_back( allEndnoteProperties[i] ); - m_arParagraphsOffSets.push_back( endnotesOffset + allEndnoteOffsets[i] ); - } - - vector allEndnoteRunsOffsets; - vector allEndnoteChpxs = endnoteIter.GetAllRunProperties( &allEndnoteRunsOffsets ); - - for ( unsigned int i = 0; i < allEndnoteChpxs.size(); i++ ) - { - m_arChpx.push_back( allEndnoteChpxs[i] ); - m_arRunsOffsets.push_back( endnotesOffset + allEndnoteRunsOffsets[i] ); - } - - allEndnotesIndexes.push_back( endnoteIter.GetIndex() ); - allEndnotesOffsets.push_back( CP( allEndnotesText.size() ) ); - - AddFldCharsData (( TEXT_OFFSET_POSITION + endnoteOffset), (*iter), &cpFldMap); - AddHyperlinksData (( TEXT_OFFSET_POSITION + endnoteOffset), (*iter), &cpFldMap); - AddInlineShapesData (( TEXT_OFFSET_POSITION + endnoteOffset), (*iter), &cpFldMap); - - endnoteOffset += ( endnoteIter.GetAllText().size() * sizeof(wchar_t) ); - allEndnotesText += endnoteIter.GetAllText(); - endnotesOffset = ( *_textPosition + endnoteOffset ); - } - - WriteEndnoteDocumentFields(cpFldMap); - - allEndnotesOffsets.push_back( CP( allEndnotesText.size() - 1 ) ); - allEndnotesOffsets.push_back( CP( allEndnotesText.size() + 1 ) ); - - //write ccpEdn in FIB - ccpEdn = allEndnotesText.size(); - - if ( this->ccpEdn > 0 ) - { - PlcfendTxt plcfendTxt( allEndnotesOffsets ); - _AllEndnotesReferences->push_back( CP( this->ccpText + this->ccpFtn + this->ccpHdd + this->ccpAtn + this->ccpEdn + 1 ) ); - PlcfendRef plcfendRef( *_AllEndnotesReferences, allEndnotesIndexes ); - - - unsigned int fcPlcfendTxt = m_pTableStream->size();//stg.cbSize.LowPart; - unsigned int lcbPlcfendTxt = plcfendTxt.Size(); - - hr = Write(m_pTableStream, fcPlcfendTxt, plcfendTxt, lcbPlcfendTxt, &writtenSize ); - - - unsigned int fcPlcfendRef = m_pTableStream->size();//stg.cbSize.LowPart; - unsigned int lcbPlcfendRef = plcfendRef.Size(); - - hr = Write(m_pTableStream, fcPlcfendRef, plcfendRef, lcbPlcfendRef, &writtenSize ); - - WRITE_STREAM_WORD(ccpEdn); - // hr = STREAMS::CSWordWriter::Instance()->Write (FIB_OFFSET::ccpEdn, &(ccpEdn), sizeof(ccpEdn)); - hr = STREAMS::CSWordWriter::Instance()->Write (530, &fcPlcfendTxt, sizeof(fcPlcfendTxt)); - hr = STREAMS::CSWordWriter::Instance()->Write (534, &lcbPlcfendTxt, sizeof(lcbPlcfendTxt)); - hr = STREAMS::CSWordWriter::Instance()->Write (522, &fcPlcfendRef, sizeof(fcPlcfendRef)); - hr = STREAMS::CSWordWriter::Instance()->Write (526, &lcbPlcfendRef, sizeof(lcbPlcfendRef)); - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), ( *_textPosition ), allEndnotesText.c_str(), ( allEndnotesText.size() * sizeof(wchar_t) ), &writtenSize ); - - *_textPosition += writtenSize; - } - } - - return hr; - } - - std::wstring CDocFile::GetHeadersOrFootersProperties (const ITextItem* pHeaderOrFooter, unsigned int& _headersOrFootersOffset, unsigned int* _headerOrFooterOffset, map* cpFldMap ) - { - if ( ( pHeaderOrFooter != NULL ) && ( _headerOrFooterOffset != NULL ) && ( cpFldMap != NULL ) ) - { - vector allParagraphsOffsets; - vector allParagraphsProperties; - - vector allRunsOffsets; - vector allChpxs; - - allParagraphsProperties = pHeaderOrFooter->GetAllParagraphsProperties(&allParagraphsOffsets); - - for (size_t i = 0; i < allParagraphsProperties.size(); ++i) - { - m_arPapxInFkp.push_back( allParagraphsProperties[i] ); - m_arParagraphsOffSets.push_back( _headersOrFootersOffset + allParagraphsOffsets[i] ); - } - - allChpxs = pHeaderOrFooter->GetAllRunProperties( &allRunsOffsets ); - - for (size_t i = 0; i < allChpxs.size(); ++i) - { - m_arChpx.push_back (allChpxs[i]); - m_arRunsOffsets.push_back (_headersOrFootersOffset + allRunsOffsets[i]); - } - - AddFldCharsData((TEXT_OFFSET_POSITION + (*_headerOrFooterOffset * sizeof(wchar_t))), TextItem (*pHeaderOrFooter), // TextItem( *pHeaderOrFooter ).GetAllRunItemsByType(), - cpFldMap); - - AddHyperlinksData((TEXT_OFFSET_POSITION + (*_headerOrFooterOffset * sizeof(wchar_t))), TextItem(*pHeaderOrFooter), // TextItem( *pHeaderOrFooter ).GetAllParagraphItemsByType(), - cpFldMap); - - AddInlineShapesData((TEXT_OFFSET_POSITION + (*_headerOrFooterOffset * sizeof(wchar_t))), TextItem(*pHeaderOrFooter), - cpFldMap); - - std::wstring content = pHeaderOrFooter->GetAllText(); - - *_headerOrFooterOffset += content.size(); - _headersOrFootersOffset += content.size() * sizeof(wchar_t); - - return content; - } - - return std::wstring(); - } - - long CDocFile::WriteHeadersAndFootersDocument (unsigned int* _textPosition) - { - long hr = S_FALSE; - - if ( ( NULL != _textPosition )) - { - ULONG writtenSize = 0; - unsigned int headerOrFooterOffset = 0;//m_pTableStream->size();???? - unsigned int headersOrFootersOffset = ( *_textPosition + ( headerOrFooterOffset * sizeof(wchar_t) ) ); - vector _aCP; - map cpFldMap; - wstring allHeadersAndFootersDocumentText; - - _aCP.push_back( CP( headerOrFooterOffset ) ); - _aCP.push_back( CP( headerOrFooterOffset ) ); - _aCP.push_back( CP( headerOrFooterOffset ) ); - _aCP.push_back( CP( headerOrFooterOffset ) ); - _aCP.push_back( CP( headerOrFooterOffset ) ); - _aCP.push_back( CP( headerOrFooterOffset ) ); - - for (list::const_iterator sectionIter = sectionProperties.begin(); sectionIter != sectionProperties.end(); ++sectionIter) - { - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetEvenPageHeader(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetOddPageHeader(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetEvenPageFooter(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetOddPageFooter(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetFirstPageHeader(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - - _aCP.push_back( CP( headerOrFooterOffset ) ); - - allHeadersAndFootersDocumentText += GetHeadersOrFootersProperties(sectionIter->GetFirstPageFooter(), headersOrFootersOffset, &headerOrFooterOffset, &cpFldMap ); - } - - ccpHdd = allHeadersAndFootersDocumentText.size(); - - WriteHeadersAndFootersDocumentFields( cpFldMap ); - - _aCP.push_back( CP(ccpHdd - 1 ) ); - _aCP.push_back( CP(ccpHdd + 1 ) ); - - if (ccpHdd > 0) - { - Plcfhdd plcfhdd (_aCP); - - //m_pTableStream->Stat( &stg, STATFLAG_NONAME ); - - unsigned int fcPlcfHdd = 0;//stg.cbSize.LowPart; - unsigned int lcbPlcfHdd = plcfhdd.Size(); - - hr = Write (m_pTableStream, fcPlcfHdd, plcfhdd, lcbPlcfHdd, &writtenSize ); - hr = STREAMS::CSWordWriter::Instance()->Write (242, &fcPlcfHdd, sizeof(fcPlcfHdd)); - hr = STREAMS::CSWordWriter::Instance()->Write (246, &lcbPlcfHdd, sizeof(lcbPlcfHdd)); - WRITE_STREAM_WORD(ccpHdd); // hr = STREAMS::CSWordWriter::Instance()->Write (FIB_OFFSET::ccpHdd, &ccpHdd, sizeof(ccpHdd) ); - hr = Write (STREAMS::CSWordWriter::Instance()->Get(), ( *_textPosition ), allHeadersAndFootersDocumentText.c_str(), ( allHeadersAndFootersDocumentText.size() * sizeof(wchar_t) ), &writtenSize ); - *_textPosition += writtenSize; - } - } - - return hr; - } - - void CDocFile::WriteSectionProperties() - { - long hr = S_FALSE; - - int fcSepx = STREAMS::CSWordWriter::Instance()->Get()->size(); - - vector aCP; - unsigned int cp = 0; - - aCP.push_back( CP( cp ) ); - - for (list::const_iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - if ( iter->is() ) - { - aCP.push_back( CP( cp + 1 ) ); - } - - cp += (*iter)->GetAllText().size(); - } - - aCP.push_back(CP(ccpText - 1)); - - if ( aCP.size() == sectionProperties.size() ) - { - aCP.push_back(CP(ccpText + ccpFtn + ccpHdd + ccpAtn + ccpEdn)); - } - else - { - aCP.back() = CP(ccpText); - } - - vector aSed; - - for (list::const_iterator iter = sectionProperties.begin(); iter != sectionProperties.end(); ++iter) - { - aSed.push_back(Sed(fcSepx)); - fcSepx += iter->GetSepx().Size(); - } - - PlcfSed plcfSed( aCP, aSed ); - - unsigned int fcPlcfSed = STREAMS::CSWordWriter::Instance()->Get()->size(); - unsigned int lcbPlcfSed = plcfSed.Size(); - - WRITE_STREAM_WORD(fcPlcfSed); // 202 - WRITE_STREAM_WORD(lcbPlcfSed); // 206 - - ULONG writtenSize = 0; - hr = Write (m_pTableStream, fcPlcfSed, (unsigned char*)plcfSed, lcbPlcfSed, &writtenSize); - - unsigned int i = 0; - - for (list::const_iterator iter = sectionProperties.begin(); iter != sectionProperties.end(); ++iter) - { - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), aSed[i++].GetFcSepx(), (unsigned char*)(iter->GetSepx()), iter->GetSepx().Size(), &writtenSize); - } - } - - // - long CDocFile::WriteFontTable () - { - long hr = S_OK; - - { - unsigned int fcSttbfFfn = m_pTableStream->size(); - unsigned int lcbSttbfFfn = m_oFontTable.Size(); - - if (lcbSttbfFfn > 0) - { - WRITE_STREAM_WORD(fcSttbfFfn); // 274 - WRITE_STREAM_WORD(lcbSttbfFfn); // 278 - - hr = Write (m_pTableStream, fcSttbfFfn, (unsigned char*)(m_oFontTable), lcbSttbfFfn); - } - } - - return hr; - } - - long CDocFile::WriteStyleSheet () - { - long hr = S_OK; - - { - unsigned int fcStshf = m_pTableStream->size(); - unsigned int lcbStshf = m_oStyleSheet.Size(); - unsigned int fcStshfOrig = fcStshf; - unsigned int lcbStshfOrig = lcbStshf; - - if (lcbStshf > 0) - { - WRITE_STREAM_WORD(fcStshfOrig); // 154 - WRITE_STREAM_WORD(lcbStshfOrig); // 158 - - WRITE_STREAM_WORD(fcStshf); // 162 - WRITE_STREAM_WORD(lcbStshf); // 166 - - hr = Write (m_pTableStream, fcStshf, (unsigned char*)(m_oStyleSheet), lcbStshf); - } - } - - return hr; - } - - long CDocFile::WriteNumbering() - { - long hr = S_FALSE; - - ULONG writtenSize = 0; - - const unsigned int fcPlfLst = m_pTableStream->size(); - const unsigned int lcbPlfLst = listFormatInfo.ListFormattingInformationSize(); - - if (lcbPlfLst > 0) - { - hr = STREAMS::CSWordWriter::Instance()->Write (738, &fcPlfLst, sizeof(fcPlfLst) ); - hr = STREAMS::CSWordWriter::Instance()->Write (742, &lcbPlfLst, sizeof(lcbPlfLst) ); - hr = Write (m_pTableStream, fcPlfLst, (unsigned char*)(listFormatInfo), listFormatInfo.Size(), &writtenSize ); - - const unsigned int fcPlfLfo = m_pTableStream->size(); - const unsigned int lcbPlfLfo = listFormatOverrideInfo.Size(); - - if ( lcbPlfLfo > 0 ) - { - hr = STREAMS::CSWordWriter::Instance()->Write (746, &fcPlfLfo, sizeof(fcPlfLfo) ); - hr = STREAMS::CSWordWriter::Instance()->Write (750, &lcbPlfLfo, sizeof(lcbPlfLfo) ); - hr = Write (m_pTableStream, fcPlfLfo, (unsigned char*)(listFormatOverrideInfo), listFormatOverrideInfo.Size(), &writtenSize ); - } - } - - return hr; - } - - // - std::wstring CDocFile::GetMainDocumentText() const - { - std::wstring mainDocumentText; - - for (list::const_iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - mainDocumentText += (*iter)->GetAllText(); - } - - return mainDocumentText; - } - - unsigned long CDocFile::GetMainDocumentTextItemsCount() const - { - return (unsigned long)(textItems.size()); - } - - unsigned long CDocFile::GetAllTextSize() const - { - unsigned long documentTextSize = 0; - - for (list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); ++iter) - { - documentTextSize += (*iter)->GetAllText().size(); - } - - for (list::const_iterator iter = m_Footnotes.begin(); iter != m_Footnotes.end(); ++iter) - { - documentTextSize += (*iter)->GetAllText().size(); - } - - for (list::const_iterator iter = this->endnotes.begin(); iter != this->endnotes.end(); ++iter) - { - documentTextSize += (*iter)->GetAllText().size(); - } - - return documentTextSize; - } - - unsigned long CDocFile::GetAllTextItemsCount() const - { - return (unsigned long)( textItems.size() + m_Footnotes.size() + endnotes.size() ); - } - - std::wstring CDocFile::GetAllText() const - { - std::wstring allText; - - for (list::const_iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - allText += (*iter)->GetAllText(); - - for (list::const_iterator iter = m_Footnotes.begin(); iter != m_Footnotes.end(); ++iter) - allText += (*iter)->GetAllText(); - - for (list::const_iterator iter = endnotes.begin(); iter != endnotes.end(); ++iter) - allText += (*iter)->GetAllText(); - - return allText; - } -} - -namespace ASCDocFileFormat -{ - int CDocFile::WriteFibRgLw97() - { - long hr = S_OK; - - //ccpText = GetFibRgLw97_ccpText(); // - ccpTxbx = GetFibRgLw97_ccpTxbx(); // A signed integer that specifies the count of CPs in the textbox subdocument of the main document. This value MUST be zero, 1, or greater. - ccpHdrTxbx = GetFibRgLw97_ccpHdrTxbx(); // A signed integer that specifies the count of CPs in the textbox subdocument of the header. This value MUST be zero, 1, or greater - - WRITE_STREAM_WORD(ccpText); - WRITE_STREAM_WORD(ccpTxbx); - WRITE_STREAM_WORD(ccpHdrTxbx); - - return TRUE; - } - - int CDocFile::GetFibRgLw97_ccpText() - { - int documentTextSize = 0; - - for (list::const_iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - documentTextSize += (*iter)->GetAllText().size(); - - return documentTextSize; - } - - int CDocFile::GetFibRgLw97_ccpTxbx() - { - unsigned long tbMRefSize = 0; - - if (m_oartStorage) - { - const std::vector& arMTbRefs = m_oartStorage->GetTbRefs(MAIN_DOCUMENT); - for (size_t i = 0; i < arMTbRefs.size(); ++i) - { - const std::vector& arText = arMTbRefs[i]->GetText (); - for (size_t j = 0; j < arText.size(); ++j) - tbMRefSize += arText[j]->GetAllText().size(); - } - } - - return tbMRefSize; - } - - int CDocFile::GetFibRgLw97_ccpHdrTxbx() - { - unsigned long tbHRefSize = 0; - - if (m_oartStorage) - { - const std::vector& arHTbRefs = m_oartStorage->GetTbRefs(HEADER_DOCUMENT); - for (size_t i = 0; i < arHTbRefs.size(); ++i) - { - const std::vector& arText = arHTbRefs[i]->GetText (); - for (size_t j = 0; j < arText.size(); ++j) - tbHRefSize += arText[j]->GetAllText().size(); - } - } - - return tbHRefSize; - } - - int CDocFile::WriteFibMainTBRefs() - { - long hr = S_OK; - - m_arTxbxCP.clear(); - m_arTxbxBkdCP.clear(); - - if (m_oartStorage) - { - const std::vector& arTbRefs = m_oartStorage->GetTbRefs(MAIN_DOCUMENT); - if (0==arTbRefs.size()) - return FALSE; - - unsigned int cp = 0; - if (arTbRefs.size()) - { - m_arTxbxCP.push_back (CP(cp)); - m_arTxbxBkdCP.push_back (CP(cp)); - } - - std::vector aFTXBXS; - std::vector aTbkd; - - for (size_t i = 0; i < arTbRefs.size(); ++i) - { - int nLID = arTbRefs[i]->GetID(); - - const std::vector& arText = arTbRefs[i]->GetText (); // один элемент - один текcт бокс - for (size_t j = 0; j < arText.size(); ++j) - cp += arText[j]->GetAllText().size(); - - m_arTxbxCP.push_back (CP(cp)); - aFTXBXS.push_back (FTXBXS(nLID)); // Привязка OArtShapeID к текстовому полю - - m_arTxbxBkdCP.push_back (CP(cp)); - aTbkd.push_back (Tbkd(i,0)); // Индекс FTXBSX - } - - int ccpFull = ccpText + ccpFtn + ccpHdd + ccpAtn + ccpEdn + ccpTxbx;// - 1; - - m_arTxbxCP.push_back (CP(ccpFull)); - aFTXBXS.push_back (FTXBXS()); - - m_arTxbxBkdCP.push_back (CP(ccpTxbx + 1)); - aTbkd.push_back (Tbkd()); - - if (m_arTxbxCP.size()) - { - { - PlcftxbxTxt oPlcftxbxTxt (m_arTxbxCP, aFTXBXS); // PlcftxbxTxt - - unsigned int fcPlcftxbxTxt = m_pTableStream->size(); - unsigned int lcbPlcftxbxTxt = oPlcftxbxTxt.Size(); - - WRITE_STREAM_WORD(fcPlcftxbxTxt); // 602 - WRITE_STREAM_WORD(lcbPlcftxbxTxt); // 606 - - WRITE_STREAM_TABLE(PlcftxbxTxt, oPlcftxbxTxt); - } - - { - PlcfTxbxBkd oPlcfTxbxBkd (m_arTxbxBkdCP, aTbkd); // PlcfTxbxBkd - - unsigned int fcPlcfTxbxBkd = m_pTableStream->size(); - unsigned int lcbPlcfTxbxBkd = oPlcfTxbxBkd.Size(); - - WRITE_STREAM_WORD(fcPlcfTxbxBkd); // 754 - WRITE_STREAM_WORD(lcbPlcfTxbxBkd); // 758 - - WRITE_STREAM_TABLE(PlcfTxbxBkd, oPlcfTxbxBkd); - } - - return TRUE; - } - } - - return FALSE; - } - - int CDocFile::WriteFibHeadTBRefs() - { - long hr = S_OK; - - m_arTxbxHdrCP.clear(); - m_arTxbxHdrBkdCP.clear(); - - if (m_oartStorage) - { - const std::vector& arTbRefs = m_oartStorage->GetTbRefs(HEADER_DOCUMENT); - if (0==arTbRefs.size()) - return FALSE; - - unsigned int cp = 0; - if (arTbRefs.size()) - { - m_arTxbxHdrCP.push_back (CP(cp)); - m_arTxbxHdrBkdCP.push_back (CP(cp)); - } - - std::vector aFTXBXS; - std::vector aTbkd; - - for (size_t i = 0; i < arTbRefs.size(); ++i) - { - int nLID = arTbRefs[i]->GetID(); - - const std::vector& arText = arTbRefs[i]->GetText (); // один элемент - один текcт бокс - for (size_t j = 0; j < arText.size(); ++j) - cp += arText[j]->GetAllText().size(); - - m_arTxbxHdrCP.push_back (CP(cp)); - aFTXBXS.push_back (FTXBXS(nLID)); // Привязка OArtShapeID к текстовому полю - - m_arTxbxHdrBkdCP.push_back (CP(cp)); - aTbkd.push_back (Tbkd(i,0)); // Индекс FTXBSX - } - - int ccpFull = ccpText + ccpFtn + ccpHdd + ccpAtn + ccpEdn + ccpTxbx + ccpHdrTxbx - 1; - - m_arTxbxHdrCP.push_back (CP(ccpFull)); - aFTXBXS.push_back (FTXBXS()); - - m_arTxbxHdrBkdCP.push_back (CP(ccpHdrTxbx + 1)); - aTbkd.push_back (Tbkd()); - - if (m_arTxbxHdrCP.size()) - { - { - PlcfHdrtxbxTxt oPlcfHdrtxbxTxt (m_arTxbxHdrCP, aFTXBXS); // PlcfHdrtxbxTxt - - unsigned int fcPlcfHdrtxbxTxt = m_pTableStream->size(); - unsigned int lcbPlcfHdrtxbxTxt = oPlcfHdrtxbxTxt.Size(); - - WRITE_STREAM_WORD(fcPlcfHdrtxbxTxt); // 602 - WRITE_STREAM_WORD(lcbPlcfHdrtxbxTxt); // 606 - - WRITE_STREAM_TABLE(PlcfHdrtxbxTxt, oPlcfHdrtxbxTxt); - } - - { - PlcfTxbxHdrBkd oPlcfTxbxHdrBkd (m_arTxbxHdrBkdCP, aTbkd); // PlcfTxbxHdrBkd - - unsigned int fcPlcfTxbxHdrBkd = m_pTableStream->size(); - unsigned int lcbPlcfTxbxHdrBkd = oPlcfTxbxHdrBkd.Size(); - - WRITE_STREAM_WORD(fcPlcfTxbxHdrBkd); // 762 - WRITE_STREAM_WORD(lcbPlcfTxbxHdrBkd); // 766 - - WRITE_STREAM_TABLE(PlcfTxbxHdrBkd, oPlcfTxbxHdrBkd); - } - - return TRUE; - } - } - - return FALSE; - } - - int CDocFile::CalculateOffTbRefs (long nBuffPos) - { - // индексируем текст из "текстовых надписях" - - if (m_oartStorage) - { - // MAIN_DOCUMENT - - const std::vector& arMTbRefs = m_oartStorage->GetTbRefs(MAIN_DOCUMENT); - for (size_t i = 0; i < arMTbRefs.size(); ++i) - { - const std::vector& arText = arMTbRefs[i]->GetText (); - - for (size_t ind = 0; ind < arText.size(); ++ind) - { - vector allTextItemOffsets; - vector allTextItemProperties = arText[ind]->GetAllParagraphsProperties(&allTextItemOffsets); - - for (unsigned int j = 0; j < allTextItemProperties.size(); ++j) - { - m_arPapxInFkp.push_back(allTextItemProperties[j]); - m_arParagraphsOffSets.push_back(nBuffPos + allTextItemOffsets[j]); - } - - vector allTextItemRunsOffsets; - vector allTextItemChpxs = arText[ind]->GetAllRunProperties(&allTextItemRunsOffsets); - - for (unsigned int j = 0; j < allTextItemChpxs.size(); ++j) - { - m_arChpx.push_back(allTextItemChpxs[j]); - m_arRunsOffsets.push_back(nBuffPos + allTextItemRunsOffsets[j]); - } - - nBuffPos += sizeof(wchar_t) * arText[ind]->GetAllText().size(); - } - } - - // HEADER_DOCUMENT - - const std::vector& arHTbRefs = m_oartStorage->GetTbRefs(HEADER_DOCUMENT); - for (size_t i = 0; i < arHTbRefs.size(); ++i) - { - const std::vector& arText = arHTbRefs[i]->GetText (); - for (size_t ind = 0; ind < arText.size(); ++ind) - { - vector allTextItemOffsets; - vector allTextItemProperties = arText[ind]->GetAllParagraphsProperties(&allTextItemOffsets); - - for (unsigned int j = 0; j < allTextItemProperties.size(); ++j) - { - m_arPapxInFkp.push_back(allTextItemProperties[j]); - m_arParagraphsOffSets.push_back(nBuffPos + allTextItemOffsets[j]); - } - - vector allTextItemRunsOffsets; - vector allTextItemChpxs = arText[ind]->GetAllRunProperties(&allTextItemRunsOffsets); - - for (unsigned int j = 0; j < allTextItemChpxs.size(); ++j) - { - m_arChpx.push_back(allTextItemChpxs[j]); - m_arRunsOffsets.push_back(nBuffPos + allTextItemRunsOffsets[j]); - } - - nBuffPos += sizeof(wchar_t) * arText[ind]->GetAllText().size(); - } - } - } - - return TRUE; - } - - int CDocFile::WriteStrTbRefs (long nBuffPos) - { - // Запись символов текста в основной поток (пишем после записи текста документа, футеров и прочего) - - if (m_oartStorage) - { - unsigned long hr = 0; - unsigned long bufferTbSize = 0; - - unsigned long mainTbSize = 0; - unsigned long headTbSize = 0; - unsigned long endPrTbSize = 0; - - // MAIN_DOCUMENT - - const std::vector& arMTbRefs = m_oartStorage->GetTbRefs(MAIN_DOCUMENT); - for (size_t i = 0; i < arMTbRefs.size(); ++i) - { - const std::vector& arText = arMTbRefs[i]->GetText (); - for (size_t ind = 0; ind < arText.size(); ++ind) - { - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), nBuffPos, arText[ind]->GetAllText().c_str(), (sizeof(wchar_t) * arText[ind]->GetAllText().size()), &bufferTbSize); - nBuffPos += bufferTbSize; - mainTbSize += bufferTbSize; - } - } - - // HEADER_DOCUMENT - - const std::vector& arHTbRefs = m_oartStorage->GetTbRefs(HEADER_DOCUMENT); - for (size_t i = 0; i < arHTbRefs.size(); ++i) - { - const std::vector& arText = arHTbRefs[i]->GetText (); - for (size_t ind = 0; ind < arText.size(); ++ind) - { - hr = Write(STREAMS::CSWordWriter::Instance()->Get(), nBuffPos, arText[ind]->GetAllText().c_str(), (sizeof(wchar_t) * arText[ind]->GetAllText().size()), &bufferTbSize); - nBuffPos += bufferTbSize; - headTbSize += bufferTbSize; - } - } - - return (mainTbSize + headTbSize); - } - - return 0; - } -} - -namespace ASCDocFileFormat -{ - void CDocFile::CalculateMainSpa () - { - m_aSpaCP.clear(); - - unsigned int cp = 0; - - for (list::const_iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - vector paragraphsItemsOffsets; - vector paragraphsItems = (*iter)->GetAllRunsCopy (¶graphsItemsOffsets); - - if (paragraphsItems.size()) - { - unsigned int rCP = 0; - - for (size_t i = 0; i < paragraphsItems.size(); ++i) - { - Run* run = dynamic_cast(paragraphsItems[i].operator->()); - if (run) - { - for (list::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter) - { - if (runiter->is()) - m_aSpaCP.push_back (CP(rCP + cp)); - - rCP += (*runiter)->GetAllText().size(); - } - } - } - } - - cp += (*iter)->GetAllText().size(); - } - - if (0 == m_aSpaCP.size()) - return; - - m_aSpaCP.push_back (CP(ccpText - 1)); - } - - void CDocFile::CalculateHeaderSpa () - { - m_aHeadSpaCP.clear(); - - unsigned int cp = 0; - - // TODO : требуется небольшой рефакторинг ( в хедере может быть много разной инфы и каждый раз пересчитывать каретку не правильно ) - - for (list::const_iterator sectionIter = sectionProperties.begin(); sectionIter != sectionProperties.end(); ++sectionIter) - { - list headerItems; - - headerItems.push_back (TextItem(*sectionIter->GetEvenPageHeader())); - headerItems.push_back (TextItem(*sectionIter->GetOddPageHeader())); - headerItems.push_back (TextItem(*sectionIter->GetEvenPageFooter())); - headerItems.push_back (TextItem(*sectionIter->GetOddPageFooter())); - headerItems.push_back (TextItem(*sectionIter->GetFirstPageHeader())); - headerItems.push_back (TextItem(*sectionIter->GetFirstPageFooter())); - - for (list::const_iterator iter = headerItems.begin(); iter != headerItems.end(); ++iter) - { - vector paragraphsItemsOffsets; - vector paragraphsItems = (*iter)->GetAllRunsCopy (¶graphsItemsOffsets); - - if (paragraphsItems.size()) - { - unsigned int rCP = 0; - - for (size_t i = 0; i < paragraphsItems.size(); ++i) - { - Run* run = dynamic_cast(paragraphsItems[i].operator->()); - if (run) - { - for (list::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter) - { - if (runiter->is()) - m_aHeadSpaCP.push_back (CP(rCP + cp)); - - rCP += (*runiter)->GetAllText().size(); - } - } - } - } - - cp += (*iter)->GetAllText().size(); - } - } - - if (0==m_aHeadSpaCP.size()) - return; - - m_aHeadSpaCP.push_back (CP(ccpText + ccpFtn + ccpHdd - 1)); - } - - long CDocFile::WriteOfficeDrawings () - { - long hr = S_OK; - - if (m_oartStorage) - { - if (m_oartStorage->GetSpa(MAIN_DOCUMENT).size() || m_oartStorage->GetSpa(HEADER_DOCUMENT).size()) - { - CalculateMainSpa (); - - if (m_aSpaCP.size()) - { - { - PlcfSpa oPlcfSpa (m_aSpaCP, m_oartStorage->GetSpa(MAIN_DOCUMENT)); - - unsigned int fcPlcSpaMom = m_pTableStream->size(); - unsigned int lcbPlcSpaMom = oPlcfSpa.Size(); - - WRITE_STREAM_WORD(fcPlcSpaMom); // 474 - WRITE_STREAM_WORD(lcbPlcSpaMom); // 478 - - WRITE_STREAM_TABLE(PlcSpaMom, oPlcfSpa); - } - } - - CalculateHeaderSpa (); - - if (m_aHeadSpaCP.size()) - { - std::string n = m_pTableStream->fullName(); - { - PlcfSpa oPlcfSpa (m_aHeadSpaCP, m_oartStorage->GetSpa(HEADER_DOCUMENT)); - - unsigned int fcPlcSpaHdr = m_pTableStream->size(); - unsigned int lcbPlcSpaHdr = oPlcfSpa.Size(); - - WRITE_STREAM_WORD(fcPlcSpaHdr); // 482 - WRITE_STREAM_WORD(lcbPlcSpaHdr); // 486 - - WRITE_STREAM_TABLE(PlcSpaHdr, oPlcfSpa); - } - } - } - - if (m_oartStorage->Compile()) - { - /////////////////////////////////////////////////////// - // ONLY FOR TEST SUB ELEMENTS - /////////////////////////////////////////////////////// - //CAtlFile oFile; - //if (SUCCEEDED(oFile.Create(L"d:\\office_art.dat", GENERIC_READ, FILE_SHARE_READ, OPEN_ALWAYS))) - //{ - // ULONGLONG size = 0; - // if (SUCCEEDED(oFile.GetSize(size))) - // { - // if (size) - // { - // unsigned char* pBuffer = new unsigned char [size]; - // if (pBuffer) - // { - // oFile.Read (pBuffer, size); - // oFile.Close (); - - // STATSTG oStatus; - // if (SUCCEEDED(m_pTableStream->Stat (&oStatus, STATFLAG_NONAME)) ) - // { - // unsigned int nStPos = oStatus.cbSize.LowPart; - // unsigned long nBufW = 0L; - // unsigned int nSize = size; - - // STREAMS::CSWordWriter::Instance()->Write (FIB_OFFSET::fcDggInfo, &nStPos, sizeof(unsigned int)); - // STREAMS::CSWordWriter::Instance()->Write (FIB_OFFSET::lcbDggInfo, &nSize, sizeof(unsigned int)); - // Write (m_pTableStream, nStPos, pBuffer, nSize, &nBufW); - // - // return hr; - // } - // } - // } - // } - //} - /////////////////////////////////////////////////////// - - unsigned int lcbDggInfo = m_oartStorage->Size(); - if (lcbDggInfo) - { - { - unsigned int fcDggInfo = m_pTableStream->size(); - - WRITE_STREAM_WORD(fcDggInfo); // 554 - WRITE_STREAM_WORD(lcbDggInfo); // 558 - - WRITE_STREAM_TABLE(DggInfo, m_oartStorage->Get()); - } - } - } - } - - return hr; - } -} - -namespace ASCDocFileFormat -{ - long CDocFile::SaveToFile (const CString& sFileName) - { - if (sFileName.GetLength() < 1) return S_FALSE; - - RELEASEOBJECT(m_pIStorage); - m_pIStorage = new POLE::Storage(sFileName); - - if (m_pIStorage == NULL) return S_FALSE; - - if (m_pIStorage->open(true,true) == false) return S_FALSE; - - long hr = S_OK; - - STREAMS::CSWordWriter* pBin = STREAMS::CSWordWriter::Instance(); - if (NULL == pBin) return S_FALSE; - - if (FAILED(pBin->Init (m_pIStorage, TEXT_OFFSET_POSITION))) return S_FALSE; - - InitStream(L"1Table", m_pTableStream, false); - - /* - - TODO : сделать нормально копирование параметров из исходника (пока будут пустые поля в настройках файла Property Summary) - - http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa380376(v=vs.85).aspx - http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa380376(v=vs.85).aspx - http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa379016(v=vs.85).aspx - http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa380387(v=vs.85).aspx - http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa380326(v=vs.85).aspx - - */ - - // InitStream(L"/\05SummaryInformation", m_pSummaryInformationStream, false); - InitStream(L"\05DocumentSummaryInformation", m_pDocumentSummaryInformationStream, false); - - WriteInformationBlock (); - WriteDocument (); - WriteSectionProperties(); // 202 - WriteFontTable (); // 274 - WriteStyleSheet(); // 162 - WriteNumbering (); // 746 - WriteOfficeDrawings (); // 474,482,554 - - // End - { - Bool32 cbMac = (pBin->Get())->size(); - WRITE_FIELD(FIB_OFFSET::cbMac, cbMac, sizeof(Bool32)); - } - - /* - - //// TODO : заполнить данные по умолчанию (обязательная структура по спецификации) - //ReloadFromFileBuffer (L"C:\\dop.dat", FIB_OFFSET::fcDop, FIB_OFFSET::lcbDop); - - //// TODO : заполнить стрим по спецификации - //POLE::Stream* pCompObj = NULL; - //if(InitStream(L"/1CompObj", pCompObj, false)) - //{ - // ReloadStreamFileBuffer (L"C:\\[1]CompObj", pCompObj); - // RELEASEINTERFACE(pCompObj); - //} - - */ - - BinaryStorageSingleton* binaryStorage = BinaryStorageSingleton::Instance(); - if (binaryStorage) - { - binaryStorage->BindToStorage(m_pIStorage, "Data"); - binaryStorage->WriteData(); - } - - // Custom Stream - - //POLE::Stream* pBinTeamLab = NULL; - //if(InitStream (L"/0DOCXINFO", pBinTeamLab, false)) - //{ - // CAtlFile oFile; - // if (SUCCEEDED(oFile.Create (L"E:\\Editor.jpg", GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING))) - // { - // ULONGLONG size = 0; - // if (SUCCEEDED(oFile.GetSize(size))) - // { - // if (size) - // { - // unsigned char* pBuffer = new unsigned char [size]; - // if (pBuffer) - // { - // oFile.Read (pBuffer, size); - // oFile.Close (); - // - // STATSTG oStatus; - // if (SUCCEEDED(pBinTeamLab->Stat (&oStatus, STATFLAG_NONAME))) - // { - // unsigned long nBufW = 0L; - // Write (pBinTeamLab, 0, pBuffer, size, &nBufW); - // } - // - // RELEASEARRAYOBJECTS(pBuffer); - // } - // } - // } - // } - //} - - m_pTableStream->flush(); - m_pDocumentSummaryInformationStream->flush(); - - pBin = STREAMS::CSWordWriter::Instance(); - if (pBin) - { - pBin->Get()->flush(); - pBin->FreeInstance(); - } - m_pIStorage->close(); - - return S_OK; - } - - - bool CDocFile::InitStream (const CStringA& stName, POLE::Stream*& pStream, bool bDefaultSizes) - { - RELEASEOBJECT(pStream); - - pStream = new POLE::Stream(m_pIStorage,string2std_string(stName),true); - //long hr = m_pIStorage->OpenStream (stName, NULL, STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE, NULL, &pStream); - if (pStream) - { - if (bDefaultSizes) - { - pStream->setSize(0); - } - } - if (pStream)return true; - - return false; - } - - long CDocFile::Write (POLE::Stream* stream, unsigned long position, const void* data, ULONG size, ULONG* writtenSize) - { - long hr = S_FALSE; - - if ( ( stream != NULL ) && ( data != NULL ) ) - { - stream->seek( position/*, STREAM_SEEK_SET, NULL*/ ); - *writtenSize = stream->write( (unsigned char*)data, size ); - } - - return hr; - } - - long CDocFile::Write (POLE::Stream* stream, unsigned long position, const void* data, ULONG size) - { - long hr = S_FALSE; - - if ( ( stream != NULL ) && ( data != NULL ) ) - { - ULONG writtenSize = 0; - - stream->seek( position/*, STREAM_SEEK_SET, NULL*/ ); - writtenSize = stream->write( (unsigned char*)data, size ); - } - - return hr; - } - - long CDocFile::ReloadFromFileBuffer (CString strFileData, DWORD dwOffTbID, DWORD dwSizefTbID) - { - long hr = S_FALSE; - - std::ifstream oFile; - oFile.open(strFileData.GetBuffer(), std::iostream::binary); - if (oFile.is_open()) - { - __int64 size = 0; - oFile.seekg (0, ios::end); - size = oFile.tellg(); - oFile.seekg (0, ios::beg); - if (size>0) - { - unsigned char* pBuffer = new unsigned char [(DWORD)size]; - if (pBuffer) - { - oFile.read((char*)pBuffer, (DWORD)size); - oFile.close (); - - { - unsigned int nStPos = m_pTableStream->size(); - unsigned long nBufW = 0L; - unsigned int nSize = (unsigned int)size; - - hr = STREAMS::CSWordWriter::Instance()->Write (dwOffTbID, &nStPos, sizeof(unsigned int)); - hr = STREAMS::CSWordWriter::Instance()->Write (dwSizefTbID, &nSize, sizeof(unsigned int)); - - ULONG writtenSize = 0; - - m_pTableStream->seek(nStPos/*, STREAM_SEEK_SET, NULL*/); - writtenSize = m_pTableStream->write(pBuffer, nSize); - } - - delete [] pBuffer; - } - } - } - - return hr; - } - - long CDocFile::ReloadStreamFileBuffer (CString strFileData, POLE::Stream* pStream) - { - long hr = S_FALSE; - - std::ifstream oFile; - oFile.open(strFileData.GetBuffer(), std::iostream::binary); - if (oFile.is_open()) - { - __int64 size = 0; - oFile.seekg (0, ios::end); - size = oFile.tellg(); - oFile.seekg (0, ios::beg); - if (size>0) - { - unsigned char* pBuffer = new unsigned char [(DWORD)size]; - if (pBuffer) - { - oFile.read ((char*)pBuffer, (DWORD)size); - oFile.close(); - - { - unsigned long nBufW = 0L; - unsigned long nSize = (unsigned long)size; - - ULONG writtenSize = 0; - pStream->seek(0); - writtenSize = pStream->write(pBuffer, nSize); - } - - delete [] pBuffer; - } - } - } - - return hr; - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DocFile.h b/ASCOfficeDocFile_old/DocxDocConverter/DocFile.h deleted file mode 100644 index 1a861573d9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DocFile.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Defines.h" - -#include "Paragraph.h" -#include "ChpxFkp.h" -#include "PapxFkp.h" -#include "PlcBteChpx.h" -#include "PlcBtePapx.h" -#include "Clx.h" - -#include "Table.h" -#include "DefTableShdOperand.h" -#include "DefTableShd80Operand.h" -#include "CellRangeVertAlign.h" -#include "Shd80.h" -#include "SttbfFfn.h" -#include "SttbfBkmk.h" -#include "LID.h" -#include "STSH.h" -#include "LSPD.h" -#include "ListFormattingInformation.h" -#include "PlfLfo.h" -#include "List.h" -#include "PlcfSed.h" -#include "Plcfbkf.h" -#include "SectionProperties.h" -#include "YAS.h" -#include "PositionCodeOperand.h" -#include "PChgTabs.h" - -#include "Run.h" -#include "Hyperlink.h" -#include "BookmarkStart.h" -#include "BookmarkEnd.h" -#include "InlineShape.h" - -#include "DopBase.h" -#include "PlcfSpa.h" - -#include "ShapeBuilder.h" -#include "WordStreamWriter.h" - -namespace ASCDocFileFormat -{ - typedef PLC Plcfhdd; - - class CDocFile - { - public: - CDocFile(); - ~CDocFile(); - - HRESULT SaveToFile (const CString& sFileName); - - void AddTextItem( const ITextItem& textItem ); - void AddFootnote( const Footnote& footnote ); - void AddEndnote( const Endnote& endnote ); - void AddSectionProperties( const SectionProperties& _sectionProperties ); - wstring GetMainDocumentText() const; - unsigned long GetMainDocumentTextItemsCount() const; - wstring GetAllText() const; - unsigned long GetAllTextSize() const; - unsigned long GetAllTextItemsCount() const; - - inline void SetFontTable(const SttbfFfn& oFontTable) - { - m_oFontTable = oFontTable; - } - - inline void SetListFormattingInformation (const ListFormattingInformation& oFormatInfo) - { - listFormatInfo = oFormatInfo; - } - - inline void SetListFormattingOverrideInformation (const PlfLfo& oInfo) - { - listFormatOverrideInfo = oInfo; - } - - inline void SetStyleSheet (const STSH& oStyleSheet) - { - m_oStyleSheet = oStyleSheet; - } - - inline const STSH& GetStyleSheet() const - { - return m_oStyleSheet; - } - - protected: - - CP OffsetToCP( unsigned int offset ) const; - - long WriteInformationBlock (); - long WriteDocument(); - long WriteFontTable(); - long WriteStyleSheet(); - long WriteNumbering(); - - void WriteSectionProperties(); - long WriteMainDocument(unsigned int* _textPosition, vector* _AllFootnotesReferences, vector* _AllEndnotesReferences); - void AddFldCharsData(unsigned int nTextPos, const TextItem& oItem, map* cpFldMap); - void AddHyperlinksData(unsigned int nTextPos, const TextItem& oItem, map* cpFldMap); - void AddInlineShapesData(unsigned int nTextPos, const TextItem& oItem, map* cpFldMap); - - long WriteMainDocumentFields(const map& _cpFldMap); - long WriteFootnoteDocumentFields(const map& _cpFldMap); - long WriteEndnoteDocumentFields(const map& _cpFldMap); - long WriteHeadersAndFootersDocumentFields(const map& _cpFldMap); - long WriteBookmarks(const vector>& _bookmarksStartsCPsWithIDs, const vector>& _bookmarksEndsCPsWithIDs, const vector& _bookmarksNames); - short GetBookmarkIndexByID(const wstring& _id, const vector>& _bookmarksCPsWithIDs); - long WriteFootnoteDocument(unsigned int* _textPosition, vector* _AllFootnotesReferences); - long WriteEndnoteDocument(unsigned int* _textPosition, vector* _AllEndnotesReferences); - wstring GetHeadersOrFootersProperties(const ITextItem* _headerOrFooter, unsigned int& _headersOrFootersOffset, unsigned int* _headerOrFooterOffset, map* cpFldMap); - long WriteHeadersAndFootersDocument(unsigned int* _textPosition); - - // - int WriteFibRgLw97(); - - int GetFibRgLw97_ccpText(); // колличество всех символов обычного текста - int GetFibRgLw97_ccpTxbx(); // колличество всех символов текстовых надписей в документе - int GetFibRgLw97_ccpHdrTxbx (); // колличество всех символов текстовых надписей в колонтитулах - - // OFFICE ART - - int WriteFibMainTBRefs(); - int WriteFibHeadTBRefs(); - - int CalculateOffTbRefs (long nBuffPos); // Индексация символов - int WriteStrTbRefs (long nBuffPos); // Запись символов текста в основной поток - - void CalculateMainSpa (); // настройка позиций в тексте для якорей автофигур или flow картинок (MAINDOC) - void CalculateHeaderSpa (); // настройка позиций в тексте для якорей автофигур или flow картинок (HEADER) - - long WriteOfficeDrawings (); // запись всей информации по автофигурам и flow картинкам - - // Helpers - - bool InitStream(const CStringA& stName, POLE::Stream*& pStream, bool bDefaultSizes); - long Write (POLE::Stream* stream, unsigned long position, const void* data, ULONG size, ULONG* writtenSize); - long Write (POLE::Stream* stream, unsigned long position, const void* data, ULONG size); - long ReloadFromFileBuffer (CString strFileData, DWORD dwOffTbID, DWORD dwSizefTbID); - long ReloadStreamFileBuffer (CString strFileData, POLE::Stream* pStream); - - private: - - POLE::Storage* m_pIStorage; - - POLE::Stream* m_pTableStream; - POLE::Stream* m_pSummaryInformationStream; - POLE::Stream* m_pDocumentSummaryInformationStream; - - unsigned long m_nBuffOk; - unsigned int m_nTextCurPos; - - STSH m_oStyleSheet; - - int ccpText; // FibRgLw97 - int ccpFtn; // FibRgLw97 - int ccpHdd; // FibRgLw97 - int ccpAtn; // FibRgLw97 - int ccpEdn; // FibRgLw97 - int ccpTxbx; // FibRgLw97 - int ccpHdrTxbx; // FibRgLw97 - - vector m_arChpx; - vector m_arRunsOffsets; - vector m_arPapxInFkp; - vector m_arParagraphsOffSets; - - COArtStorage* m_oartStorage; - - // позиции якорей в тексте документа (индексы символов) - vector m_aSpaCP; - vector m_aHeadSpaCP; - - vector m_arTxbxCP; - vector m_arTxbxHdrCP; - - vector m_arTxbxBkdCP; - vector m_arTxbxHdrBkdCP; - - // - - list textItems; - list m_Footnotes; - list endnotes; - SttbfFfn m_oFontTable; - ListFormattingInformation listFormatInfo; - PlfLfo listFormatOverrideInfo; - list sectionProperties; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/DopBase.h b/ASCOfficeDocFile_old/DocxDocConverter/DopBase.h deleted file mode 100644 index cf054ab648..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/DopBase.h +++ /dev/null @@ -1,459 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" -#include "Copts60.h" -#include "DTTM.h" - -namespace ASCDocFileFormat -{ - class DopBase: public IOperand - { - private: - bool fFacingPages; - bool fPMHMainDoc; - Constants::fpc fpc; - Constants::rncFtn rncFtn; - short nFtn; - bool fSplAllDone; - bool fSplAllClean; - bool fSplHideErrors; - bool fGramHideErrors; - bool fLabelDoc; - bool fHyphCapitals; - bool fAutoHyphen; - bool fFormNoFields; - bool fLinkStyles; - bool fRevMarking; - bool fExactCWords; - bool fPagHidden; - bool fPagResults; - bool fLockAtn; - bool fMirrorMargins; - bool fWord97Compat; - bool fProtEnabled; - bool fDispFormFldSel; - bool fRMView; - bool fRMPrint; - bool fLockVbaProj; - bool fLockRev; - bool fEmbedFonts; - Copts60 copts60; - short dxaTab; - short cpgWebOpt; - short dxaHotZ; - short cConsecHypLim; - DTTM dttmCreated; - DTTM dttmRevised; - DTTM dttmLastPrint; - short nRevision; - int tmEdited; - int cWords; - int cCh; - short cPg; - int cParas; - Constants::rncEdn rncEdn; - short nEdn; - Constants::epc epc; - bool fPrintFormData; - bool fSaveFormData; - bool fShadeFormData; - bool fShadeMergeFields; - bool fIncludeSubdocsInStats; - int cLines; - int cWordsWithSubdocs; - int cChWithSubdocs; - short cPgWithSubdocs; - int cParasWithSubdocs; - int cLinesWithSubdocs; - int lKeyProtDoc; - Constants::ViewingMode wvkoSaved; - unsigned short pctWwdSaved; - Constants::ZoomType zkSaved; - bool iGutterPos; - - static const unsigned char SIZE_IN_BYTES = 84; - mutable unsigned char bytes[SIZE_IN_BYTES]; - - void SetBytes() const - { - BitSet bitSet( SIZE_IN_BYTES ); - unsigned int bitOffset = 0; - - bitSet.SetBit( this->fFacingPages, 0 ); - bitSet.SetBit( this->fPMHMainDoc, 2 ); - bitSet.SetBits( this->fpc, 5, 2 ); - - memset( this->bytes, 0, SIZE_IN_BYTES ); - memcpy( this->bytes, bitSet.GetBytes(), bitSet.GetSize() ); - } - - public: - DopBase() - { - this->SetDefaults(); - } - - void SetDefaults() - { - } - - virtual ~DopBase() - { - } - - void SetFacingPages( bool _fFacingPages ) - { - this->fFacingPages = _fFacingPages; - } - - void SetMailMergeMainDocument( bool _fPMHMainDoc ) - { - this->fPMHMainDoc = _fPMHMainDoc; - } - - void SetFootnotesPlace( Constants::fpc _fpc ) - { - this->fpc = _fpc; - } - - void SetFootnotesNumbering( Constants::rncFtn _rncFtn ) - { - this->rncFtn = _rncFtn; - } - - void SetFootnotesStartingNumber( short _nFtn ) - { - this->nFtn = _nFtn; - } - - void SetSpellCheckingDone( bool _fSplAllDone ) - { - this->fSplAllDone = _fSplAllDone; - } - - void SetSpellingCorrectly( bool _fSplAllClean ) - { - this->fSplAllClean = _fSplAllClean; - } - - void SetSpellingHideError( bool _fSplHideErrors ) - { - this->fSplHideErrors = _fSplHideErrors; - } - - void SetGrammarHideError( bool _fGramHideErrors ) - { - this->fGramHideErrors = _fGramHideErrors; - } - - void SetMailMergeLabelsDocument( bool _fLabelDoc ) - { - this->fLabelDoc = _fLabelDoc; - } - - void SetCapitalLettersHyphenated( bool _fHyphCapitals ) - { - this->fHyphCapitals = _fHyphCapitals; - } - - void SetAutoHyphen( bool _fAutoHyphen ) - { - this->fAutoHyphen = _fAutoHyphen; - } - - void SetNoEditableRegions( bool _fFormNoFields ) - { - this->fFormNoFields = _fFormNoFields; - } - - void SetLinkStyles( bool _fLinkStyles ) - { - this->fLinkStyles = _fLinkStyles; - } - - void SetRevisionMarking( bool _fRevMarking ) - { - this->fRevMarking = _fRevMarking; - } - - void SetExactCWords( bool _fExactCWords ) - { - this->fExactCWords = _fExactCWords; - } - - void SetPagHidden( bool _fPagHidden ) - { - this->fPagHidden = _fPagHidden; - } - - void SetPagResults( bool _fPagResults ) - { - this->fPagResults = _fPagResults; - } - - void SetLockComments( bool _fLockAtn ) - { - this->fLockAtn = _fLockAtn; - } - - void SetMirrorMargins( bool _fMirrorMargins ) - { - this->fMirrorMargins = _fMirrorMargins; - } - - void SetWord97CompatibilityMode( bool _fWord97Compat ) - { - this->fWord97Compat = _fWord97Compat; - } - - void SetProtectionEnabled( bool _fProtEnabled ) - { - this->fProtEnabled = _fProtEnabled; - } - - void SetDisplayFormFieldSelection( bool _fDispFormFldSel ) - { - this->fDispFormFldSel = _fDispFormFldSel; - } - - void SetShowAnyRevisionMarkup( bool _fRMView ) - { - this->fRMView = _fRMView; - } - - void SetPrintAnyRevisionMarkup( bool _fRMPrint ) - { - this->fRMPrint = _fRMPrint; - } - - void SetLockVBAProject( bool _fLockVbaProj ) - { - this->fLockVbaProj = _fLockVbaProj; - } - - void SetLockRevisions( bool _fLockRev ) - { - this->fLockRev = _fLockRev; - } - - void SetTrueTypeFontsEmbedded( bool _fEmbedFonts ) - { - this->fEmbedFonts = _fEmbedFonts; - } - - void SetCompatibilityOptions( Copts60 _copts60 ) - { - this->copts60 = _copts60; - } - - void SetTheDefaultTabStopIntervalInTwips( short _dxaTab ) - { - this->dxaTab = _dxaTab; - } - - void SetHTMLSavingCodePage( short _cpgWebOpt ) - { - this->cpgWebOpt = _cpgWebOpt; - } - - void SetMaximumAmountOfWhiteSpaceInTwips( short _dxaHotZ ) - { - this->dxaHotZ = _dxaHotZ; - } - - void SetConsecutiveHyphenationLimit( short _cConsecHypLim ) - { - this->cConsecHypLim = _cConsecHypLim; - } - - void SetDocumentCreationDateAndTime( DTTM _dttmCreated ) - { - this->dttmCreated = _dttmCreated; - } - - void SetDocumentLastSaveDateAndTime( DTTM _dttmRevised ) - { - this->dttmRevised = _dttmRevised; - } - - void SetDocumentLastPrintDateAndTime( DTTM _dttmLastPrint ) - { - this->dttmLastPrint = _dttmLastPrint; - } - - void SetRevisionNumber( short _nRevision ) - { - this->nRevision = _nRevision; - } - - void SetEditingNumber( int _tmEdited ) - { - this->tmEdited = _tmEdited; - } - - void SetCountOfWords( int _cWords ) - { - this->cWords = _cWords; - } - - void SetCountOfCharacters( int _cCh ) - { - this->cCh = _cCh; - } - - void SetCountOfPages( short _cPg ) - { - this->cPg = _cPg; - } - - void SetCountOfParagraphs( int _cParas ) - { - this->cParas = _cParas; - } - - void SetEndnoteNumbering( Constants::rncEdn _rncEdn ) - { - this->rncEdn = _rncEdn; - } - - void SetEndnotesStartingNumber( short _nEdn ) - { - this->nEdn = _nEdn; - } - - void SetEndnotesPlace( Constants::epc _epc ) - { - this->epc = _epc; - } - - void SetPrintFormData( bool _fPrintFormData ) - { - this->fPrintFormData = _fPrintFormData; - } - - void SetSaveFormData( bool _fSaveFormData ) - { - this->fSaveFormData = _fSaveFormData; - } - - void SetShadeFormData( bool _fShadeFormData ) - { - this->fShadeFormData = _fShadeFormData; - } - - void SetShadeMergeFields( bool _fShadeMergeFields ) - { - this->fShadeMergeFields = _fShadeMergeFields; - } - - void SetIncludeSubdocsInStats( bool _fIncludeSubdocsInStats ) - { - this->fIncludeSubdocsInStats = _fIncludeSubdocsInStats; - } - - void SetCountOfLines( int _cLines ) - { - this->cLines = _cLines; - } - - void SetWordsWithSubdocs( int _cWordsWithSubdocs ) - { - this->cWordsWithSubdocs = _cWordsWithSubdocs; - } - - void SetCharactersWithSubdocs( int _cChWithSubdocs ) - { - this->cChWithSubdocs = _cChWithSubdocs; - } - - void SetPagesWithSubdocs( short _cPgWithSubdocs ) - { - this->cPgWithSubdocs = _cPgWithSubdocs; - } - - void SetParagraphsWithSubdocs( int _cParasWithSubdocs ) - { - this->cParasWithSubdocs = _cParasWithSubdocs; - } - - void SetLinesWithSubdocs( int _cLinesWithSubdocs ) - { - this->cLinesWithSubdocs = _cLinesWithSubdocs; - } - - void SetKeyProtectionDocument( int _lKeyProtDoc ) - { - this->lKeyProtDoc = _lKeyProtDoc; - } - - void SetSavedDocumentViewingMode( Constants::ViewingMode _wvkoSaved ) - { - this->wvkoSaved = _wvkoSaved; - } - - void SetSavedDocumentZoom( unsigned short _pctWwdSaved ) - { - this->pctWwdSaved = _pctWwdSaved; - } - - void SetSavedDocumentZoomType( Constants::ZoomType _zkSaved ) - { - this->zkSaved = _zkSaved; - } - - void SetGutterTopPosition( bool _iGutterPos ) - { - this->iGutterPos = _iGutterPos; - } - - virtual operator unsigned char*() const - { - this->SetBytes(); - - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - this->SetBytes(); - - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Endnote.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Endnote.cpp deleted file mode 100644 index a1ed5d87be..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Endnote.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Endnote.h" - -namespace ASCDocFileFormat -{ - Endnote::Endnote( short _aFtnIdx ) : endnoteItemsOffset(0), aFtnIdx(_aFtnIdx) - { - } - - Endnote::Endnote( const Endnote& _endnote ) : endnoteItemsOffset(_endnote.endnoteItemsOffset), aFtnIdx(_endnote.aFtnIdx) - { - for ( list::const_iterator iter = _endnote.textItems.begin(); iter != _endnote.textItems.end(); iter++ ) - { - this->textItems.push_back( EndnoteItemWithOffset( TextItemPtr( static_cast( iter->endnoteItem->Clone() ) ), iter->endnoteItemOffset ) ); - } - } - - void Endnote::AddTextItem( const ITextItem& _textItem ) - { - ITextItem* textItem = static_cast( _textItem.Clone() ); - - if ( textItem != NULL ) - { - this->textItems.push_back( EndnoteItemWithOffset( TextItemPtr( textItem ), this->endnoteItemsOffset ) ); - this->endnoteItemsOffset += ( sizeof(wchar_t) * textItem->GetAllText().size() ); - } - } - - short Endnote::GetIndex() const - { - return this->aFtnIdx; - } - - Endnote::~Endnote() - { - } - - wstring Endnote::GetAllText() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += iter->endnoteItem->GetAllText(); - } - - return allText; - } - - Endnote::operator wstring() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += *(iter->endnoteItem); - } - - return allText; - } - - vector Endnote::GetAllParagraphsCopy() const - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector textItemParagraphs = iter->endnoteItem->GetAllParagraphsCopy(); - - for ( vector::const_iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*textItemParagraphsIter)->Clone() ) ) ); - } - } - - return allParagraphs; - } - - vector Endnote::GetAllParagraphs() - { - vector allParagraphs; - - for (std::list::iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - vector textItemParagraphs = iter->endnoteItem->GetAllParagraphs(); - - for ( vector::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( *textItemParagraphsIter ); - } - } - - return allParagraphs; - } - - vector Endnote::GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - unsigned int paragraphOffset = 0; - - if ( allParagraphsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector endnoteItemParagraphsOffsets; - vector endnoteItemParagraphsProperties = iter->endnoteItem->GetAllParagraphsProperties( &endnoteItemParagraphsOffsets ); - - for ( unsigned int i = 0; i < endnoteItemParagraphsProperties.size(); i++ ) - { - allParagraphsProperties.push_back( endnoteItemParagraphsProperties[i] ); - allParagraphsOffsets->push_back( paragraphOffset + endnoteItemParagraphsOffsets[i] ); - } - - paragraphOffset += ( sizeof(wchar_t) * iter->endnoteItem->GetAllText().size() ); - } - } - - return allParagraphsProperties; - } - - vector Endnote::GetAllRunProperties( vector* allRunsOffsets ) const - { - vector allRunsProperties; - unsigned int runOffset = 0; - - if ( allRunsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector endnoteItemRunsOffsets; - vector endnoteItemRunsProperties = iter->endnoteItem->GetAllRunProperties( &endnoteItemRunsOffsets ); - - for ( unsigned int i = 0; i < endnoteItemRunsProperties.size(); i++ ) - { - allRunsProperties.push_back( endnoteItemRunsProperties[i] ); - allRunsOffsets->push_back( runOffset + endnoteItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->endnoteItem->GetAllText().size() ); - } - } - - return allRunsProperties; - } - - vector Endnote::GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int runOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemRunsOffsets; - vector allTextItemRuns = iter->endnoteItem->GetAllRunsCopy( &allTextItemRunsOffsets ); - - for ( unsigned int i = 0; i < allTextItemRuns.size(); i++ ) - { - allRuns.push_back( IParagraphItemPtr( static_cast(allTextItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( runOffset + allTextItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->endnoteItem->GetAllText().size() ); - } - } - - return allRuns; - } - - vector Endnote::GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int textItemOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemParagraphItemsOffsets; - vector allTextItemParagraphItems = iter->endnoteItem->GetAllParagraphItemsCopy( &allTextItemParagraphItemsOffsets ); - - for ( unsigned int i = 0; i < allTextItemParagraphItems.size(); i++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast(allTextItemParagraphItems[i]->Clone()) ) ); - allParagraphItemsOffsets->push_back( textItemOffset + allTextItemParagraphItemsOffsets[i] ); - } - - textItemOffset += ( sizeof(wchar_t) * iter->endnoteItem->GetAllText().size() ); - } - } - - return allParagraphItems; - } - - IVirtualConstructor* Endnote::New() const - { - return new Endnote(); - } - - IVirtualConstructor* Endnote::Clone() const - { - return new Endnote(*this); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Endnote.h b/ASCOfficeDocFile_old/DocxDocConverter/Endnote.h deleted file mode 100644 index cc4ffe9bb5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Endnote.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ITextItem.h" -#include "EndnoteRef.h" -#include "EndnoteReference.h" -#include "PLC.h" - -namespace ASCDocFileFormat -{ - typedef PLC PlcfendTxt; - typedef PLC PlcfendRef; - - class Endnote: public ITextItem - { - struct EndnoteItemWithOffset - { - TextItemPtr endnoteItem; - unsigned int endnoteItemOffset; - - EndnoteItemWithOffset(): - endnoteItem(), endnoteItemOffset(0) - { - } - - EndnoteItemWithOffset( const TextItemPtr& _endnoteItem, unsigned int _endnoteItemOffset ): - endnoteItem(_endnoteItem), endnoteItemOffset(_endnoteItemOffset) - { - } - }; - - private: - list textItems; - unsigned int endnoteItemsOffset; - short aFtnIdx; - - public: - explicit Endnote( short _aFtnIdx = 0 ); - Endnote( const Endnote& _endnote ); - void AddTextItem( const ITextItem& _textItem ); - short GetIndex() const; - virtual ~Endnote(); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/EndnoteRef.h b/ASCOfficeDocFile_old/DocxDocConverter/EndnoteRef.h deleted file mode 100644 index dec6badb31..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/EndnoteRef.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "CSymbolOperand.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class EndnoteRef: public IRunItem - { - private: - static const unsigned char CFSpec = 1; - short aEndIdx; - - wstring text; - list properties; - - public: - explicit EndnoteRef (short _aEndIdx = 0, unsigned short _ftc = 0, wchar_t _xchar = 0x0000) : aEndIdx(_aEndIdx) - { - if ( this->aEndIdx == 0 ) - { - //!!!TODO!!! - this->properties.push_back( Prl( (short)DocFileFormat::sprmCSymbol, (unsigned char*)CSymbolOperand( _ftc, _xchar ) ) ); - } - else - { - this->text = wstring( &TextMark::AutoNumberedEndnoteReference ); - this->properties.push_back( Prl( (short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec) ) ); - } - } - - EndnoteRef (const EndnoteRef& _endnoteRef) : aEndIdx(_endnoteRef.aEndIdx), text(_endnoteRef.text), properties(_endnoteRef.properties) - { - - } - - short GetIndex() const - { - return this->aEndIdx; - } - - virtual ~EndnoteRef() - { - } - - virtual IVirtualConstructor* New() const - { - return new EndnoteRef(); - } - - virtual IVirtualConstructor* Clone() const - { - return new EndnoteRef(*this); - } - - virtual unsigned long GetTextSize() const - { - return text.size(); - } - - virtual wstring GetAllText() const - { - return text; - } - - virtual vector GetRunProperties() const - { - vector prls; - - for ( list::const_iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - prls.push_back( *iter ); - } - - return prls; - } - - virtual unsigned int PrlSize () const - { - return (unsigned int) properties.size(); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/EndnoteReference.h b/ASCOfficeDocFile_old/DocxDocConverter/EndnoteReference.h deleted file mode 100644 index c69421bc44..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/EndnoteReference.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "CSymbolOperand.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class EndnoteReference: public IRunItem - { - private: - static const unsigned char CFSpec = 1; - short aEndIdx; - - wstring text; - list properties; - - public: - explicit EndnoteReference( short _aEndIdx = 0, unsigned short _ftc = 0, wchar_t _xchar = 0x0000 ): - aEndIdx(_aEndIdx) - { - if ( this->aEndIdx == 0 ) - { - //!!!TODO!!! - this->properties.push_back( Prl( (short)DocFileFormat::sprmCSymbol, (unsigned char*)CSymbolOperand( _ftc, _xchar ) ) ); - } - else - { - this->text = wstring( &TextMark::AutoNumberedEndnoteReference ); - this->properties.push_back( Prl( (short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec) ) ); - } - } - - EndnoteReference( const EndnoteReference& _endnoteReference ): - aEndIdx(_endnoteReference.aEndIdx), text(_endnoteReference.text), properties(_endnoteReference.properties) - { - } - - short GetIndex() const - { - return this->aEndIdx; - } - - virtual ~EndnoteReference() - { - } - - virtual IVirtualConstructor* New() const - { - return new EndnoteReference(); - } - - virtual IVirtualConstructor* Clone() const - { - return new EndnoteReference(*this); - } - - virtual unsigned long GetTextSize() const - { - return this->text.size(); - } - - virtual wstring GetAllText() const - { - return this->text; - } - - virtual vector GetRunProperties() const - { - vector prls; - - for ( list::const_iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - prls.push_back( *iter ); - } - - return prls; - } - - virtual unsigned int PrlSize () const - { - return (unsigned int)properties.size(); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.cpp b/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.cpp deleted file mode 100644 index 3d365b4c83..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.cpp +++ /dev/null @@ -1,3906 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - - -#include "ParagraphItem.h" -#include "DocxToDocUtils.h" -#include "ShapeBuilder.h" -#include "PropertyReader.h" - -#include "FileConverter.h" - -using namespace ASCDocFileFormat; - -// NOTE: delete after remove bost -const std::wstring string2wstring__(const std::string& sline, const unsigned int codePage = CP_ACP) -{ - const int nSize = MultiByteToWideChar(codePage, 0, sline.c_str(), sline.size(), NULL, 0); - - wchar_t *sTemp = new wchar_t[nSize]; - if (!sTemp) - return std::wstring(); - - int size = MultiByteToWideChar(codePage, 0, sline.c_str(), sline.size(), sTemp, nSize); - - std::wstring sResult(sTemp, size); - delete []sTemp; - - return sResult; -} - -// NOTE: delete after remove bost -const std::string wstring2string__(const std::wstring& sLine, const unsigned int codePage = CP_ACP) -{ - const int nSize = WideCharToMultiByte(codePage, 0, sLine.c_str(), sLine.length(), NULL, 0, NULL, NULL); - char *sTemp = new char[nSize]; - if (!sTemp) - return std::string(); - - int size = WideCharToMultiByte(codePage, 0, sLine.c_str(), sLine.length(), sTemp, nSize, NULL, NULL); - - std::string sResult(sTemp, size); - delete []sTemp; - - return sResult; -} - -namespace DOCXTODOC -{ - CFileTransformer::CFileTransformer() - { - m_pDocFile = NULL; - - m_bHaveSeparateFldChar = false; - m_bIsInlineShape = FALSE; - - m_bIsHaveRunPr = FALSE; - - m_pDocFile = new ASCDocFileFormat::CDocFile(); - - lidMap.insert( pair( string( "af-ZA" ), ASCDocFileFormat::LID( DocFileFormat::Afrikaans ) ) ); - lidMap.insert( pair( string( "sq-AL" ), ASCDocFileFormat::LID( DocFileFormat::Albanian ) ) ); - lidMap.insert( pair( string( "am-ET" ), ASCDocFileFormat::LID( DocFileFormat::Amharic ) ) ); - lidMap.insert( pair( string( "ar-DZ" ), ASCDocFileFormat::LID( DocFileFormat::ArabicAlgeria ) ) ); - lidMap.insert( pair( string( "ar-BH" ), ASCDocFileFormat::LID( DocFileFormat::ArabicBahrain ) ) ); - lidMap.insert( pair( string( "ar-EG" ), ASCDocFileFormat::LID( DocFileFormat::ArabicEgypt ) ) ); - lidMap.insert( pair( string( "ar-IQ" ), ASCDocFileFormat::LID( DocFileFormat::ArabicIraq ) ) ); - lidMap.insert( pair( string( "ar-JO" ), ASCDocFileFormat::LID( DocFileFormat::ArabicJordan ) ) ); - lidMap.insert( pair( string( "ar-KW" ), ASCDocFileFormat::LID( DocFileFormat::ArabicKuwait ) ) ); - lidMap.insert( pair( string( "ar-LB" ), ASCDocFileFormat::LID( DocFileFormat::ArabicLebanon ) ) ); - lidMap.insert( pair( string( "ar-LY" ), ASCDocFileFormat::LID( DocFileFormat::ArabicLibya ) ) ); - lidMap.insert( pair( string( "ar-MA" ), ASCDocFileFormat::LID( DocFileFormat::ArabicMorocco ) ) ); - lidMap.insert( pair( string( "ar-OM" ), ASCDocFileFormat::LID( DocFileFormat::ArabicOman ) ) ); - lidMap.insert( pair( string( "ar-QA" ), ASCDocFileFormat::LID( DocFileFormat::ArabicQatar ) ) ); - lidMap.insert( pair( string( "ar-SA" ), ASCDocFileFormat::LID( DocFileFormat::ArabicSaudiArabia ) ) ); - lidMap.insert( pair( string( "ar-SY" ), ASCDocFileFormat::LID( DocFileFormat::ArabicSyria ) ) ); - lidMap.insert( pair( string( "ar-TN" ), ASCDocFileFormat::LID( DocFileFormat::ArabicTunisia ) ) ); - lidMap.insert( pair( string( "ar-AE" ), ASCDocFileFormat::LID( DocFileFormat::ArabicUAE ) ) ); - lidMap.insert( pair( string( "ar-YE" ), ASCDocFileFormat::LID( DocFileFormat::ArabicYemen ) ) ); - lidMap.insert( pair( string( "hy-AM" ), ASCDocFileFormat::LID( DocFileFormat::Armenian ) ) ); - lidMap.insert( pair( string( "as-IN" ), ASCDocFileFormat::LID( DocFileFormat::Assamese ) ) ); - lidMap.insert( pair( string( "az-AZ-cyrl" ), ASCDocFileFormat::LID( DocFileFormat::AzeriCyrillic ) ) ); - lidMap.insert( pair( string( "az-AZ-latn" ), ASCDocFileFormat::LID( DocFileFormat::AzeriLatin ) ) ); - lidMap.insert( pair( string( "eu-ES" ), ASCDocFileFormat::LID( DocFileFormat::Basque ) ) ); - lidMap.insert( pair( string( "be-BY" ), ASCDocFileFormat::LID( DocFileFormat::Belarusian ) ) ); - lidMap.insert( pair( string( "bn-IN" ), ASCDocFileFormat::LID( DocFileFormat::Bengali ) ) ); - lidMap.insert( pair( string( "bn-BD" ), ASCDocFileFormat::LID( DocFileFormat::BengaliBangladesh ) ) ); - lidMap.insert( pair( string( "bg-BG" ), ASCDocFileFormat::LID( DocFileFormat::Bulgarian ) ) ); - lidMap.insert( pair( string( "my-MM" ), ASCDocFileFormat::LID( DocFileFormat::Burmese ) ) ); - lidMap.insert( pair( string( "ca-ES" ), ASCDocFileFormat::LID( DocFileFormat::Catalan ) ) ); - lidMap.insert( pair( string( "zh-HK" ), ASCDocFileFormat::LID( DocFileFormat::ChineseHongKong ) ) ); - lidMap.insert( pair( string( "zh-MO" ), ASCDocFileFormat::LID( DocFileFormat::ChineseMacao ) ) ); - lidMap.insert( pair( string( "zh-CN" ), ASCDocFileFormat::LID( DocFileFormat::ChinesePRC ) ) ); - lidMap.insert( pair( string( "zh-SG" ), ASCDocFileFormat::LID( DocFileFormat::ChineseSingapore ) ) ); - lidMap.insert( pair( string( "zh-TW" ), ASCDocFileFormat::LID( DocFileFormat::ChineseTaiwan ) ) ); - lidMap.insert( pair( string( "hr-HR" ), ASCDocFileFormat::LID( DocFileFormat::Croatian ) ) ); - lidMap.insert( pair( string( "cs-CZ" ), ASCDocFileFormat::LID( DocFileFormat::Czech ) ) ); - lidMap.insert( pair( string( "da-DK" ), ASCDocFileFormat::LID( DocFileFormat::Danish ) ) ); - lidMap.insert( pair( string( "dv-MV" ), ASCDocFileFormat::LID( DocFileFormat::Divehi ) ) ); - lidMap.insert( pair( string( "nl-BE" ), ASCDocFileFormat::LID( DocFileFormat::DutchBelgium ) ) ); - lidMap.insert( pair( string( "nl-NL" ), ASCDocFileFormat::LID( DocFileFormat::DutchNetherlands ) ) ); - lidMap.insert( pair( string( "en-AU" ), ASCDocFileFormat::LID( DocFileFormat::EnglishAustralia ) ) ); - lidMap.insert( pair( string( "en-BZ" ), ASCDocFileFormat::LID( DocFileFormat::EnglishBelize ) ) ); - lidMap.insert( pair( string( "en-CA" ), ASCDocFileFormat::LID( DocFileFormat::EnglishCanada ) ) ); - lidMap.insert( pair( string( "en-DO" ), ASCDocFileFormat::LID( DocFileFormat::EnglishCaribbean ) ) ); - lidMap.insert( pair( string( "en-HK" ), ASCDocFileFormat::LID( DocFileFormat::EnglishHongKong ) ) ); - lidMap.insert( pair( string( "en-IN" ), ASCDocFileFormat::LID( DocFileFormat::EnglishIndia ) ) ); - lidMap.insert( pair( string( "en-ID" ), ASCDocFileFormat::LID( DocFileFormat::EnglishIndonesia ) ) ); - lidMap.insert( pair( string( "en-IE" ), ASCDocFileFormat::LID( DocFileFormat::EnglishIreland ) ) ); - lidMap.insert( pair( string( "en-JM" ), ASCDocFileFormat::LID( DocFileFormat::EnglishJamaica ) ) ); - lidMap.insert( pair( string( "en-MY" ), ASCDocFileFormat::LID( DocFileFormat::EnglishMalaysia ) ) ); - lidMap.insert( pair( string( "en-NZ" ), ASCDocFileFormat::LID( DocFileFormat::EnglishNewZealand ) ) ); - lidMap.insert( pair( string( "en-PH" ), ASCDocFileFormat::LID( DocFileFormat::EnglishPhilippines ) ) ); - lidMap.insert( pair( string( "en-SG" ), ASCDocFileFormat::LID( DocFileFormat::EnglishSingapore ) ) ); - lidMap.insert( pair( string( "en-ZA" ), ASCDocFileFormat::LID( DocFileFormat::EnglishSouthAfrica ) ) ); - lidMap.insert( pair( string( "en-TT" ), ASCDocFileFormat::LID( DocFileFormat::EnglishTrinidadAndTobago ) ) ); - lidMap.insert( pair( string( "en-UK" ), ASCDocFileFormat::LID( DocFileFormat::EnglishUK ) ) ); - lidMap.insert( pair( string( "en-US" ), ASCDocFileFormat::LID( DocFileFormat::EnglishUS ) ) ); - lidMap.insert( pair( string( "en-ZW" ), ASCDocFileFormat::LID( DocFileFormat::EnglishZimbabwe ) ) ); - lidMap.insert( pair( string( "et-EE" ), ASCDocFileFormat::LID( DocFileFormat::Estonian ) ) ); - lidMap.insert( pair( string( "fo-FO" ), ASCDocFileFormat::LID( DocFileFormat::Faeroese ) ) ); - lidMap.insert( pair( string( "fi-FI" ), ASCDocFileFormat::LID( DocFileFormat::Finnish ) ) ); - lidMap.insert( pair( string( "fr-BE" ), ASCDocFileFormat::LID( DocFileFormat::FrenchBelgium ) ) ); - lidMap.insert( pair( string( "fr-CM" ), ASCDocFileFormat::LID( DocFileFormat::FrenchCameroon ) ) ); - lidMap.insert( pair( string( "fr-CA" ), ASCDocFileFormat::LID( DocFileFormat::FrenchCanada ) ) ); - lidMap.insert( pair( string( "fr-CD" ), ASCDocFileFormat::LID( DocFileFormat::FrenchCongoDRC ) ) ); - lidMap.insert( pair( string( "fr-CI" ), ASCDocFileFormat::LID( DocFileFormat::FrenchCotedIvoire ) ) ); - lidMap.insert( pair( string( "fr-FR" ), ASCDocFileFormat::LID( DocFileFormat::FrenchFrance ) ) ); - lidMap.insert( pair( string( "fr-HT" ), ASCDocFileFormat::LID( DocFileFormat::FrenchHaiti ) ) ); - lidMap.insert( pair( string( "fr-LU" ), ASCDocFileFormat::LID( DocFileFormat::FrenchLuxembourg ) ) ); - lidMap.insert( pair( string( "fr-ML" ), ASCDocFileFormat::LID( DocFileFormat::FrenchMali ) ) ); - lidMap.insert( pair( string( "fr-MC" ), ASCDocFileFormat::LID( DocFileFormat::FrenchMonaco ) ) ); - lidMap.insert( pair( string( "fr-MA" ), ASCDocFileFormat::LID( DocFileFormat::FrenchMorocco ) ) ); - lidMap.insert( pair( string( "fr-RE" ), ASCDocFileFormat::LID( DocFileFormat::FrenchReunion ) ) ); - lidMap.insert( pair( string( "fr-SN" ), ASCDocFileFormat::LID( DocFileFormat::FrenchSenegal ) ) ); - lidMap.insert( pair( string( "fr-CH" ), ASCDocFileFormat::LID( DocFileFormat::FrenchSwitzerland ) ) ); - lidMap.insert( pair( string( "fr-DO" ), ASCDocFileFormat::LID( DocFileFormat::FrenchWestIndies ) ) ); - lidMap.insert( pair( string( "fy-NL" ), ASCDocFileFormat::LID( DocFileFormat::FrisianNetherlands ) ) ); - lidMap.insert( pair( string( "mk-MK" ), ASCDocFileFormat::LID( DocFileFormat::FYROMacedonian ) ) ); - lidMap.insert( pair( string( "ga-IE" ), ASCDocFileFormat::LID( DocFileFormat::GaelicIreland ) ) ); - lidMap.insert( pair( string( "gd-UK" ), ASCDocFileFormat::LID( DocFileFormat::GaelicScotland ) ) ); - lidMap.insert( pair( string( "gl-ES" ), ASCDocFileFormat::LID( DocFileFormat::Galician ) ) ); - lidMap.insert( pair( string( "ka-GE" ), ASCDocFileFormat::LID( DocFileFormat::Georgian ) ) ); - lidMap.insert( pair( string( "de-AT" ), ASCDocFileFormat::LID( DocFileFormat::GermanAustria ) ) ); - lidMap.insert( pair( string( "de-DE" ), ASCDocFileFormat::LID( DocFileFormat::GermanGermany ) ) ); - lidMap.insert( pair( string( "de-LI" ), ASCDocFileFormat::LID( DocFileFormat::GermanLiechtenstein ) ) ); - lidMap.insert( pair( string( "de-LU" ), ASCDocFileFormat::LID( DocFileFormat::GermanLuxembourg ) ) ); - lidMap.insert( pair( string( "de-CH" ), ASCDocFileFormat::LID( DocFileFormat::GermanSwitzerland ) ) ); - lidMap.insert( pair( string( "el-GR" ), ASCDocFileFormat::LID( DocFileFormat::Greek ) ) ); - lidMap.insert( pair( string( "gn-BR" ), ASCDocFileFormat::LID( DocFileFormat::Guarani ) ) ); - lidMap.insert( pair( string( "gu-IN" ), ASCDocFileFormat::LID( DocFileFormat::Gujarati ) ) ); - lidMap.insert( pair( string( "ha-NG" ), ASCDocFileFormat::LID( DocFileFormat::Hausa ) ) ); - lidMap.insert( pair( string( "he-IL" ), ASCDocFileFormat::LID( DocFileFormat::Hebrew ) ) ); - lidMap.insert( pair( string( "hi-IN" ), ASCDocFileFormat::LID( DocFileFormat::Hindi ) ) ); - lidMap.insert( pair( string( "hu-HU" ), ASCDocFileFormat::LID( DocFileFormat::Hungarian ) ) ); - lidMap.insert( pair( string( "is-IS" ), ASCDocFileFormat::LID( DocFileFormat::Icelandic ) ) ); - lidMap.insert( pair( string( "id-ID" ), ASCDocFileFormat::LID( DocFileFormat::Indonesian ) ) ); - lidMap.insert( pair( string( "iu-CA" ), ASCDocFileFormat::LID( DocFileFormat::Inuktitut ) ) ); - lidMap.insert( pair( string( "it-IT" ), ASCDocFileFormat::LID( DocFileFormat::ItalianItaly ) ) ); - lidMap.insert( pair( string( "it-CH" ), ASCDocFileFormat::LID( DocFileFormat::ItalianSwitzerland ) ) ); - lidMap.insert( pair( string( "ja-JP" ), ASCDocFileFormat::LID( DocFileFormat::Japanese ) ) ); - lidMap.insert( pair( string( "kn-ID" ), ASCDocFileFormat::LID( DocFileFormat::Kannada ) ) ); - lidMap.insert( pair( string( "ks-ID" ), ASCDocFileFormat::LID( DocFileFormat::Kashmiri ) ) ); - lidMap.insert( pair( string( "ks-PK" ), ASCDocFileFormat::LID( DocFileFormat::KashmiriArabic ) ) ); - lidMap.insert( pair( string( "kk-KZ" ), ASCDocFileFormat::LID( DocFileFormat::Kazakh ) ) ); - lidMap.insert( pair( string( "ko-KR" ), ASCDocFileFormat::LID( DocFileFormat::Korean ) ) ); - lidMap.insert( pair( string( "ky-KG" ), ASCDocFileFormat::LID( DocFileFormat::Kyrgyz ) ) ); - lidMap.insert( pair( string( "lo-LA" ), ASCDocFileFormat::LID( DocFileFormat::Lao ) ) ); - lidMap.insert( pair( string( "la" ), ASCDocFileFormat::LID( DocFileFormat::Latin ) ) ); - lidMap.insert( pair( string( "lv-LV" ), ASCDocFileFormat::LID( DocFileFormat::Latvian ) ) ); - lidMap.insert( pair( string( "lt-LT" ), ASCDocFileFormat::LID( DocFileFormat::Lithuanian ) ) ); - lidMap.insert( pair( string( "ms-MY" ), ASCDocFileFormat::LID( DocFileFormat::Malay ) ) ); - lidMap.insert( pair( string( "ms-BN" ), ASCDocFileFormat::LID( DocFileFormat::MalayBruneiDarussalam ) ) ); - lidMap.insert( pair( string( "ml-ID" ), ASCDocFileFormat::LID( DocFileFormat::Malayalam ) ) ); - lidMap.insert( pair( string( "mt-MT" ), ASCDocFileFormat::LID( DocFileFormat::Maltese ) ) ); - lidMap.insert( pair( string( "mi-NZ" ), ASCDocFileFormat::LID( DocFileFormat::Maori ) ) ); - lidMap.insert( pair( string( "mr-ID" ), ASCDocFileFormat::LID( DocFileFormat::Marathi ) ) ); - lidMap.insert( pair( string( "mn-MN" ), ASCDocFileFormat::LID( DocFileFormat::Mongolian ) ) ); - lidMap.insert( pair( string( "ne-NP" ), ASCDocFileFormat::LID( DocFileFormat::Nepali ) ) ); - lidMap.insert( pair( string( "ne-ID" ), ASCDocFileFormat::LID( DocFileFormat::NepaliIndia ) ) ); - lidMap.insert( pair( string( "nb-NO" ), ASCDocFileFormat::LID( DocFileFormat::NorwegianBokmal ) ) ); - lidMap.insert( pair( string( "nn-NO" ), ASCDocFileFormat::LID( DocFileFormat::NorwegianNynorsk ) ) ); - lidMap.insert( pair( string( "or-ID" ), ASCDocFileFormat::LID( DocFileFormat::Oriya ) ) ); - lidMap.insert( pair( string( "ps-PK" ), ASCDocFileFormat::LID( DocFileFormat::Pashto ) ) ); - lidMap.insert( pair( string( "pl-PL" ), ASCDocFileFormat::LID( DocFileFormat::Polish ) ) ); - lidMap.insert( pair( string( "pt-BR" ), ASCDocFileFormat::LID( DocFileFormat::PortugueseBrazil ) ) ); - lidMap.insert( pair( string( "pt-PT" ), ASCDocFileFormat::LID( DocFileFormat::PortuguesePortugal ) ) ); - lidMap.insert( pair( string( "pa-ID" ), ASCDocFileFormat::LID( DocFileFormat::Punjabi ) ) ); - lidMap.insert( pair( string( "pa-PK" ), ASCDocFileFormat::LID( DocFileFormat::PunjabiPakistan ) ) ); - lidMap.insert( pair( string( "qu-BO" ), ASCDocFileFormat::LID( DocFileFormat::QuechuaBolivia ) ) ); - lidMap.insert( pair( string( "qu-EC" ), ASCDocFileFormat::LID( DocFileFormat::QuechuaEcuador ) ) ); - lidMap.insert( pair( string( "qu-PE" ), ASCDocFileFormat::LID( DocFileFormat::QuechuaPeru ) ) ); - lidMap.insert( pair( string( "rm-CH" ), ASCDocFileFormat::LID( DocFileFormat::RhaetoRomanic ) ) ); - lidMap.insert( pair( string( "ro-MD" ), ASCDocFileFormat::LID( DocFileFormat::RomanianMoldova ) ) ); - lidMap.insert( pair( string( "ro-RO" ), ASCDocFileFormat::LID( DocFileFormat::RomanianRomania ) ) ); - lidMap.insert( pair( string( "ru-MD" ), ASCDocFileFormat::LID( DocFileFormat::RussianMoldova ) ) ); - lidMap.insert( pair( string( "ru-RU" ), ASCDocFileFormat::LID( DocFileFormat::RussianRussia ) ) ); - lidMap.insert( pair( string( "se-FI" ), ASCDocFileFormat::LID( DocFileFormat::SamiLappish ) ) ); - lidMap.insert( pair( string( "sa-ID" ), ASCDocFileFormat::LID( DocFileFormat::Sanskrit ) ) ); - lidMap.insert( pair( string( "sr-YU-cyrl" ), ASCDocFileFormat::LID( DocFileFormat::SerbianCyrillic ) ) ); - lidMap.insert( pair( string( "sr-YU-latn" ), ASCDocFileFormat::LID( DocFileFormat::SerbianLatin ) ) ); - lidMap.insert( pair( string( "sd-PK" ), ASCDocFileFormat::LID( DocFileFormat::SindhiArabic ) ) ); - lidMap.insert( pair( string( "sd-ID" ), ASCDocFileFormat::LID( DocFileFormat::SindhiDevanagari ) ) ); - lidMap.insert( pair( string( "si-ID" ), ASCDocFileFormat::LID( DocFileFormat::Sinhalese ) ) ); - lidMap.insert( pair( string( "sk-SK" ), ASCDocFileFormat::LID( DocFileFormat::Slovak ) ) ); - lidMap.insert( pair( string( "sl-SI" ), ASCDocFileFormat::LID( DocFileFormat::Slovenian ) ) ); - lidMap.insert( pair( string( "so-SO" ), ASCDocFileFormat::LID( DocFileFormat::Somali ) ) ); - lidMap.insert( pair( string( "es-AR" ), ASCDocFileFormat::LID( DocFileFormat::SpanishArgentina ) ) ); - lidMap.insert( pair( string( "es-BO" ), ASCDocFileFormat::LID( DocFileFormat::SpanishBolivia ) ) ); - lidMap.insert( pair( string( "es-CL" ), ASCDocFileFormat::LID( DocFileFormat::SpanishChile ) ) ); - lidMap.insert( pair( string( "es-CO" ), ASCDocFileFormat::LID( DocFileFormat::SpanishColombia ) ) ); - lidMap.insert( pair( string( "es-CR" ), ASCDocFileFormat::LID( DocFileFormat::SpanishCostaRica ) ) ); - lidMap.insert( pair( string( "es-DO" ), ASCDocFileFormat::LID( DocFileFormat::SpanishDominicanRepublic ) ) ); - lidMap.insert( pair( string( "es-EC" ), ASCDocFileFormat::LID( DocFileFormat::SpanishEcuador ) ) ); - lidMap.insert( pair( string( "es-SV" ), ASCDocFileFormat::LID( DocFileFormat::SpanishElSalvador ) ) ); - lidMap.insert( pair( string( "es-GT" ), ASCDocFileFormat::LID( DocFileFormat::SpanishGuatemala ) ) ); - lidMap.insert( pair( string( "es-HN" ), ASCDocFileFormat::LID( DocFileFormat::SpanishHonduras ) ) ); - lidMap.insert( pair( string( "es-MX" ), ASCDocFileFormat::LID( DocFileFormat::SpanishMexico ) ) ); - lidMap.insert( pair( string( "es-NI" ), ASCDocFileFormat::LID( DocFileFormat::SpanishNicaragua ) ) ); - lidMap.insert( pair( string( "es-PA" ), ASCDocFileFormat::LID( DocFileFormat::SpanishPanama ) ) ); - lidMap.insert( pair( string( "es-PY" ), ASCDocFileFormat::LID( DocFileFormat::SpanishParaguay ) ) ); - lidMap.insert( pair( string( "es-PE" ), ASCDocFileFormat::LID( DocFileFormat::SpanishPeru ) ) ); - lidMap.insert( pair( string( "es-PR" ), ASCDocFileFormat::LID( DocFileFormat::SpanishPuertoRico ) ) ); - lidMap.insert( pair( string( "es-ES" ), ASCDocFileFormat::LID( DocFileFormat::SpanishSpainTraditionalSort ) ) ); - lidMap.insert( pair( string( "es-UY" ), ASCDocFileFormat::LID( DocFileFormat::SpanishUruguay ) ) ); - lidMap.insert( pair( string( "es-VE" ), ASCDocFileFormat::LID( DocFileFormat::SpanishVenezuela ) ) ); - lidMap.insert( pair( string( "sw-TZ" ), ASCDocFileFormat::LID( DocFileFormat::Swahili ) ) ); - lidMap.insert( pair( string( "sv-FI" ), ASCDocFileFormat::LID( DocFileFormat::SwedishFinland ) ) ); - lidMap.insert( pair( string( "sv-SE" ), ASCDocFileFormat::LID( DocFileFormat::SwedishSweden ) ) ); - lidMap.insert( pair( string( "tg-TJ" ), ASCDocFileFormat::LID( DocFileFormat::Tajik ) ) ); - lidMap.insert( pair( string( "ta-ID" ), ASCDocFileFormat::LID( DocFileFormat::Tamil ) ) ); - lidMap.insert( pair( string( "tt-RU" ), ASCDocFileFormat::LID( DocFileFormat::Tatar ) ) ); - lidMap.insert( pair( string( "te-ID" ), ASCDocFileFormat::LID( DocFileFormat::Telugu ) ) ); - - for (unsigned short i = 0; i < ( sizeof(ASCDocFileFormat::StyleIDs) / sizeof(ASCDocFileFormat::StyleIDs[0]) ); i++ ) - { - predefinedStyleIDMap.insert( pair( ASCDocFileFormat::StyleIDs[i], i ) ); - } - - styleTypeMap.insert( pair( string( "paragraph" ), ASCDocFileFormat::Constants::styleTypeParagraph ) ); - styleTypeMap.insert( pair( string( "character" ), ASCDocFileFormat::Constants::styleTypeCharacter ) ); - styleTypeMap.insert( pair( string( "table" ), ASCDocFileFormat::Constants::styleTypeTable ) ); - styleTypeMap.insert( pair( string( "numbering" ), ASCDocFileFormat::Constants::styleTypeNumbering ) ); - - for ( unsigned short i = 0; i < ( sizeof(ASCDocFileFormat::NumberFormatCodes) / sizeof(ASCDocFileFormat::NumberFormatCodes[0]) ); i++ ) - { - numFmtMap.insert( pair( ASCDocFileFormat::NumberFormatCodes[i], (ASCDocFileFormat::Constants::MSONFC)i ) ); - } - - kulMap.insert( pair( string( "none" ), 0x00 ) ); - kulMap.insert( pair( string( "single" ), 0x01 ) ); - kulMap.insert( pair( string( "words" ), 0x02 ) ); - kulMap.insert( pair( string( "double" ), 0x03 ) ); - kulMap.insert( pair( string( "dotted" ), 0x04 ) ); - kulMap.insert( pair( string( "thick" ), 0x06 ) ); - kulMap.insert( pair( string( "dash" ), 0x07 ) ); - kulMap.insert( pair( string( "dotDash" ), 0x09 ) ); - kulMap.insert( pair( string( "dotDotDash" ), 0x0A ) ); - kulMap.insert( pair( string( "wave" ), 0x0B ) ); - kulMap.insert( pair( string( "dottedHeavy" ), 0x14 ) ); - kulMap.insert( pair( string( "dashedHeavy" ), 0x17 ) ); - kulMap.insert( pair( string( "dashDotHeavy" ), 0x19 ) ); - kulMap.insert( pair( string( "dashDotDotHeavy" ), 0x1A ) ); - kulMap.insert( pair( string( "wavyHeavy" ), 0x1B ) ); - kulMap.insert( pair( string( "dashLong" ), 0x27 ) ); - kulMap.insert( pair( string( "wavyDouble" ), 0x2B ) ); - kulMap.insert( pair( string( "dashLongHeavy" ), 0x37 ) ); - - sectionBreakTypeMap.insert( pair( string( "continuous" ), ASCDocFileFormat::Constants::bkcContinuous ) ); - sectionBreakTypeMap.insert( pair( string( "nextColumn" ), ASCDocFileFormat::Constants::bkcNewColumn ) ); - sectionBreakTypeMap.insert( pair( string( "nextPage" ), ASCDocFileFormat::Constants::bkcNewPage ) ); - sectionBreakTypeMap.insert( pair( string( "evenPage" ), ASCDocFileFormat::Constants::bkcEvenPage ) ); - sectionBreakTypeMap.insert( pair( string( "oddPage" ), ASCDocFileFormat::Constants::bkcOddPage ) ); - - verticalPositionCodeMap.insert( make_pair( "margin", 0x00 ) ); - verticalPositionCodeMap.insert( make_pair( "page", 0x01 ) ); - verticalPositionCodeMap.insert( make_pair( "text", 0x02 ) ); - verticalPositionCodeMap.insert( make_pair( "none", 0x03 ) ); - - horizontalPositionCodeMap.insert( make_pair( "text", 0x00 ) ); - horizontalPositionCodeMap.insert( make_pair( "margin", 0x01 ) ); - horizontalPositionCodeMap.insert( make_pair( "page", 0x02 ) ); - horizontalPositionCodeMap.insert( make_pair( "none", 0x03 ) ); - - textFrameWrappingMap.insert( make_pair( "auto", 0x00 ) ); - textFrameWrappingMap.insert( make_pair( "notBeside", 0x01 ) ); - textFrameWrappingMap.insert( make_pair( "around", 0x02 ) ); - textFrameWrappingMap.insert( make_pair( "none", 0x03 ) ); - textFrameWrappingMap.insert( make_pair( "tight", 0x04 ) ); - textFrameWrappingMap.insert( make_pair( "through", 0x05 ) ); - - tableCellWidthMap.insert( make_pair( "nil", ASCDocFileFormat::Constants::ftsNil ) ); - tableCellWidthMap.insert( make_pair( "auto", ASCDocFileFormat::Constants::ftsAuto ) ); - tableCellWidthMap.insert( make_pair( "pct", ASCDocFileFormat::Constants::ftsPercent ) ); - tableCellWidthMap.insert( make_pair( "dxa", ASCDocFileFormat::Constants::ftsDxa ) ); - - customTabStopAlignment.insert( make_pair( "left", ASCDocFileFormat::Constants::jcLeft ) ); - customTabStopAlignment.insert( make_pair( "center", ASCDocFileFormat::Constants::jcCenter ) ); - customTabStopAlignment.insert( make_pair( "right", ASCDocFileFormat::Constants::jcRight ) ); - customTabStopAlignment.insert( make_pair( "decimal", ASCDocFileFormat::Constants::jcDecimal ) ); - customTabStopAlignment.insert( make_pair( "bar", ASCDocFileFormat::Constants::jcBar ) ); - customTabStopAlignment.insert( make_pair( "clear", (ASCDocFileFormat::Constants::TabJC)0x05 ) ); - customTabStopAlignment.insert( make_pair( "num", ASCDocFileFormat::Constants::jcList ) ); - - customTabStopLeader.insert( make_pair( "none", ASCDocFileFormat::Constants::tlcNone ) ); - customTabStopLeader.insert( make_pair( "dot", ASCDocFileFormat::Constants::tlcDot ) ); - customTabStopLeader.insert( make_pair( "hyphen", ASCDocFileFormat::Constants::tlcHyphen ) ); - customTabStopLeader.insert( make_pair( "underscore", ASCDocFileFormat::Constants::tlcUnderscore ) ); - customTabStopLeader.insert( make_pair( "heavy", ASCDocFileFormat::Constants::tlcHeavy ) ); - customTabStopLeader.insert( make_pair( "middleDot", ASCDocFileFormat::Constants::tlcMiddleDot ) ); - } - - CFileTransformer::~CFileTransformer() - { - ASCDocFileFormat::BinaryStorageSingleton* pBin = ASCDocFileFormat::BinaryStorageSingleton::Instance(); - if (pBin) - pBin->FreeInstance(); - - ASCDocFileFormat::COArtStorage* pStorage = ASCDocFileFormat::COArtStorage::Instance(); - if (pStorage) - pStorage->FreeInstance(); - - RELEASEOBJECT (m_pDocFile); - } -} - -namespace DOCXTODOC -{ - long CFileTransformer::Convert(const wchar_t* ooxFolder, const wchar_t* docFile, const ProgressCallback* ffCallBack) - { - LONG hrStatus = S_FALSE; - - if ((NULL != ooxFolder) && (NULL != docFile) && (NULL != m_pDocFile)) - { -#ifndef _DEBUG - try - { -#endif - m_docxInputFile.read(ooxFolder); - - if (UpdateProgress (ffCallBack,500000)) - return S_FALSE; - - SHORT index = 0; - - size_t count = (m_docxInputFile.find().find().m_fonts).size(); - std::vector& items = (m_docxInputFile.find().find().m_fonts); - - for (size_t j = 0; j < count; ++j) - { - m_mapFontTableMap.insert(pair(items[j].m_name.get(), index++)); - } - - if (UpdateProgress (ffCallBack,625000)) - return S_FALSE; - - if (m_docxInputFile.find().exist()) - ConvertNumbering( m_docxInputFile.find().find() ); - - ConvertStyleSheet (m_docxInputFile.find().find()); - - if (UpdateProgress (ffCallBack,750000)) - return S_FALSE; - - ConvertDocument (m_docxInputFile.find()); - ConvertFontTable(m_docxInputFile.find().find()); - - if (UpdateProgress (ffCallBack,875000)) - return S_FALSE; - - hrStatus = m_pDocFile->SaveToFile (docFile); - - if (UpdateProgress (ffCallBack,1000000)) - return S_FALSE; -#ifndef _DEBUG - } - catch (...) - { - hrStatus = S_FALSE; - } -#endif - } - - return hrStatus; - } - - bool CFileTransformer::UpdateProgress(const ProgressCallback* ffCallBack, long nComplete) - { - if (ffCallBack) - { - ffCallBack->OnProgress (ffCallBack->caller, DOC_ONPROGRESSEVENT_ID, nComplete); - - SHORT pbStop = 0; - ffCallBack->OnProgressEx (ffCallBack->caller, DOC_ONPROGRESSEVENT_ID, nComplete, &pbStop); - - if (0 != pbStop) - return TRUE; - } - - return FALSE; - } -} - -namespace DOCXTODOC -{ - void CFileTransformer::ConvertDocument(const OOX::Document& oXmlDoc) - { - ConvertContent (*oXmlDoc.Items); - - // TODO : если список в конце документа, то добавляется брэйк (бага) - - ASCDocFileFormat::Paragraph paragraph; - paragraph.AddParagraphItem (ASCDocFileFormat::Run()); - m_pDocFile->AddTextItem (paragraph); - - m_pDocFile->AddSectionProperties (ConvertSectionProperties(oXmlDoc.SectorProperty)); - } - - void CFileTransformer::ConvertContent(const vector& oXmlItems) - { - m_oOArtBuilder.SetLocation (MAIN_DOCUMENT); - - for (size_t i = 0; i < oXmlItems.size(); ++i) - { - const OOX::Logic::TextItem& oXmlItem = oXmlItems[i]; - - if (oXmlItem.is()) - { - const OOX::Logic::Paragraph& docxParagraph = oXmlItem.as(); - if (ValidParagraph(docxParagraph)) - { - ASCDocFileFormat::Paragraph docParagraph = ConvertParagraph(docxParagraph); - - m_pDocFile->AddTextItem (docParagraph); - - if (docxParagraph.Property.is_init() && docxParagraph.Property->SectorProperty.is_init()) - { - m_pDocFile->AddTextItem (ASCDocFileFormat::SectionBreak()); - m_pDocFile->AddSectionProperties(ConvertSectionProperties( docxParagraph.Property->SectorProperty)); - } - } - } - - if (oXmlItem.is()) - { - ASCDocFileFormat::Table oDocTable = CreateTable(oXmlItem.as()); - m_pDocFile->AddTextItem (oDocTable); - } - - if (oXmlItem.is()) - { - ConvertContent((*oXmlItem.as().Content).m_items); - } - } - } - - template ASCDocFileFormat::Paragraph CFileTransformer::ConvertParagraph (const OOX::Logic::Paragraph& oXmlParagraph) - { - PrlList styleRunPr; - PrlList styleParPr; - - std::string style = GetStyleID (oXmlParagraph); - - ASCDocFileFormat::Paragraph oParagraph; - oParagraph.SetStyle (m_mapStyleSheetMap [style]); - - styleRunPr = GetRunPropertiesFromStyleHierarchy (style); - styleParPr = GetParagraphPropertiesFromStyleHierarchy (style, &styleRunPr); - - // retrieve run properties - m_bIsHaveRunPr = FALSE; - - PrlList defaultRunPr; - if (oXmlParagraph.Property.is_init() && oXmlParagraph.Property->RunProperty.is_init()) - { - defaultRunPr = ConvertRunProperties(*oXmlParagraph.Property->RunProperty); - - CPrCopier copier(&styleRunPr, &defaultRunPr); - } - - m_bHaveSeparateFldChar = false; - - bool haveGoBack = FALSE; //TODO : some content - - for (size_t i = 0; i < oXmlParagraph.Items->size(); ++i) - { - const OOX::Logic::ParagraphItem& oParagraphItem = oXmlParagraph.Items->operator[](i); - - std::wstring strRunType; - - if (oParagraphItem.is()) - { - ASCDocFileFormat::Run oAddRun = ConvertRun(oParagraphItem.as(), styleRunPr, strRunType); - - if (m_bIsInlineShape) - { - //ASCDocFileFormat::Picture oPicture (std::wstring(L"c:\\man.png"), 0, 0, 1000, 1000); - //oParagraph.AddParagraphItem(ASCDocFileFormat::Run(oPicture)); - - oParagraph.AddParagraphItem(m_oInlineShape); - } - else - { - oParagraph.AddParagraphItem(oAddRun); - } - - //ASCDocFileFormat::Picture oPicture (std::wstring(L"c:\\man.png"), 0, 0, 5000, 5000); - //oParagraph.AddParagraphItem(ASCDocFileFormat::Run(oPicture)); - - m_bIsInlineShape = FALSE; - } - else if (oParagraphItem.is()) - { - oParagraph.AddParagraphItem (ConvertHyperlink(oParagraphItem.as(), styleRunPr)); - } - else if (oParagraphItem.is()) - { - const OOX::Logic::BookmarkStart& oBookMark = oParagraphItem.as(); - if (std::wstring(_T("_GoBack")) == FormatUtils::UTF8Decode(oBookMark.Name)) - { - haveGoBack = TRUE; - continue; - } - - oParagraph.AddParagraphItem (ASCDocFileFormat::BookmarkStart(FormatUtils::UTF8Decode(oBookMark.Id), FormatUtils::UTF8Decode(oBookMark.Name))); - } - else if (oParagraphItem.is()) - { - if (haveGoBack) - { - haveGoBack = FALSE; - continue; - } - - const OOX::Logic::BookmarkEnd& oBookMark = oParagraphItem.as(); - oParagraph.AddParagraphItem (ASCDocFileFormat::BookmarkEnd(FormatUtils::UTF8Decode(oBookMark.Id))); - } - else if (oParagraphItem.is()) - { - // TODO: - - ConvertFldSimple(oParagraphItem.as(), styleRunPr, oParagraph, strRunType); - } - else if (oParagraphItem.is()) - { - const OOX::Logic::Insert& insertElement = oParagraphItem.as(); - - if (!insertElement.Runs->empty()) - { - size_t count = (*insertElement.Runs).size(); - const std::vector& items = (*insertElement.Runs); - - for (size_t j = 0; j < count; ++j) - { - oParagraph.AddParagraphItem(ConvertRun(items[j], styleRunPr, strRunType)); - } - } - } - else if (oParagraphItem.is()) - { - const OOX::Logic::Delete& deleteElement = oParagraphItem.as(); - - if (!deleteElement.Runs->empty()) - { - size_t count = (*deleteElement.Runs).size(); - const std::vector& items = (*deleteElement.Runs); - - for (size_t j = 0; j < count; ++j) - { - oParagraph.AddParagraphItem(ConvertRun(items[j], styleRunPr, strRunType)); - } - } - } - - UpdateItemByCondition (&oParagraph, strRunType); - } - - if (oXmlParagraph.Items->empty()) - { - // Have some other properties - - ASCDocFileFormat::Run run; - run.AddProperties(styleRunPr); - - if (oXmlParagraph.Property.is_init() && oXmlParagraph.Property->RunProperty.is_init()) - { - run.AddOrReplaceProperties(styleRunPr); - } - - oParagraph.AddParagraphItem(run); - } - - oParagraph.AddProperties (ConvertParagraphProperties (m_docxInputFile.find().find().Default->ParagraphProperty)); - oParagraph.AddOrReplaceProperties (styleParPr); - - if (oXmlParagraph.Property.is_init()) - { - oParagraph.AddOrReplaceProperties(ConvertParagraphProperties (*oXmlParagraph.Property)); - } - - return oParagraph; - } -} - -namespace DOCXTODOC -{ - bool CFileTransformer::ValidParagraph (const OOX::Logic::Paragraph& oXmlParagraph) - { - // NOT IMPEMENT - - return TRUE; - } - - PrlList CFileTransformer::GetParagraphPropertiesFromStyleHierarchy(const string& styleID, PrlList* styleDocRunLinkProperties ) - { - PrlList allParagraphProperties; - - const OOX::Styles::Style styleById = this->m_docxInputFile.find().find().GetStyleById(styleID); - - if (styleById.BasedOn.is_init()) - { - allParagraphProperties = this->GetParagraphPropertiesFromStyleHierarchy(*styleById.BasedOn, styleDocRunLinkProperties); - } - - if ( styleById.ParagraphProperty.is_init() ) - { - PrlList styleParagraphProperties = ConvertParagraphProperties(*styleById.ParagraphProperty); - - for (size_t i = 0; i < styleParagraphProperties.size(); ++i) - allParagraphProperties.push_back(styleParagraphProperties[i]); - } - - if ((styleById.Link.is_init()) && (styleDocRunLinkProperties != NULL)) - { - PrlList styleDocRunLinkPropertiesHierarchy = GetRunPropertiesFromStyleHierarchy( *styleById.Link ); - - for (size_t i = 0; i < styleDocRunLinkPropertiesHierarchy.size(); ++i) - styleDocRunLinkProperties->push_back(styleDocRunLinkPropertiesHierarchy[i]); - } - - return allParagraphProperties; - } - - PrlList CFileTransformer::GetRunPropertiesFromStyleHierarchy(const string& styleID) - { - PrlList allRunProperties; - - const OOX::Styles::Style styleById = m_docxInputFile.find().find().GetStyleById( styleID ); - - if ( styleById.BasedOn.is_init() ) - { - allRunProperties = GetRunPropertiesFromStyleHierarchy(*styleById.BasedOn); - } - - if ( styleById.RunProperty.is_init() ) - { - PrlList styleRunProperties = this->ConvertRunProperties( *styleById.RunProperty ); - - for (size_t i = 0; i < styleRunProperties.size(); ++i) - allRunProperties.push_back(styleRunProperties[i]); - } - - return allRunProperties; - } - - PrlList CFileTransformer::GetTablePropertiesFromStyleHierarchy(const string& styleID) - { - PrlList allTableProperties; - - const OOX::Styles::Style styleById = m_docxInputFile.find().find().GetStyleById( styleID ); - - if ( styleById.BasedOn.is_init() ) - { - allTableProperties = GetTablePropertiesFromStyleHierarchy(*styleById.BasedOn); - } - - if ( styleById.tblPr.is_init() ) - { - PrlList styleTableProperties = ConvertTableProperties(*styleById.tblPr); - - for (size_t i = 0; i < styleTableProperties.size(); ++i) - allTableProperties.push_back(styleTableProperties[i]); - } - - return allTableProperties; - } - - std::wstring CFileTransformer::GetFontNameByThemeName(const std::wstring& themeName) - { - string fontName; - - const OOX::Theme::File& themeFile = this->m_docxInputFile.find().find(); - - if (themeFile.themeElements.is_init() && themeFile.themeElements->fontScheme.is_init()) - { - const OOX::Theme::FontScheme& fontScheme = *themeFile.themeElements->fontScheme; - - std::wstring major = std::wstring(L"major"); - std::wstring minor = std::wstring(L"minor"); - - std::wstring hAnsi = std::wstring(L"HAnsi"); - std::wstring eastAsia = std::wstring(L"EastAsia"); - std::wstring bidi = std::wstring(L"Bidi"); - - if ( fontScheme.majorFont.is_init() && ( search( themeName.begin(), themeName.end(), major.begin(), major.end() ) != themeName.end() ) ) - { - const OOX::Theme::MajorFont& majorFont = *fontScheme.majorFont; - - if ( ( majorFont.latin.is_init() ) && ( search( themeName.begin(), themeName.end(), hAnsi.begin(), hAnsi.end() ) != themeName.end() ) ) - { - fontName = *majorFont.latin; - } - else if ( majorFont.ea.is_init() && ( search( themeName.begin(), themeName.end(), eastAsia.begin(), eastAsia.end() ) != themeName.end() ) ) - { - fontName = *majorFont.ea; - } - else if ( majorFont.cs.is_init() && ( search( themeName.begin(), themeName.end(), bidi.begin(), bidi.end() ) != themeName.end() ) ) - { - fontName = *majorFont.cs; - } - } - else if ( search( themeName.begin(), themeName.end(), minor.begin(), minor.end() ) != themeName.end() ) - { - const OOX::Theme::MinorFont& minorFont = *fontScheme.minorFont; - - if ( minorFont.latin.is_init() && ( search( themeName.begin(), themeName.end(), hAnsi.begin(), hAnsi.end() ) != themeName.end() ) ) - { - fontName = *minorFont.latin; - } - else if ( minorFont.ea.is_init() && ( search( themeName.begin(), themeName.end(), eastAsia.begin(), eastAsia.end() ) != themeName.end() ) ) - { - fontName = *minorFont.ea; - } - else if ( minorFont.cs.is_init() && ( search( themeName.begin(), themeName.end(), bidi.begin(), bidi.end() ) != themeName.end() ) ) - { - fontName = *minorFont.cs; - } - } - } - - return string2wstring__(fontName); - } - - template void CFileTransformer::ConvertFldSimple(const OOX::Logic::FldSimple& fldSimpleDocx, const PrlList& styleDocRunProperties, ASCDocFileFormat::Paragraph& docParagraph, std::wstring& strRunType) - { - string::size_type findIndex = string::npos; - - findIndex = fldSimpleDocx.Instr->find( "PAGE" ); - - if ( findIndex != string::npos ) - { - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeBegin, ASCDocFileFormat::Constants::fltPAGE ) ) ); - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeSeparate ) ) ); - docParagraph.AddParagraphItem( ConvertRun( *fldSimpleDocx.Run, styleDocRunProperties, strRunType ) ); - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeEnd ) ) ); - } - - findIndex = fldSimpleDocx.Instr->find( "SYMBOL" ); - - if ( findIndex != string::npos ) - { - ASCDocFileFormat::Run fldSymbolRun; - - fldSymbolRun.AddRunItem( ASCDocFileFormat::Text( FormatUtils::UTF8Decode( *fldSimpleDocx.Instr ) ) ); - fldSymbolRun.AddProperties( styleDocRunProperties ); - - strRunType = _T( "SYMBOL" ); - - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeBegin, ASCDocFileFormat::Constants::fltSYMBOL ) ) ); - docParagraph.AddParagraphItem( fldSymbolRun ); - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeSeparate ) ) ); - docParagraph.AddParagraphItem( ASCDocFileFormat::Run( ASCDocFileFormat::FldChar( ASCDocFileFormat::FldCharTypeEnd ) ) ); - } - } - - template ASCDocFileFormat::Hyperlink CFileTransformer::ConvertHyperlink(const OOX::Logic::Hyperlink& docxHyperlink, const PrlList& styleDocRunProperties ) - { - ASCDocFileFormat::Hyperlink docHyperlink; - - if (docxHyperlink.rId.is_init()) - { - OOX::HyperLink* hyperlink = NULL; - const OOX::RId& rid = *docxHyperlink.rId; - - if (typeid(T) != typeid(OOX::Document)) - { - if (m_docxInputFile.find().find().exist(rid)) - { - hyperlink = dynamic_cast(m_docxInputFile.find().find()[rid].operator->()); - } - } - else - { - if (m_docxInputFile.find().exist(rid)) - { - hyperlink = dynamic_cast(m_docxInputFile.find()[rid].operator->()); - } - } - - if (hyperlink) - { - docHyperlink.SetURL(hyperlink->GetPath().c_str()); - } - } - - if (docxHyperlink.Anchor.is_init()) - { - docHyperlink.SetLocationInTheFile(FormatUtils::UTF8Decode( *docxHyperlink.Anchor ).c_str()); - } - - size_t count = (*docxHyperlink.Runs).size(); - const std::vector& items = (*docxHyperlink.Runs); - - for (size_t i = 0; i < count; ++i) - { - std::wstring strRunType; - docHyperlink.AddRun(ConvertRun(items[i], styleDocRunProperties, strRunType)); - UpdateItemByCondition(&docHyperlink, strRunType); - } - - return docHyperlink; - } - - template void CFileTransformer::UpdateItemByCondition(T* docItem, const wstring& condition) - { - if ( ( docItem != NULL ) && ( !condition.empty() ) ) - { - static bool haveSeparator = false; - - ASCDocFileFormat::FldChar* fldChar = NULL; - - bool findComplete = FALSE; - - for (T::reverse_iterator riter = docItem->rbegin(); riter != docItem->rend(); ++riter) - { - if (riter->is()) - { - ASCDocFileFormat::Run& run = riter->as(); - - for (ASCDocFileFormat::Run::reverse_iterator runRIter = run.rbegin(); runRIter != run.rend(); ++runRIter) - { - if ( runRIter->is() ) - { - fldChar = &runRIter->as(); - - findComplete = TRUE; - break; - } - } - - if (findComplete) - break; - } - } - - if ( NULL == fldChar ) - return; - - unsigned char charType = fldChar->CharType(); - - if (condition == std::wstring(_T("HYPERLINK"))) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties(ASCDocFileFormat::Constants::fltHYPERLINK); - } - } - else if ( condition == std::wstring( _T( "PAGEREF" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltPAGEREF ); - } - } - else if ( condition == std::wstring( _T( "TOC" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltTOC ); - } - } - else if ( condition == std::wstring( _T( "PAGE" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltPAGE ); - } - } - else if ( condition == std::wstring( _T( "SYMBOL" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltSYMBOL ); - } - } - else if ( condition == std::wstring( _T( "ADDRESSBLOCK" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltADDRESSBLOCK ); - } - } - else if ( condition == std::wstring( _T( "GREETINGLINE" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltGREETINGLINE ); - } - } - else if ( condition == std::wstring( _T( "MERGEFIELD" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharBegin ) - { - fldChar->SetFieldCharacterProperties( ASCDocFileFormat::Constants::fltMERGEFIELD ); - } - } - else if ( condition == std::wstring( _T( "separate" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharSeparate ) - { - //fldChar->SetFieldCharacterProperties(0); - haveSeparator = true; - } - } - else if ( condition == std::wstring( _T( "end" ) ) ) - { - if (charType == ASCDocFileFormat::FldChar::FldCharEnd ) - { - fldChar->SetFieldCharacterProperties( (unsigned char)ASCDocFileFormat::grffldEnd( false, false, false, false, false, false, false, haveSeparator ) ); - - haveSeparator = false; - } - } - } - } - - // - ASCDocFileFormat::Constants::VerticalMergeFlag CFileTransformer::ConvertTableVerticalMergeFlag(const nullable - ASCDocFileFormat::Constants::VerticalMergeFlag vmf = ASCDocFileFormat::Constants::fvmClear; - - if ( vMerge.is_init() ) - { - if ( vMerge->Value.is_init() ) - { - if ( *vMerge->Value == string( "restart" ) ) - { - vmf = ASCDocFileFormat::Constants::fvmRestart; - } - else if ( *vMerge->Value == string( "continue" ) ) - { - vmf = ASCDocFileFormat::Constants::fvmMerge; - } - } - else - { - vmf = ASCDocFileFormat::Constants::fvmMerge; - } - } - - return vmf; - } - - const PrlList CFileTransformer::ConvertRunProperties(const OOX::Logic::RunProperty& docxRunProperties) - { - m_bIsHaveRunPr = TRUE; - - PrlList docRunProperties; - - if ( docxRunProperties.Bold.is_init() ) - { - unsigned char bold = ( ( *docxRunProperties.Bold ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFBold, &bold ) ); - } - - if ( docxRunProperties.Italic.is_init() ) - { - unsigned char italic = ( ( *docxRunProperties.Italic ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFItalic, &italic ) ); - } - - if ( docxRunProperties.Under.is_init() && *docxRunProperties.Under && docxRunProperties.UnderType.is_init() ) - { - unsigned char under = this->kulMap[*docxRunProperties.UnderType]; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCKul, &under ) ); - } - - if ( docxRunProperties.Strike.is_init() ) - { - unsigned char strike = ( ( *docxRunProperties.Strike ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFStrike, &strike ) ); - } - - if ( docxRunProperties.DStrike.is_init() ) - { - unsigned char dStrike = ( ( *docxRunProperties.DStrike ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFDStrike, &dStrike ) ); - } - - if ( docxRunProperties.SmallCaps.is_init() ) - { - unsigned char smallCaps = ( ( *docxRunProperties.SmallCaps ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFSmallCaps, &smallCaps ) ); - } - - if ( docxRunProperties.Caps.is_init() ) - { - unsigned char caps = ( ( *docxRunProperties.Caps ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFCaps, &caps ) ); - } - - if ( docxRunProperties.Emboss.is_init() ) - { - unsigned char emboss = ( ( *docxRunProperties.Emboss ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFEmboss, &emboss ) ); - } - - if ( docxRunProperties.Imprint.is_init() ) - { - unsigned char imprint = ( ( *docxRunProperties.Imprint ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFImprint, &imprint ) ); - } - - if ( docxRunProperties.Outline.is_init() ) - { - unsigned char outline = ( ( *docxRunProperties.Outline ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFOutline, &outline ) ); - } - - if ( docxRunProperties.Shadow.is_init() ) - { - unsigned char shadow = ( ( *docxRunProperties.Shadow ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFShadow, &shadow ) ); - } - - if ( docxRunProperties.Vanish.is_init() ) - { - unsigned char vanish = ( ( *docxRunProperties.Vanish ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFVanish, &vanish ) ); - } - - if ( docxRunProperties.FontSize.is_init() ) - { - unsigned short fontSize = (unsigned short)docxRunProperties.FontSize; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHps, (unsigned char*)&fontSize ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsBi, (unsigned char*)&fontSize ) ); - } - - if (docxRunProperties.FontColor.is_init()) - { - int colorIntValue = ASCDocFileFormat::COLORREF::cvAuto; - if (false == docxRunProperties.FontColor->isAuto()) - colorIntValue = HexString2Int( docxRunProperties.FontColor->ToString() ); - - ASCDocFileFormat::COLORREF color (colorIntValue); - - docRunProperties.push_back (ASCDocFileFormat::Prl((short)DocFileFormat::sprmCCv, color)); - } - - if ( docxRunProperties.Highlight.is_init() ) - { - unsigned char ico = DOCXDOCUTILS::ColorToIco (*docxRunProperties.Highlight); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHighlight, &ico ) ); - } - - if ( docxRunProperties.Shading.is_init() && docxRunProperties.Shading->fill.is_init() ) - { - int colorIntValue = 0; - int fillAuto = 0x00; - - if (docxRunProperties.Shading->fill == "auto") - { - fillAuto = ASCDocFileFormat::COLORREF::cvAuto; - } - else - { - colorIntValue = HexString2Int( *docxRunProperties.Shading->fill ); - } - - ASCDocFileFormat::SHDOperand shdOperand ( - ASCDocFileFormat::Shd( ASCDocFileFormat::COLORREF( (int)( 0 | fillAuto ) ), - ASCDocFileFormat::COLORREF( colorIntValue | fillAuto ), - 0 ) ); - - docRunProperties.push_back (ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCShd, shdOperand )); - } - - if ( docxRunProperties.rFonts.is_init() ) - { - short fontIndex = 0; - - if ( docxRunProperties.rFonts->ascii.is_init() && !docxRunProperties.rFonts->AsciiTheme.is_init() ) - { - std::wstring strFontName = string2wstring__(docxRunProperties.rFonts->ascii); - if (strFontName.length()) - { - AddInternalFont (strFontName); - - fontIndex = m_mapFontTableMap[strFontName]; - - docRunProperties.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmCRgFtc0, (unsigned char*)&fontIndex)); - } - } - else if ( docxRunProperties.rFonts->AsciiTheme.is_init()) - { - std::wstring fontNameByThemeName = GetFontNameByThemeName(string2wstring__(docxRunProperties.rFonts->AsciiTheme) ); - - if (!fontNameByThemeName.empty()) - { - std::map::const_iterator findResult = m_mapFontTableMap.find(fontNameByThemeName); - - if (findResult != m_mapFontTableMap.end()) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc0, (unsigned char*)&fontIndex ) ); - } - } - - if (docxRunProperties.rFonts->Cs.is_init() && !docxRunProperties.rFonts->Cstheme.is_init()) - { - std::wstring strFontName = string2wstring__(docxRunProperties.rFonts->Cs); - if (strFontName.length()) - { - AddInternalFont (strFontName); - - fontIndex = m_mapFontTableMap[strFontName]; - - docRunProperties.push_back (ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc1, (unsigned char*)&fontIndex)); - } - } - else if ( docxRunProperties.rFonts->Cstheme.is_init() ) - { - std::wstring fontNameByThemeName = GetFontNameByThemeName(string2wstring__(docxRunProperties.rFonts->Cstheme)); - - if ( !fontNameByThemeName.empty() ) - { - std::map::const_iterator findResult = m_mapFontTableMap.find(fontNameByThemeName); - - if ( findResult != m_mapFontTableMap.end() ) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc1, (unsigned char*)&fontIndex ) ); - } - } - - if ( docxRunProperties.rFonts->hAnsi.is_init() && !docxRunProperties.rFonts->HAnsiTheme.is_init() ) - { - std::wstring strFontName = string2wstring__(docxRunProperties.rFonts->hAnsi); - if (strFontName.length()) - { - AddInternalFont (strFontName); - - fontIndex = m_mapFontTableMap[string2wstring__(docxRunProperties.rFonts->hAnsi)]; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc2, (unsigned char*)&fontIndex ) ); - } - } - else if ( docxRunProperties.rFonts->HAnsiTheme.is_init() ) - { - std::wstring fontNameByThemeName = GetFontNameByThemeName(string2wstring__(docxRunProperties.rFonts->HAnsiTheme)); - - if ( !fontNameByThemeName.empty() ) - { - map::const_iterator findResult = m_mapFontTableMap.find(fontNameByThemeName); - - if (findResult != m_mapFontTableMap.end()) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc2, (unsigned char*)&fontIndex ) ); - } - } - } - - if ( docxRunProperties.Lang.is_init() ) - { - if ( docxRunProperties.Lang->Value.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[docxRunProperties.Lang->Value]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid0_80, (unsigned char*)lid ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid0, (unsigned char*)lid ) ); - } - - if ( docxRunProperties.Lang->EastAsia.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[docxRunProperties.Lang->EastAsia]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid1_80, (unsigned char*)lid ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid1, (unsigned char*)lid ) ); - } - - if ( docxRunProperties.Lang->Bidi.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[docxRunProperties.Lang->Bidi]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCLidBi, (unsigned char*)lid ) ); - } - } - - if ( docxRunProperties.Spacing.is_init() ) - { - short CDxaSpace = ASCDocFileFormat::XAS( *docxRunProperties.Spacing ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCDxaSpace, (unsigned char*)&CDxaSpace ) ); - } - - if ( docxRunProperties.Index.is_init() ) - { - string index = docxRunProperties.Index->ToString(); - unsigned char CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptNormalText; - - if ( index == string( "superscript" ) ) - { - CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptSuperscript; - } - else if ( index == string( "subscript" ) ) - { - CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptSubscript; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCIss, (unsigned char*)&CIss ) ); - } - - if ( docxRunProperties.Kern.is_init() ) - { - int kern = *docxRunProperties.Kern; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsKern, (unsigned char*)&kern ) ); - } - - if ( docxRunProperties.Position.is_init() ) - { - int position = *docxRunProperties.Position; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsPos, (unsigned char*)&position ) ); - } - - if ( docxRunProperties.Scale.is_init() ) - { - unsigned short scale = *docxRunProperties.Scale; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCCharScale, (unsigned char*)&scale ) ); - } - - if ( docxRunProperties.Border.is_init() ) - { - DOCXDOCUTILS::CTblBorders oBorder; - map& oBrcMap = oBorder.GetBrcMap (); - - unsigned int brc80 = (unsigned int)ASCDocFileFormat::Brc80( - docxRunProperties.Border->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxRunProperties.Border->Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxRunProperties.Border->Bdr->Color.get_value_or_default()), - docxRunProperties.Border->Bdr->Space.get_value_or_default(), - false, - false ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCBrc80, (unsigned char*)(&brc80) ) ); - - ASCDocFileFormat::BrcOperand brcOperand( ASCDocFileFormat::Brc( - ASCDocFileFormat::COLORREF( HexString2Int( docxRunProperties.Border->Bdr->Color.get_value_or_default().ToString() ) ), - docxRunProperties.Border->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxRunProperties.Border->Bdr->Value], - docxRunProperties.Border->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCBrc, (unsigned char*)brcOperand ) ); - } - - return docRunProperties; - } - - const PrlList CFileTransformer::ConvertParagraphProperties(const OOX::Logic::ParagraphProperty& docxParagraphProperties) - { - PrlList docParagraphProperties; - - if ( docxParagraphProperties.Align.is_init() ) - { - unsigned char justification = DOCXDOCUTILS::AlignFromString (docxParagraphProperties.Align->ToStringW()); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPJc, &justification ) ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPJc80, &justification ) ); - } - - if ( docxParagraphProperties.Shading.is_init() && docxParagraphProperties.Shading->fill.is_init() ) - { - int colorIntValue = 0; - int fillAuto = 0x00; - - if ( *docxParagraphProperties.Shading->fill == "auto" ) - { - fillAuto = ASCDocFileFormat::COLORREF::cvAuto; - } - else - { - colorIntValue = HexString2Int( *docxParagraphProperties.Shading->fill ); - } - - ASCDocFileFormat::SHDOperand shdOperand( ASCDocFileFormat::Shd( ASCDocFileFormat::COLORREF( (int)( 0 | fillAuto ) ), - ASCDocFileFormat::COLORREF( colorIntValue | fillAuto ), - 0 ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPShd, shdOperand ) ); - } - - if ( docxParagraphProperties.Spacing.is_init() ) - { - if ( docxParagraphProperties.Spacing->After.is_init() ) - { - unsigned short pDyaAfter = (unsigned short)(*docxParagraphProperties.Spacing->After); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDyaAfter, (unsigned char*)(&pDyaAfter) ) ); - } - - if ( docxParagraphProperties.Spacing->Before.is_init() ) - { - unsigned short pDyaBefore = (unsigned short)(*docxParagraphProperties.Spacing->Before); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDyaBefore, (unsigned char*)(&pDyaBefore) ) ); - } - - if ( ( docxParagraphProperties.Spacing->Line.is_init() ) && ( docxParagraphProperties.Spacing->LineRule.is_init() ) ) - { - bool lineRule = false; - short line = 0; - - line = (short)(*docxParagraphProperties.Spacing->Line); - - if ( *docxParagraphProperties.Spacing->LineRule == string( "exact" ) ) - { - line = -line; - } - else if ( *docxParagraphProperties.Spacing->LineRule == string( "auto" ) ) - { - lineRule = true; - } - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDyaLine, (unsigned char*)ASCDocFileFormat::LSPD( line, lineRule ) ) ); - } - - if ( docxParagraphProperties.Spacing->BeforeAutospacing.is_init() ) - { - Bool8 beforeAutospacing = 0x00; - - if ( *docxParagraphProperties.Spacing->BeforeAutospacing ) - { - beforeAutospacing = 0x01; - } - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFDyaBeforeAuto, &beforeAutospacing ) ); - } - - if ( docxParagraphProperties.Spacing->AfterAutospacing.is_init() ) - { - Bool8 afterAutospacing = 0x00; - - if ( *docxParagraphProperties.Spacing->AfterAutospacing ) - { - afterAutospacing = 0x01; - } - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFDyaAfterAuto, &afterAutospacing ) ); - } - } - - if ( docxParagraphProperties.Ind.is_init() ) - { - if ( docxParagraphProperties.Ind->Left.is_init() ) - { - short pDxaLeft = ASCDocFileFormat::XAS( (short)(*docxParagraphProperties.Ind->Left) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft, (unsigned char*)(&pDxaLeft) ) ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft80, (unsigned char*)(&pDxaLeft) ) ); - } - - if ( docxParagraphProperties.Ind->Right.is_init() ) - { - short pDxaRight = ASCDocFileFormat::XAS( (short)(*docxParagraphProperties.Ind->Right) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaRight, (unsigned char*)(&pDxaRight) ) ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaRight80, (unsigned char*)(&pDxaRight) ) ); - } - - if ( docxParagraphProperties.Ind->Hanging.is_init() ) - { - short pDxaLeft1 = ( ( ASCDocFileFormat::XAS( (short)(*docxParagraphProperties.Ind->Hanging) ) ) * ( -1 ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft1, (unsigned char*)(&pDxaLeft1) ) ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft180, (unsigned char*)(&pDxaLeft1) ) ); - } - - if ( docxParagraphProperties.Ind->FirstLine.is_init() ) - { - short pDxaLeft1 = ASCDocFileFormat::XAS( (short)(*docxParagraphProperties.Ind->FirstLine) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft1, (unsigned char*)(&pDxaLeft1) ) ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDxaLeft180, (unsigned char*)(&pDxaLeft1) ) ); - } - } - - if (docxParagraphProperties.NumPr.is_init()) - { - if (docxParagraphProperties.NumPr->Ilvl.is_init()) - { - unsigned char pIlvl = (unsigned char)(*docxParagraphProperties.NumPr->Ilvl); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPIlvl, (unsigned char*)(&pIlvl) ) ); - } - - if ( docxParagraphProperties.NumPr->NumId.is_init() ) - { - int nNumID = (*docxParagraphProperties.NumPr->NumId); - SHORT pIlfo = idIndexMap [nNumID]; - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPIlfo, (unsigned char*)(&pIlfo) ) ); - } - } - - if ( docxParagraphProperties.OutlineLvl.is_init() ) - { - unsigned char POutLvl = *docxParagraphProperties.OutlineLvl; - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPOutLvl, &POutLvl ) ); - } - - if ( *docxParagraphProperties.KeepLines ) - { - Bool8 PFKeep = 0x01; - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFKeep, &PFKeep ) ); - } - - if ( *docxParagraphProperties.KeepNext ) - { - Bool8 PFKeepFollow = 0x01; - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFKeepFollow, &PFKeepFollow ) ); - } - - if (*docxParagraphProperties.pageBreakBefore) - { - Bool8 PFPageBreakBefore = 0x01; - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFPageBreakBefore, &PFPageBreakBefore ) ); - } - - if ( *docxParagraphProperties.ContextualSpacing ) - { - Bool8 PFContextualSpacing = 0x01; - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPFContextualSpacing, &PFContextualSpacing ) ); - } - - if ( docxParagraphProperties.ParagraphBorder.is_init() ) - { - DOCXDOCUTILS::CTblBorders oBorder; - map& oBrcMap = oBorder.GetBrcMap (); - - if ( docxParagraphProperties.ParagraphBorder->Top.is_init() ) - { - unsigned int brc80Top = (unsigned int)ASCDocFileFormat::Brc80( docxParagraphProperties.ParagraphBorder->Top->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Top->Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxParagraphProperties.ParagraphBorder->Top->Bdr->Color.get_value_or_default()), - docxParagraphProperties.ParagraphBorder->Top->Bdr->Space.get_value_or_default(), - false, - false ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcTop80, (unsigned char*)(&brc80Top) ) ); - - ASCDocFileFormat::BrcOperand brcOperandTop( ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF( HexString2Int( docxParagraphProperties.ParagraphBorder->Top->Bdr->Color.get_value_or_default().ToString() ) ), - docxParagraphProperties.ParagraphBorder->Top->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Top->Bdr->Value], - docxParagraphProperties.ParagraphBorder->Top->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcTop, (unsigned char*)brcOperandTop ) ); - } - - if ( docxParagraphProperties.ParagraphBorder->Bottom.is_init() ) - { - unsigned int brc80Bottom = (unsigned int)ASCDocFileFormat::Brc80( docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Color.get_value_or_default()), - docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Space.get_value_or_default(), - false, - false ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcBottom80, (unsigned char*)(&brc80Bottom) ) ); - - ASCDocFileFormat::BrcOperand brcOperandBottom( ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF( HexString2Int( docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Color.get_value_or_default().ToString() ) ), - docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Value], - docxParagraphProperties.ParagraphBorder->Bottom->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcBottom, (unsigned char*)brcOperandBottom ) ); - } - - if ( docxParagraphProperties.ParagraphBorder->Left.is_init() ) - { - unsigned int brc80Left = (unsigned int)ASCDocFileFormat::Brc80( docxParagraphProperties.ParagraphBorder->Left->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Left->Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxParagraphProperties.ParagraphBorder->Left->Bdr->Color.get_value_or_default()), - docxParagraphProperties.ParagraphBorder->Left->Bdr->Space.get_value_or_default(), - false, - false ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcLeft80, (unsigned char*)(&brc80Left) ) ); - - ASCDocFileFormat::BrcOperand brcOperandLeft( ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF( HexString2Int( docxParagraphProperties.ParagraphBorder->Left->Bdr->Color.get_value_or_default().ToString() ) ), - docxParagraphProperties.ParagraphBorder->Left->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Left->Bdr->Value], - docxParagraphProperties.ParagraphBorder->Left->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcLeft, (unsigned char*)brcOperandLeft ) ); - } - - if ( docxParagraphProperties.ParagraphBorder->Right.is_init() ) - { - unsigned int brc80Right = (unsigned int)ASCDocFileFormat::Brc80( docxParagraphProperties.ParagraphBorder->Right->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Right->Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxParagraphProperties.ParagraphBorder->Right->Bdr->Color.get_value_or_default()), - docxParagraphProperties.ParagraphBorder->Right->Bdr->Space.get_value_or_default(), - false, - false ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcRight80, (unsigned char*)(&brc80Right) ) ); - - ASCDocFileFormat::BrcOperand brcOperandRight( ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF( HexString2Int( docxParagraphProperties.ParagraphBorder->Right->Bdr->Color.get_value_or_default().ToString() ) ), - docxParagraphProperties.ParagraphBorder->Right->Bdr->Sz.get_value_or_default(), - oBrcMap[*docxParagraphProperties.ParagraphBorder->Right->Bdr->Value], - docxParagraphProperties.ParagraphBorder->Right->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPBrcRight, (unsigned char*)brcOperandRight ) ); - } - } - - if ( docxParagraphProperties.TextFrameProperties.is_init() ) - { - if ( docxParagraphProperties.TextFrameProperties->HAnchor.is_init() && docxParagraphProperties.TextFrameProperties->VAnchor.is_init() ) - { - unsigned char positionCodeOperand = ASCDocFileFormat::PositionCodeOperand( this->verticalPositionCodeMap[*docxParagraphProperties.TextFrameProperties->VAnchor], this->horizontalPositionCodeMap[*docxParagraphProperties.TextFrameProperties->HAnchor] ); - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPPc, &positionCodeOperand ) ); - } - - if ( docxParagraphProperties.TextFrameProperties->Wrap.is_init() ) - { - unsigned char PWr = this->textFrameWrappingMap[*docxParagraphProperties.TextFrameProperties->Wrap]; - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPWr, &PWr ) ); - } - - if ( docxParagraphProperties.TextFrameProperties->X.is_init() ) - { - short PDxaAbs = ASCDocFileFormat::XAS_plusOne ((short)(*docxParagraphProperties.TextFrameProperties->X)); - docParagraphProperties.push_back (ASCDocFileFormat::Prl((short)DocFileFormat::sprmPDxaAbs, (unsigned char*)(&PDxaAbs))); - } - - if ( docxParagraphProperties.TextFrameProperties->Y.is_init() ) - { - short PDyaAbs = ASCDocFileFormat::YAS_plusOne ((short)*docxParagraphProperties.TextFrameProperties->Y); - docParagraphProperties.push_back (ASCDocFileFormat::Prl((short)DocFileFormat::sprmPDyaAbs, (unsigned char*)(&PDyaAbs))); - } - - if ( docxParagraphProperties.TextFrameProperties->H.is_init() ) - { - unsigned short PWHeightAbs = ASCDocFileFormat::YAS_nonNeg ((unsigned short)*docxParagraphProperties.TextFrameProperties->H); - docParagraphProperties.push_back (ASCDocFileFormat::Prl ((short)DocFileFormat::sprmPWHeightAbs, (unsigned char*)(&PWHeightAbs))); - } - - if ( docxParagraphProperties.TextFrameProperties->W.is_init() ) - { - unsigned short PDxaWidth = ASCDocFileFormat::XAS_nonNeg ((unsigned short)*docxParagraphProperties.TextFrameProperties->W); - docParagraphProperties.push_back (ASCDocFileFormat::Prl((short)DocFileFormat::sprmPDxaWidth, (unsigned char*)(&PDxaWidth))); - } - - if ( docxParagraphProperties.TextFrameProperties->HSpace.is_init() ) - { - unsigned short PDxaFromText = ASCDocFileFormat::XAS_nonNeg((unsigned short)*docxParagraphProperties.TextFrameProperties->HSpace); - docParagraphProperties.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmPDxaFromText, (unsigned char*)(&PDxaFromText))); - } - - if ( docxParagraphProperties.TextFrameProperties->VSpace.is_init() ) - { - unsigned short PDyaFromText = ASCDocFileFormat::YAS_nonNeg((unsigned short)*docxParagraphProperties.TextFrameProperties->VSpace); - docParagraphProperties.push_back (ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPDyaFromText, (unsigned char*)(&PDyaFromText))); - } - } - - if ( docxParagraphProperties.Tabs.is_init() ) - { - vector tbds; - vector xass; - - size_t count = (*docxParagraphProperties.Tabs->Tabs).size(); - const std::vector& items = (*docxParagraphProperties.Tabs->Tabs); - - for (size_t i = 0; i < count; ++i) - { - ASCDocFileFormat::Constants::TabJC TabStopAlign = customTabStopAlignment[*(items[i]).Val]; - if (0x05 == (int)TabStopAlign) // 0x05 означает clear, т.е. No Tab Stop - continue; - - ASCDocFileFormat::TBD tbd(TabStopAlign, customTabStopLeader[items[i].Leader.get_value_or_default()]); - tbds.push_back(tbd); - - ASCDocFileFormat::XAS xas((short)(*(items[i]).Pos)); - xass.push_back(xas); - } - - if (xass.size() > 0 && tbds.size() > 0) - { - ASCDocFileFormat::PChgTabsAdd pChgTabsAdd( xass, tbds ); - ASCDocFileFormat::PChgTabsPapxOperand pChgTabsPapxOperand( ASCDocFileFormat::PChgTabsDel(), pChgTabsAdd ); - - docParagraphProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmPChgTabsPapx, (unsigned char*)pChgTabsPapxOperand ) ); - } - } - - return docParagraphProperties; - } -} - -namespace DOCXTODOC // LEVELS -{ - void CFileTransformer::ConvertNumbering(const OOX::Numbering& numbering) - { - if ((0 == numbering.AbstractNums.size()) || (0 == numbering.Nums.size())) - return; - - ASCDocFileFormat::PlfLst plfLst(ConvertAbstractNums(numbering.AbstractNums)); - vector lvls = ConvertLVLs(numbering, numbering.AbstractNums); - ASCDocFileFormat::ListFormattingInformation lfi(plfLst, lvls); - - m_pDocFile->SetListFormattingInformation(lfi); - m_pDocFile->SetListFormattingOverrideInformation(ConvertNums(numbering.Nums)); - } - - const vector CFileTransformer::ConvertAbstractNums (const vector& arrNums) - { - // Fill LSTF ( The LSTF structure contains formatting properties that apply to an entire list. ) - - vector arrLSTF; - - int nId = 1; // уникальный индентификатор для списка, любое число от 1 ~ 0xFFFFFFFF - - size_t count = arrNums.size(); - for (size_t j = 0; j < count; ++j) - { - const OOX::Numbering::AbstractNum& number = arrNums[j]; - - if (number.Nsid.is_init()) - { - nId = HexString2IntW(number.Nsid.get()); - } - else - { - for (map::const_iterator it = idLsidMap.begin(); it != idLsidMap.end(); ++it) - { - nId = __max(it->second, nId); - } - - ++nId; - } - - idLsidMap.insert(make_pair(number.Id.get(), nId)); - - ASCDocFileFormat::Tplc* tplc = ASCDocFileFormat::TplcFactory::CreateTplc(HexString2IntW(number.Tmpl.get())); - - bool fSimpleList = false; - bool fAutoNum = false; - bool fHybrid = false; - - if (number.MultiLevelType.IsInit()) - { - if ((number.MultiLevelType.get()) == std::wstring(L"hybridMultilevel")) - fHybrid = true; - } - - if (number.MultiLevelType.IsInit()) - { - if ((number.MultiLevelType.get()) == std::wstring(L"singleLevel")) - fSimpleList = true; - } - - arrLSTF.push_back (ASCDocFileFormat::LSTF (nId, tplc, fSimpleList, fAutoNum, fHybrid, ASCDocFileFormat::grfhic(), NULL /*!!!TODO!!!*/)); - - RELEASEOBJECT(tplc); - } - - return arrLSTF; - } - - const vector CFileTransformer::ConvertLVLs(const OOX::Numbering& numbering, const vector& arAbstractNums) - { - vector oLevels; - - size_t numsCount = arAbstractNums.size(); - for (size_t j = 0; j < numsCount; ++j) - { - const OOX::Numbering::AbstractNum& oAbstractNum = arAbstractNums[j]; - size_t levCount = oAbstractNum.Levels.size(); - for (size_t i = 0; i < levCount; ++i) - { - const OOX::Numbering::Level& oLevel = oAbstractNum.Levels[i]; - oLevels.push_back (ConvertLVL(oLevel)); - } - - // - if (0 == levCount) - { - if (oAbstractNum.numStyleLink.is_init()) - { - int nInd = FindAbstractNumIdWithStyleRef(numbering, oAbstractNum.numStyleLink.get()); - if ((nInd >= 0) && (nInd < (int)numsCount)) - { - for (size_t i = 0; i < numsCount; ++i) - { - const OOX::Numbering::AbstractNum& oFindNum = arAbstractNums[i]; - if (oFindNum.Id.is_init()) - { - if (nInd == oFindNum.Id.get()) - { - size_t levCount = oFindNum.Levels.size(); - for (size_t m = 0; m < levCount; ++m) - { - const OOX::Numbering::Level& oLevel = oFindNum.Levels[m]; - oLevels.push_back (ConvertLVL(oLevel)); - } - - break; - } - } - } - } - } - } - } - - return oLevels; - } - - const ASCDocFileFormat::LVL CFileTransformer::ConvertLVL(const OOX::Numbering::Level& _level) - { - ASCDocFileFormat::Constants::MSONFC nfc = this->numFmtMap[_level.NumFmt->ToString()]; - ASCDocFileFormat::Constants::LevelJustification jc = - (ASCDocFileFormat::Constants::LevelJustification) - DOCXDOCUTILS::AlignFromString (_level.Align.get().ToStringW()); - //DOCXDOCUTILS::AlignFromString (_level.Align.get_value_or(OOX::Logic::Align(std::wstring(L"left"))).ToStringW()); - - // bool fTentative = ( ( _level.Tentative.get_value_or( 0 ) == 1 ) ? ( true ) : ( false ) ); - bool fTentative = ( ( _level.Tentative.get() == 1 ) ? ( true ) : ( false ) ); - ASCDocFileFormat::Constants::CharacterFollows ixchFollow = ASCDocFileFormat::Constants::characterFollowsTab; - - if (_level.Suffix.is_init()) - { - if (_level.Suffix.get() == std::wstring(L"tab")) - { - ixchFollow = ASCDocFileFormat::Constants::characterFollowsTab; - } - else if (_level.Suffix == std::wstring(L"space")) - { - ixchFollow = ASCDocFileFormat::Constants::characterFollowsSpace; - } - else - { - ixchFollow = ASCDocFileFormat::Constants::characterFollowsNothing; - } - } - - ASCDocFileFormat::LVLF lvlf(_level.Start.get(), nfc, jc, false, false, false, false, fTentative, ixchFollow, 0, 0, ASCDocFileFormat::grfhic() /*!!!TODO!!!*/ ); - - PrlList grpprlPapx; - PrlList grpprlChpx; - - if ( _level.ParagraphProperty.is_init() ) - { - grpprlPapx = ConvertParagraphProperties( *_level.ParagraphProperty ); - } - - if ( _level.RunProperty.is_init() ) - { - grpprlChpx = ConvertRunProperties( *_level.RunProperty ); - } - - return ASCDocFileFormat::LVL( lvlf, grpprlPapx, grpprlChpx, ConvertLvlText(_level.Text.get(), nfc ) ); - } - - const ASCDocFileFormat::PlfLfo CFileTransformer::ConvertNums(const vector& oXmlNums) - { - vector lfos; - vector lfoDatas; - - short listIndex = 1; - - for (size_t i = 0; i < oXmlNums.size(); ++i) - { - const OOX::Numbering::Num& oXmlNum = oXmlNums[i]; - idIndexMap.insert( make_pair( *oXmlNum.NumId, listIndex++ ) ); - - vector rgLfoLvl; - - for (size_t j = 0; j < oXmlNum.LevelOverrides.size(); ++j) - { - const OOX::Numbering::LevelOverride& levelOverride = oXmlNum.LevelOverrides[j]; - ASCDocFileFormat::LVL lvl; - - bool bHaveLVL = false; - if (levelOverride.Level.is_init()) - { - lvl = ConvertLVL(*levelOverride.Level); - bHaveLVL = true; - } - - int iStartAt = 0; - bool fStartAt = false; - - if (levelOverride.StartOverride.is_init()) - { - iStartAt = levelOverride.StartOverride.get(); - fStartAt = true; - } - - rgLfoLvl.push_back(ASCDocFileFormat::LFOLVL(iStartAt, *levelOverride.Ilvl, fStartAt, ASCDocFileFormat::grfhic(), bHaveLVL ? &lvl : NULL)); - } - - int NumId = idLsidMap[oXmlNum.AbstractNumId.get()]; - - lfos.push_back(ASCDocFileFormat::LFO(NumId, rgLfoLvl.size(), ASCDocFileFormat::Constants::lfoFieldNotUsed00, ASCDocFileFormat::grfhic())); - lfoDatas.push_back(ASCDocFileFormat::LFOData(0xFFFFFFFF, rgLfoLvl)); - } - - return ASCDocFileFormat::PlfLfo(lfos, lfoDatas); - } - - const ASCDocFileFormat::Xst CFileTransformer::ConvertLvlText(const std::wstring& strLvlText, ASCDocFileFormat::Constants::MSONFC oMsoNfc) - { - std::wstring wstr(strLvlText.size(), 0); - utf8_decode(strLvlText.begin(), strLvlText.end(), wstr.begin()); - - if (wstr == std::wstring(L"%1")) - return ASCDocFileFormat::Xst(true); - - std::wstring::iterator result = wstr.begin(); - std::wstring::iterator newResult = wstr.begin(); - - newResult = find( wstr.begin(), wstr.end(), _T( '%' ) ); - wstring docPlaceHolderValue = wstring( wstr.begin(), newResult ); - result = newResult; - - while (result != wstr.end()) - { - newResult = find( ( result + 1 ), wstr.end(), _T( '%' ) ); - if(result + 1 != wstr.end() && result + 2 != wstr.end()) - { - wstring placeHolderString = wstring( ( result + 1 ), ( result + 2 ) ); - int placeHolderValue = _wtoi( placeHolderString.c_str() ); - docPlaceHolderValue += ( placeHolderValue - 1 ); - docPlaceHolderValue += wstring( ( result + 2 ), newResult ); - } - - result = newResult; - } - - unsigned short cch = docPlaceHolderValue.size(); - if (ASCDocFileFormat::Constants::msonfcBullet == oMsoNfc) - cch = 0x0001; - - return ASCDocFileFormat::Xst(docPlaceHolderValue.c_str(), cch); - } - - int CFileTransformer::FindAbstractNumIdWithStyleRef(const OOX::Numbering& numbering, const std::wstring& refLink) - { - const OOX::Styles::Style& oStyle = m_docxInputFile.find().find().GetStyleById(wstring2string__(refLink)); - if (oStyle.ParagraphProperty.is_init()) - { - if (oStyle.ParagraphProperty->NumPr.is_init()) - { - if (oStyle.ParagraphProperty->NumPr->NumId.is_init()) - { - int nInd = oStyle.ParagraphProperty->NumPr->NumId; - size_t length = numbering.Nums.size(); - for (size_t i = 0; i < length; ++i) - { - if (nInd == numbering.Nums[i].NumId.get()) - { - return numbering.Nums[i].AbstractNumId.get(); - } - } - } - } - } - - return -1; - } -} - -namespace DOCXTODOC // STYLES -{ - void CFileTransformer::ConvertStyleSheet(const OOX::Styles& oStyleSheet) - { - vector mpstiilsd; - - //if ( _styleSheet.LattentStyles.is_init() ) - mpstiilsd = ConvertLatentStyles( /**_styleSheet.LattentStyles*/ ); - - vector rglpstd = ConvertStyleDefinitions (*oStyleSheet.Named); - - short ftcAsci = 0; - short ftcFE = 0; - short ftcOther = 0; - - if (oStyleSheet.Default->RunProperty->rFonts.is_init() ) - { - if (oStyleSheet.Default->RunProperty->rFonts->ascii.is_init() ) - ftcAsci = m_mapFontTableMap [string2wstring__(oStyleSheet.Default->RunProperty->rFonts->ascii)]; - - if (oStyleSheet.Default->RunProperty->rFonts->Cs.is_init() ) - ftcFE = m_mapFontTableMap [string2wstring__(oStyleSheet.Default->RunProperty->rFonts->Cs)]; - - if (oStyleSheet.Default->RunProperty->rFonts->hAnsi.is_init() ) - ftcOther = m_mapFontTableMap [string2wstring__(oStyleSheet.Default->RunProperty->rFonts->hAnsi)]; - } - - ASCDocFileFormat::Stshif stshif (rglpstd.size(), true, mpstiilsd.size(), ftcAsci, ftcFE, ftcOther); - ASCDocFileFormat::StshiLsd stshiLsd (mpstiilsd); - - // MUST be ignored. - ASCDocFileFormat::LPStshiGrpPrl grpprlChpStandard (ConvertRunProperties(*oStyleSheet.Default->RunProperty)); - ASCDocFileFormat::LPStshiGrpPrl grpprlPapStandard (ConvertParagraphProperties(*oStyleSheet.Default->ParagraphProperty)); - ASCDocFileFormat::STSHIB stshib (grpprlChpStandard, grpprlPapStandard); - - ASCDocFileFormat::LPStshi lpStshi (ASCDocFileFormat::STSHI(stshif, 0, stshiLsd, stshib)); - - m_pDocFile->SetStyleSheet (ASCDocFileFormat::STSH(lpStshi, rglpstd)); - } - - std::vector CFileTransformer::ConvertStyleDefinitions (const vector& arrStyles) - { - vector styleDefinitions(15); - short styleIndex = 15; - - for (size_t i = 0; i < arrStyles.size(); ++i) - { - const OOX::Styles::Style& oXmlStyle = arrStyles[i]; - - unsigned short sti = predefinedStyleIDMap[*oXmlStyle.StyleId]; - short istd = DOCXDOCUTILS::StiToIstd ((short)sti); - - if ( istd == -1 ) - istd = styleIndex++; - - m_mapStyleSheetMap.insert(pair(oXmlStyle.StyleId,istd)); - } - - for (size_t i = 0; i < arrStyles.size(); ++i) - { - const OOX::Styles::Style& oXmlStyle = arrStyles[i]; - unsigned short sti = predefinedStyleIDMap[*oXmlStyle.StyleId]; - short istd = DOCXDOCUTILS::StiToIstd ((short)sti); - - ASCDocFileFormat::Constants::StyleType styleType; - map::const_iterator findResult = styleTypeMap.find( *oXmlStyle.Type ); - if ( findResult != styleTypeMap.end() ) - styleType = findResult->second; - else - styleType = ASCDocFileFormat::Constants::styleTypeCharacter; - - unsigned short istdBase = 0x0FFF; - unsigned short istdNext = 0x0000; - ASCDocFileFormat::StdfPost2000 StdfPost2000OrNone; - - if ( oXmlStyle.BasedOn.is_init() ) - { - istdBase = m_mapStyleSheetMap[*oXmlStyle.BasedOn]; - } - - if ( oXmlStyle.Next.is_init() ) - { - istdNext = m_mapStyleSheetMap[*oXmlStyle.Next]; - } - - if ( ( oXmlStyle.Link.is_init() ) && ( oXmlStyle.UiPriority.is_init() ) ) - { - //!!!TODO: Revision!!! - StdfPost2000OrNone = ASCDocFileFormat::StdfPost2000( (unsigned short)m_mapStyleSheetMap[*oXmlStyle.Link], false, 0, (unsigned short)(*oXmlStyle.UiPriority) ); - } - - ASCDocFileFormat::GRFSTD grfstd( false, false, false, false, false, *oXmlStyle.SemiHidden, false, *oXmlStyle.UnhideWhenUsed, *oXmlStyle.QFormat ); - ASCDocFileFormat::StdfBase stdfBase( sti, styleType, istdBase, istdNext, grfstd ); - - std::wstring styleName( ( oXmlStyle.name->size() ), 0 ); - utf8_decode( oXmlStyle.name->begin(), oXmlStyle.name->end(), styleName.begin() ); - - ASCDocFileFormat::LPUpxPapx lPUpxPapx; - ASCDocFileFormat::LPUpxChpx lPUpxChpx; - ASCDocFileFormat::LPUpxTapx lPUpxTapx; - - CXmlPropertyReader oXmlReader; - - if (oXmlStyle.ParagraphProperty.is_init()) - lPUpxPapx = ASCDocFileFormat::LPUpxPapx (ASCDocFileFormat::UpxPapx(istd, oXmlReader.GetParagraphStyleProperties (ConvertParagraphProperties(*oXmlStyle.ParagraphProperty)) )); - - if (oXmlStyle.RunProperty.is_init()) - lPUpxChpx = ASCDocFileFormat::LPUpxChpx( ASCDocFileFormat::UpxChpx (oXmlReader.GetRunStyleProperties( ConvertRunProperties(*oXmlStyle.RunProperty)) )); - - if (oXmlStyle.tblPr.is_init()) - lPUpxTapx = ASCDocFileFormat::LPUpxTapx(ASCDocFileFormat::UpxTapx(oXmlReader.GetTableStyleProperties( ConvertTableProperties(*oXmlStyle.tblPr)) )); - - ASCDocFileFormat::GrLPUpxSw grLPUpxSw (styleType, lPUpxPapx, lPUpxChpx, lPUpxTapx); - ASCDocFileFormat::LPStd lPStd (ASCDocFileFormat::STD(ASCDocFileFormat::Stdf(stdfBase, &StdfPost2000OrNone), - ASCDocFileFormat::Xstz(ASCDocFileFormat::Xst(styleName.c_str())), grLPUpxSw)); - if (-1 != istd) - { - styleDefinitions[istd] = lPStd; - } - else - { - styleDefinitions.push_back( lPStd ); - } - } - - return styleDefinitions; - } - - std::vector CFileTransformer::ConvertLatentStyles() - { - vector latentStylesDatas; - - for ( unsigned int i = 0; i < ( sizeof(ASCDocFileFormat::LatentStylesTemplate) / sizeof(ASCDocFileFormat::LatentStylesTemplate[0]) ); i++ ) - latentStylesDatas.push_back( ASCDocFileFormat::LSD( ASCDocFileFormat::LatentStylesTemplate[i] ) ); - - return latentStylesDatas; - } - - std::string CFileTransformer::GetStyleID(const OOX::Logic::Paragraph& oXmlParagraph) - { - std::string strStyleID; - - if (oXmlParagraph.Property.is_init() && oXmlParagraph.Property->PStyle.is_init()) - { - strStyleID = (*oXmlParagraph.Property->PStyle); - } - else - { - const OOX::Styles::Style defaultStyle = m_docxInputFile.find().find().GetDefaultStyle ("paragraph"); - strStyleID = (*defaultStyle.StyleId); - - if (0 == strStyleID.length()) - { - const OOX::Styles::Style oStyle = m_docxInputFile.find().find().GetStyleWithTypeAndName ("paragraph", "Normal"); - strStyleID = (*oStyle.StyleId); - } - } - - return strStyleID; - } -} - -namespace DOCXTODOC -{ - // настройки страниц документа - ASCDocFileFormat::SectionProperties CFileTransformer::ConvertSectionProperties(const OOX::Logic::SectorProperty& docxSectionProperties) - { - PrlList docSectionProperties; - - unsigned short SXaPage = *docxSectionProperties.PageSize->Width; - unsigned short SYaPage = *docxSectionProperties.PageSize->Height; - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSXaPage, (unsigned char*)&SXaPage ) ); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSYaPage, (unsigned char*)&SYaPage ) ); - - if ( docxSectionProperties.Type.is_init() ) - { - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSBkc, (unsigned char*)&(sectionBreakTypeMap[*docxSectionProperties.Type]) ) ); - } - - if ( docxSectionProperties.PageSize->Orient.is_init() ) - { - unsigned char SBOrientation = (unsigned char)ASCDocFileFormat::Constants::dmOrientPortrait; - - if ( *docxSectionProperties.PageSize->Orient == string( "portrait" ) ) - { - SBOrientation = (unsigned char)ASCDocFileFormat::Constants::dmOrientPortrait; - } - else if ( *docxSectionProperties.PageSize->Orient == string( "landscape" ) ) - { - SBOrientation = (unsigned char)ASCDocFileFormat::Constants::dmOrientLandscape; - } - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSBOrientation, (unsigned char*)&SBOrientation ) ); - } - - unsigned short SDxaLeft = ASCDocFileFormat::XAS_nonNeg( *docxSectionProperties.PageMargin->Left ); - unsigned short SDxaRight = ASCDocFileFormat::XAS_nonNeg( *docxSectionProperties.PageMargin->Right ); - short SDyaTop = ASCDocFileFormat::YAS( *docxSectionProperties.PageMargin->Top ); - short SDyaBottom = ASCDocFileFormat::YAS( *docxSectionProperties.PageMargin->Bottom ); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDxaLeft, (unsigned char*)&SDxaLeft ) ); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDxaRight, (unsigned char*)&SDxaRight ) ); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDyaTop, (unsigned char*)&SDyaTop ) ); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDyaBottom, (unsigned char*)&SDyaBottom ) ); - - if ( docxSectionProperties.PageMargin->Gutter.is_init() ) - { - unsigned short SDzaGutter = (unsigned short)(*docxSectionProperties.PageMargin->Gutter); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDzaGutter, (unsigned char*)&SDzaGutter ) ); - } - - if ( docxSectionProperties.PageMargin->Header.is_init() ) - { - unsigned short SDyaHdrTop = ASCDocFileFormat::YAS_nonNeg(*docxSectionProperties.PageMargin->Header); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDyaHdrTop, (unsigned char*)&SDyaHdrTop ) ); - } - - if ( docxSectionProperties.PageMargin->Footer.is_init() ) - { - unsigned short SDyaHdrBottom = ASCDocFileFormat::YAS_nonNeg(*docxSectionProperties.PageMargin->Footer); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDyaHdrBottom, (unsigned char*)&SDyaHdrBottom ) ); - } - - if ( docxSectionProperties.Columns.is_init() ) - { - if ( docxSectionProperties.Columns->Num.is_init() ) - { - unsigned short SCcolumns = ( *docxSectionProperties.Columns->Num - 1 ); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSCcolumns, (unsigned char*)&SCcolumns ) ); - } - - if ( docxSectionProperties.Columns->Space.is_init() ) - { - unsigned short SDxaColumns = (unsigned short)ASCDocFileFormat::XAS_nonNeg( (unsigned short)(*docxSectionProperties.Columns->Space) ); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDxaColumns, (unsigned char*)&SDxaColumns ) ); - } - - unsigned char index = 0; - - size_t count = (*docxSectionProperties.Columns->Items).size(); - const std::vector& items = (*docxSectionProperties.Columns->Items); - - for (size_t i = 0; i < count; ++i) - { - ASCDocFileFormat::SDxaColWidthOperand SDxaColWidth(index, ASCDocFileFormat::XAS_nonNeg( (unsigned short)(*(items[i]).Width))); - - docSectionProperties.push_back( ASCDocFileFormat::Prl((short)DocFileFormat::sprmSDxaColWidth, (unsigned char*)SDxaColWidth)); - - if (items[i].Space.is_init()) - { - //TODO: - - ASCDocFileFormat::SDxaColSpacingOperand SDxaColSpacing( index, ASCDocFileFormat::XAS_nonNeg( (unsigned short)(*items[i].Space) ) ); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDxaColSpacing, (unsigned char*)SDxaColSpacing ) ); - } - - ++index; - } - } - - if ( docxSectionProperties.DocumentGrid.is_init() ) - { - if ( docxSectionProperties.DocumentGrid->LinePitch.is_init() ) - { - short SDyaLinePitch = ASCDocFileFormat::YAS( *docxSectionProperties.DocumentGrid->LinePitch ); - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDyaLinePitch, (unsigned char*)(&SDyaLinePitch) ) ); - } - - if ( docxSectionProperties.DocumentGrid->CharSpace.is_init() ) - { - int SDxtCharSpace = *docxSectionProperties.DocumentGrid->CharSpace; - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSDxtCharSpace, (unsigned char*)(&SDxtCharSpace) ) ); - } - - if ( docxSectionProperties.DocumentGrid->Type.is_init() ) - { - unsigned short SClm = (unsigned short)ASCDocFileFormat::Constants::clmUseDefault; - - if ( *docxSectionProperties.DocumentGrid->Type == string( "Default" ) ) - { - SClm = (unsigned short)ASCDocFileFormat::Constants::clmUseDefault; - } - else if ( *docxSectionProperties.DocumentGrid->Type == string( "linesAndChars" ) ) - { - SClm = (unsigned short)ASCDocFileFormat::Constants::clmCharsAndLines; - } - else if ( *docxSectionProperties.DocumentGrid->Type == string( "lines" ) ) - { - SClm = (unsigned short)ASCDocFileFormat::Constants::clmLinesOnly; - } - else if ( *docxSectionProperties.DocumentGrid->Type == string( "snapToChars" ) ) - { - SClm = (unsigned short)ASCDocFileFormat::Constants::clmEnforceGrid; - } - - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSClm, (unsigned char*)(&SClm) ) ); - } - } - - if ( docxSectionProperties.FootNoteProperty.is_init() ) - { - unsigned short sNfcFtnRef = (unsigned short)(this->numFmtMap[docxSectionProperties.FootNoteProperty->NumFormat->ToString()]); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSNfcFtnRef, (unsigned char*)(&sNfcFtnRef) ) ); - - unsigned short sNFtn = (unsigned short)(docxSectionProperties.FootNoteProperty->NumStart); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSNFtn, (unsigned char*)(&sNFtn) ) ); - } - - if ( docxSectionProperties.EndNoteProperty.is_init() ) - { - unsigned short sNfcEdnRef = (unsigned short)(this->numFmtMap[docxSectionProperties.EndNoteProperty->NumFormat->ToString()]); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSNfcEdnRef, (unsigned char*)(&sNfcEdnRef) ) ); - - unsigned short sNEdn = (unsigned short)(docxSectionProperties.EndNoteProperty->NumStart); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSNEdn, (unsigned char*)(&sNEdn) ) ); - } - - AddLineNumberingSettings (docxSectionProperties, docSectionProperties); // - - if (*docxSectionProperties.TitlePage) - { - Bool8 SFTitlePage = ( ( *docxSectionProperties.TitlePage ) ? ( 1 ) : ( 0 ) ); - docSectionProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmSFTitlePage, &SFTitlePage ) ); - } - - ASCDocFileFormat::Sepx sepx (docSectionProperties); - ASCDocFileFormat::SectionProperties oSectionProperties (sepx); - - for ( vector::const_iterator headerReferencesIter = docxSectionProperties.Headers->begin(); - headerReferencesIter != docxSectionProperties.Headers->end(); - ++headerReferencesIter ) - { - OOX::Header* pHeader = dynamic_cast(m_docxInputFile.find()[headerReferencesIter->rId].operator->()); - - if (pHeader) - { - if ( headerReferencesIter->Type == "even" ) - { - oSectionProperties.SetEvenPageHeader (ConvertHeader(*pHeader)); - } - else if ( headerReferencesIter->Type == "default" ) - { - oSectionProperties.SetOddPageHeader (ConvertHeader(*pHeader)); - } - else if ( headerReferencesIter->Type == "first" ) - { - oSectionProperties.SetFirstPageHeader (ConvertHeader(*pHeader)); - } - } - } - - for ( vector::const_iterator footerReferencesIter = docxSectionProperties.Footers->begin(); - footerReferencesIter != docxSectionProperties.Footers->end(); - ++footerReferencesIter ) - { - OOX::Footer* pFooter = dynamic_cast(m_docxInputFile.find()[footerReferencesIter->rId].operator->()); - if (pFooter) - { - if ( footerReferencesIter->Type == "even" ) - { - oSectionProperties.SetEvenPageFooter (ConvertFooter(*pFooter)); - } - else if ( footerReferencesIter->Type == "default" ) - { - oSectionProperties.SetOddPageFooter (ConvertFooter(*pFooter)); - } - else if ( footerReferencesIter->Type == "first" ) - { - oSectionProperties.SetFirstPageFooter (ConvertFooter(*pFooter)); - } - } - } - - return oSectionProperties; - } - - bool CFileTransformer::AddLineNumberingSettings(const OOX::Logic::SectorProperty& oSection, PrlList& arrSettings) - { - // Line Numbering Restart Setting - - if (oSection.LnNumType->countBy.is_init()) - { - // Line Number Increments to Display - - short countBy = (unsigned short)(oSection.LnNumType->countBy); - arrSettings.push_back (ASCDocFileFormat::Prl ((short)DocFileFormat::sprmSNLnnMod, (unsigned char*)(&countBy) ) ); - - unsigned short mode = 1; // - if (oSection.LnNumType->restart.is_init()) - { - if ("newPage" == oSection.LnNumType->restart) - mode = 0x00; // DocFileFormat::lncPerPage; - - if ("newSection" == oSection.LnNumType->restart) - mode = 0x01; // DocFileFormat::lncRestart; - - if ("continuous" == oSection.LnNumType->restart) - mode = 0x02; // DocFileFormat::lncContinue; - } - - arrSettings.push_back (ASCDocFileFormat::Prl ((short)DocFileFormat::sprmSLnc, (unsigned char*)(&mode) ) ); - - // Line Numbering Starting Value - - unsigned short start = 0; - if (oSection.LnNumType->start.is_init()) - start = (unsigned short)(oSection.LnNumType->start); - - arrSettings.push_back (ASCDocFileFormat::Prl ((short)DocFileFormat::sprmSLnnMin, (unsigned char*)(&start) ) ); - - return true; - } - - return false; - } - - // верхний колонтитул - ASCDocFileFormat::Header CFileTransformer::ConvertHeader(const OOX::Header& oHeader) - { - m_oOArtBuilder.SetLocation(HEADER_DOCUMENT); - - ASCDocFileFormat::Header docHeader; - - size_t count = oHeader.m_items.size(); - for (size_t i = 0; i < count; ++i) - { - const OOX::Logic::TextItem& oItem = oHeader.m_items[i]; - if (oItem.is()) - { - const OOX::Logic::Paragraph& oMSDocXParagraph = oItem.as(); - if (ValidParagraph(oMSDocXParagraph)) - { - ASCDocFileFormat::Paragraph oMSDocParagraph = ConvertParagraph(oMSDocXParagraph); - docHeader.AddTextItem (oMSDocParagraph); - } - } - else if (oItem.is()) - { - ASCDocFileFormat::Table oMSDocTable = CreateTable(oItem.as()); - docHeader.AddTextItem (oMSDocTable); - } - else if (oItem.is()) - { - const OOX::Logic::SdtContent& oStdC = oItem.as().Content; - - size_t stdCount = oStdC.m_items.size(); - for (size_t j = 0; j < stdCount; ++j) - { - const OOX::Logic::TextItem& oStdItem = oStdC.m_items[j]; - if (oStdItem.is()) - { - const OOX::Logic::Paragraph& oMSDocXParagraph = oStdItem.as(); - if (ValidParagraph(oMSDocXParagraph)) - { - ASCDocFileFormat::Paragraph oMSDocParagraph = ConvertParagraph(oMSDocXParagraph); - docHeader.AddTextItem (oMSDocParagraph); - } - } - else if (oStdItem.is()) - { - ASCDocFileFormat::Table oMSDocTable = CreateTable(oStdItem.as()); - docHeader.AddTextItem (oMSDocTable); - } - } - } - } - - m_oOArtBuilder.SetLocation(MAIN_DOCUMENT); - -#ifdef _DEBUG - // DOCXDOCUTILS::DebugStrPrint (_T("Header : "), docHeader.GetAllText()); -#endif - return docHeader; - } - - // нижний колонтитул - ASCDocFileFormat::Footer CFileTransformer::ConvertFooter(const OOX::Footer& oFooter) - { - m_oOArtBuilder.SetLocation (HEADER_DOCUMENT); - - ASCDocFileFormat::Footer docFooter; - - size_t count = oFooter.m_items.size(); - for (size_t i = 0; i < count; ++i) - { - const OOX::Logic::TextItem& oItem = oFooter.m_items[i]; - if (oItem.is()) - { - const OOX::Logic::Paragraph& oMSDocXParagraph = oItem.as(); - if (ValidParagraph(oMSDocXParagraph)) - { - ASCDocFileFormat::Paragraph oMSDocParagraph = ConvertParagraph(oMSDocXParagraph); - docFooter.AddTextItem (oMSDocParagraph); - } - } - else if (oItem.is()) - { - ASCDocFileFormat::Table oMSDocTable = CreateTable (oItem.as()); - docFooter.AddTextItem (oMSDocTable); - } - else if (oItem.is()) - { - const OOX::Logic::SdtContent& oStdC = oItem.as().Content; - - size_t stdCount = oStdC.m_items.size(); - for (size_t j = 0; j < stdCount; ++j) - { - const OOX::Logic::TextItem& oStdItem = oStdC.m_items[j]; - - if (oStdItem.is()) - { - const OOX::Logic::Paragraph& oMSDocXParagraph = oStdItem.as(); - if (ValidParagraph(oMSDocXParagraph)) - { - ASCDocFileFormat::Paragraph oMSDocParagraph = ConvertParagraph(oMSDocXParagraph); - docFooter.AddTextItem (oMSDocParagraph); - } - } - else if (oStdItem.is()) - { - ASCDocFileFormat::Table oMSDocTable = CreateTable (oStdItem.as()); - docFooter.AddTextItem (oMSDocTable); - } - } - } - } - - m_oOArtBuilder.SetLocation (MAIN_DOCUMENT); - -#ifdef _DEBUG - // DOCXDOCUTILS::DebugStrPrint (_T("Footer : "), docFooter.GetAllText()); -#endif - return docFooter; - } -} - -namespace DOCXTODOC // TABLE -{ - template ASCDocFileFormat::Table CFileTransformer::CreateTable(const OOX::Logic::Table& oXmlTable) - { - static unsigned int tableDepth = 1; - - ASCDocFileFormat::Table table; - - OOX::Styles::Style oTableStyle; - if (oXmlTable.tblPr->Style.is_init()) - { - oTableStyle = m_docxInputFile.find().find().GetStyleById(*oXmlTable.tblPr->Style); - } - - DOCXDOCUTILS::CTblBorders oTblBorders (oXmlTable, oTableStyle); - - int nYC = (int)oXmlTable.Rows->size(); - for (int nY = 0; nY < nYC; ++nY) - { - const OOX::Logic::TableRow& oXmlTableRow = oXmlTable.Rows->operator [](nY); - - ASCDocFileFormat::TableRow tableRow (tableDepth); - - vector xass; - vector tc80s; - - unsigned int cellIndex = 0; - - int nXC = (int)oXmlTableRow.Cells->size(); - for (int nX = 0; nX < nXC; ++nX) - { - const OOX::Logic::TableCell& oXmlCell = oXmlTableRow.Cells->operator[](nX); - - ASCDocFileFormat::TableCell tableCell(tableDepth); - - ASCDocFileFormat::Constants::VerticalMergeFlag vmf = ConvertTableVerticalMergeFlag( oXmlCell.Properties->VMerge ); - - oTblBorders.Append (nX, nY, nXC, nYC, oXmlTable.tblPr->tblBorders, oXmlCell.Properties->tblBorders); - - int nCellWidth = (int)(*oXmlCell.Properties->Width->Width); - if (0.0 == nCellWidth) - { - std::vector columnes = *oXmlTable.tblGrid->Columns; - if ((int)columnes.size () > nX) - { - nCellWidth = static_cast(*(columnes[nX].Width)); - } - } - - ASCDocFileFormat::TC80 tc80( ASCDocFileFormat::TCGRF( - ASCDocFileFormat::Constants::horzMergeNotMerged, - ASCDocFileFormat::Constants::grpfTFlrtb, vmf, - ASCDocFileFormat::Constants::vaTop, - ASCDocFileFormat::Constants::ftsDxa, false, false, false ), - nCellWidth, - oTblBorders.GetTopNillBorder(), oTblBorders.GetLeftNillBorder(), oTblBorders.GetBottomNillBorder(), - oTblBorders.GetRightNillBorder()); - - size_t count = (*oXmlCell.Items).size(); - const std::vector& items = (*oXmlCell.Items); - - for (size_t i = 0; i < count; ++i) - { - if (items[i].is()) - { - const OOX::Logic::Paragraph& oDocxParagraph = items[i].as(); - ASCDocFileFormat::Paragraph oDocParagraph = ConvertParagraph(oDocxParagraph); - tableCell.AddTextItem (oDocParagraph); - - //ASCDocFileFormat::Paragraph oDocParagraph; // ONLY FOR TEST - //tableCell.AddTextItem (oDocParagraph); // ONLY FOR TEST - } - else if (items[i].is()) - { - tableDepth++; - ASCDocFileFormat::Table docTable = CreateTable(items[i].as()); - tableDepth--; - tableCell.AddTextItem(docTable); - } - } - - tc80s.push_back(tc80); - - tableRow.AddCell(tableCell); - ++cellIndex; - } - - xass = BuildXASs( oXmlTable, *oXmlTableRow.Cells ); - - ASCDocFileFormat::TDefTableOperand tdto( oXmlTableRow.Cells->size(), xass, tc80s ); - - tableRow.AddProperty( (short)DocFileFormat::sprmTDefTable, tdto ); - - tableRow.AddProperties(ConvertTableProperties(*oXmlTable.tblPr, oXmlTableRow.Cells->size())); - - if (oXmlTableRow.Properties.is_init()) - { - tableRow.AddProperties(ConvertTableRowProperties(nY,*oXmlTableRow.Properties ) ); - } - - const vector& oBrcs = oTblBorders.GetSpecificationBorders (); - const vector& oBrc80s = oTblBorders.GetDescriptBorders (); - for (size_t i = 0; i < oBrc80s.size(); ++i) - { - tableRow.AddProperty( (short)DocFileFormat::sprmTSetBrc80, oBrc80s[i] ); - tableRow.AddProperty( (short)DocFileFormat::sprmTSetBrc, oBrcs[i] ); - } - - tableRow.AddProperties(ConvertTableRowCellsProperties(oXmlTable, nY, nYC, *oXmlTableRow.Cells,oTableStyle)); - - table.AddRow(tableRow); - - oTblBorders.Clean (); - } - - return table; - } - - PrlList CFileTransformer::ConvertTableProperties(const OOX::Logic::TableProperty& docxTableProperties, unsigned int cellsCount) - { - PrlList docTableProperties; - - DOCXDOCUTILS::CTblBorders oBorder; - - ASCDocFileFormat::TableBordersOperand80 tableBordersOperand80; - ASCDocFileFormat::TableBordersOperand tableBordersOperand; - - if ( docxTableProperties.Style.is_init() ) - { - docTableProperties = GetTablePropertiesFromStyleHierarchy( docxTableProperties.Style ); - - short istd = m_mapStyleSheetMap[*docxTableProperties.Style]; - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTIstd, (unsigned char*)(&istd) ) ); - - if ( istd < (short)m_pDocFile->GetStyleSheet().Count() ) - { - PrlList styleTableProperties = m_pDocFile->GetStyleSheet()[istd].GetProperties(); - - for (PrlList::const_iterator iter = styleTableProperties.begin(); iter != styleTableProperties.end(); ++iter) - { - docTableProperties.push_back( *iter ); - - switch ( iter->GetSprmCode() ) - { - case ( (unsigned short)DocFileFormat::sprmTTableBorders80 ): - { - tableBordersOperand80 = ASCDocFileFormat::TableBordersOperand80( *iter ); - } - break; - - case ( (unsigned short)DocFileFormat::sprmTTableBorders ): - { - tableBordersOperand = ASCDocFileFormat::TableBordersOperand( *iter ); - } - break; - } - } - } - } - - if ( docxTableProperties.Look.is_init() ) - { - ASCDocFileFormat::TLP tlp( ASCDocFileFormat::Constants::itlNone, ASCDocFileFormat::Fatl( HexString2Int( *docxTableProperties.Look ) ) ); - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTTlp, tlp ) ); - } - - if ( docxTableProperties.Width.is_init() ) - { - ASCDocFileFormat::FtsWWidth_Table ftsWWidth_Table (DOCXDOCUTILS::TableWidthUnitsFromString (*docxTableProperties.Width->Type),*docxTableProperties.Width->Width ); - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTTableWidth, ftsWWidth_Table ) ); - } - - unsigned char bAutoFit = 0x01; - if ( docxTableProperties.Layout.is_init() && docxTableProperties.Layout == "fixed") - bAutoFit = 0x00; - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTFAutofit, (unsigned char*)&bAutoFit ) ); - - if ( docxTableProperties.Ind.is_init() ) - { - ASCDocFileFormat::FtsWWidth_Indent tWidthIndent (DOCXDOCUTILS::TableWidthUnitsFromString (docxTableProperties.Ind->Type), (short)docxTableProperties.Ind->Width); - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTWidthIndent, (unsigned char*)tWidthIndent ) ); - } - - map& oBrcMap = oBorder.GetBrcMap (); - - if (docxTableProperties.tblBorders.is_init()) - { - if (docxTableProperties.tblBorders->top.is_init()) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilTop = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetTopBorder(Brc80MayBeNilTop); - - std::string strColor = docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcTop = ASCDocFileFormat::Brc(ASCDocFileFormat::COLORREF(HexString2Int(strColor)), - docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->top.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetTopBorder(brcTop); - } - - if ( docxTableProperties.tblBorders->bottom.is_init() ) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilBottom = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetBottomBorder(Brc80MayBeNilBottom); - - std::string strColor = docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcBottom = ASCDocFileFormat::Brc(ASCDocFileFormat::COLORREF(HexString2Int(strColor)), - docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->bottom.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetBottomBorder( brcBottom ); - } - - if ( docxTableProperties.tblBorders->left.is_init() ) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilLeft = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetLeftBorder( Brc80MayBeNilLeft ); - - std::string strColor = docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcLeft = ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF(HexString2Int(strColor)), - docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->left.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetLeftBorder( brcLeft ); - } - - if ( docxTableProperties.tblBorders->right.is_init() ) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilRight = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetRightBorder( Brc80MayBeNilRight ); - - std::string strColor = docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcRight = ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF(HexString2Int(strColor)), - docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->right.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetRightBorder( brcRight ); - } - - if ( docxTableProperties.tblBorders->insideH.is_init() ) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilInsideH = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetHorizontalInsideBorder( Brc80MayBeNilInsideH ); - - std::string strColor = docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcInsideH = ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF(HexString2Int(strColor)), - docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->insideH.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetHorizontalInsideBorder( brcInsideH ); - } - - if ( docxTableProperties.tblBorders->insideV.is_init() ) - { - ASCDocFileFormat::Brc80MayBeNil Brc80MayBeNilInsideV = ASCDocFileFormat::Brc80MayBeNil( docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Value], - DOCXDOCUTILS::ColorToIco (docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Color.get_value_or_default()), - docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand80.SetVerticalInsideBorder( Brc80MayBeNilInsideV ); - - std::string strColor = docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Color.get_value_or_default().ToString(); - if (std::string("auto") == strColor) - strColor = std::string ("000000"); - - ASCDocFileFormat::Brc brcInsideV = ASCDocFileFormat::Brc( ASCDocFileFormat::COLORREF( HexString2Int(strColor) ), - docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Sz.get_value_or_default(), - oBrcMap[docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Value], - docxTableProperties.tblBorders->insideV.get_value_or_default().Bdr->Space.get_value_or_default(), - false, - false ); - - tableBordersOperand.SetVerticalInsideBorder( brcInsideV ); - } - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTTableBorders80, (unsigned char*)tableBordersOperand80 ) ); - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTTableBorders, (unsigned char*)tableBordersOperand ) ); - } - - if ( docxTableProperties.CellMar.is_init() ) - { - if ( docxTableProperties.CellMar->Top.is_init() ) - { - ASCDocFileFormat::CSSAOperand cssaOperandTop( ASCDocFileFormat::CSSA( ASCDocFileFormat::ItcFirstLim( 0, cellsCount ), - ASCDocFileFormat::Constants::fbrcTop, - DOCXDOCUTILS::TableWidthUnitsFromString (docxTableProperties.CellMar->Top->Margin->Type), - docxTableProperties.CellMar->Top->Margin->W ) ); - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTCellPadding, (unsigned char*)cssaOperandTop ) ); - } - - if ( docxTableProperties.CellMar->Left.is_init() ) - { - ASCDocFileFormat::CSSAOperand cssaOperandLeft( ASCDocFileFormat::CSSA( ASCDocFileFormat::ItcFirstLim( 0, cellsCount ), - ASCDocFileFormat::Constants::fbrcLeft, - DOCXDOCUTILS::TableWidthUnitsFromString (docxTableProperties.CellMar->Left->Margin->Type), - docxTableProperties.CellMar->Left->Margin->W ) ); - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTCellPadding, (unsigned char*)cssaOperandLeft ) ); - } - - if ( docxTableProperties.CellMar->Bottom.is_init() ) - { - ASCDocFileFormat::CSSAOperand cssaOperandBottom( ASCDocFileFormat::CSSA( ASCDocFileFormat::ItcFirstLim( 0, cellsCount ), - ASCDocFileFormat::Constants::fbrcBottom, - DOCXDOCUTILS::TableWidthUnitsFromString (docxTableProperties.CellMar->Bottom->Margin->Type), - docxTableProperties.CellMar->Bottom->Margin->W ) ); - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTCellPadding, (unsigned char*)cssaOperandBottom ) ); - } - - if ( docxTableProperties.CellMar->Right.is_init() ) - { - ASCDocFileFormat::CSSAOperand cssaOperandRight( ASCDocFileFormat::CSSA( ASCDocFileFormat::ItcFirstLim( 0, cellsCount ), - ASCDocFileFormat::Constants::fbrcRight, - DOCXDOCUTILS::TableWidthUnitsFromString (docxTableProperties.CellMar->Right->Margin->Type), - docxTableProperties.CellMar->Right->Margin->W ) ); - - docTableProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTCellPadding, (unsigned char*)cssaOperandRight ) ); - } - } - - return docTableProperties; - } - - vector CFileTransformer::BuildXASs(const OOX::Logic::Table& oXmlTable, const vector& tableCells) - { - std::vector resultXASs; - - resultXASs.push_back( ASCDocFileFormat::XAS( 0 ) ); //!!!TODO!!! - - int nSpanLineOff = 0; - - for (size_t i = 0; i < tableCells.size(); ++i) - { - const OOX::Logic::TableCell& oXmlTblCell = tableCells[i]; - - //Если ширина 0, то выставляем ширину gc_nZeroWidth, как это делаем word когда к пустой таблице применяется автоподбор по содержимому - int nCellWidth = (int)(*oXmlTblCell.Properties->Width->Width); - if (nCellWidth <= 0) - { - int nColInd = nSpanLineOff + i; - std::vector oXmlColumnes = (*oXmlTable.tblGrid->Columns); - if ((int)oXmlColumnes.size() > nColInd) - { - nCellWidth = static_cast(*(oXmlColumnes[nColInd].Width)); - } - else - { - nCellWidth = ASCDocFormatUtils::gc_nZeroWidth; - } - } - - if (oXmlTblCell.Properties->GridSpan.is_init()) - { - std::vector oXmlColumnes = (*oXmlTable.tblGrid->Columns); - - int nColsSize = (int)oXmlColumnes.size(); - int nXmlSpan = oXmlTblCell.Properties->GridSpan; - int nToMerge = min(nXmlSpan + (int)i + nSpanLineOff,nColsSize); - - nCellWidth = 0; - - for (int j = i + nSpanLineOff; j < nToMerge; ++j) - { - nCellWidth += static_cast(*(oXmlColumnes[j].Width)); - } - - if (nCellWidth <= 0) - nCellWidth = ASCDocFormatUtils::gc_nZeroWidth; - - //if (0 == nSpanLineOff) - --nXmlSpan; - - nSpanLineOff += nXmlSpan; - } - - resultXASs.push_back(ASCDocFileFormat::XAS(nCellWidth + resultXASs.back())); - } - - return resultXASs; - } - - // - const PrlList CFileTransformer::ConvertTableRowProperties(int nY, const OOX::Logic::TableRowProperties& oXmlRow) - { - PrlList oPrls; - - short tableRowHeight = 0; - - if ( oXmlRow.Height->Type.is_init() && ( *oXmlRow.Height->Type == "exact" ) ) - { - tableRowHeight = ASCDocFileFormat::YAS( *oXmlRow.Height->Height * ( -1 ) ); - } - else - { - tableRowHeight = ASCDocFileFormat::YAS( *oXmlRow.Height->Height ); - } - - oPrls.push_back(ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTDyaRowHeight, (unsigned char*)(&tableRowHeight))); - - return oPrls; - } - - const PrlList CFileTransformer::ConvertTableRowCellsProperties(const OOX::Logic::Table& oXmlTable, int nY, int nCY, const vector& arrXmlCells, const OOX::Styles::Style& oStyle) - { - PrlList arCellsPrls; - - DOCXDOCUTILS::CTblFill oTblFill (oXmlTable, oStyle); - - int nCX = arrXmlCells.size(); - - for (int nX = 0; nX < nCX; ++nX) - { - const OOX::Logic::TableCell& oXmlCell = arrXmlCells[nX]; - - oTblFill.AddCell (nX, nY, nCX-1, nCY-1, oXmlCell.Properties->Shading); - - ASCDocFileFormat::TableCellWidthOperand tableCellWidthOperand( ASCDocFileFormat::ItcFirstLim( nX, ( nX + 1 ) ), ASCDocFileFormat::FtsWWidth_TablePart( tableCellWidthMap[*oXmlCell.Properties->Width->Type], (unsigned short)(*oXmlCell.Properties->Width->Width) ) ); - arCellsPrls.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTCellWidth, tableCellWidthOperand ) ); - - if(oXmlCell.Properties->CellMar.is_init()) - { - const OOX::Logic::TCMar& oTCMar = oXmlCell.Properties->CellMar; - if (oTCMar.Top.is_init()) - arCellsPrls.push_back (DOCXDOCUTILS::GetOpTop(oTCMar, nCX)); - - if (oTCMar.Left.is_init()) - arCellsPrls.push_back (DOCXDOCUTILS::GetOpLeft(oTCMar, nCX)); - - if (oTCMar.Right.is_init()) - arCellsPrls.push_back (DOCXDOCUTILS::GetOpRight(oTCMar, nCX)); - - if (oTCMar.Bottom.is_init()) - arCellsPrls.push_back (DOCXDOCUTILS::GetOpBottom(oTCMar, nCX)); - } - - if ( oXmlCell.Properties->VAlign.is_init() ) - { - ASCDocFileFormat::Constants::VerticalAlign verticalAlign = ASCDocFileFormat::Constants::vaTop; - - if ( *oXmlCell.Properties->VAlign == "top" ) - { - verticalAlign = ASCDocFileFormat::Constants::vaTop; - } - else if ( *oXmlCell.Properties->VAlign == "center" ) - { - verticalAlign = ASCDocFileFormat::Constants::vaCenter; - } - else if ( *oXmlCell.Properties->VAlign == "bottom" ) - { - verticalAlign = ASCDocFileFormat::Constants::vaBottom; - } - - ASCDocFileFormat::CellRangeVertAlign cellRangeVertAlign( ASCDocFileFormat::ItcFirstLim( nX, ( nX + 1 ) ), verticalAlign ); - - arCellsPrls.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmTVertAlign, cellRangeVertAlign ) ); - } - } - - if (oTblFill.GetShd22().size()) - { - ASCDocFileFormat::DefTableShdOperand defOperand(oTblFill.GetShd22()); - - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShd, defOperand)); - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShdRaw, defOperand)); - } - - if (oTblFill.GetShd44().size()) - { - ASCDocFileFormat::DefTableShdOperand defOperand(oTblFill.GetShd44()); - - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShd, defOperand)); - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShdRaw, defOperand)); - } - - if (oTblFill.GetShd63().size()) - { - ASCDocFileFormat::DefTableShdOperand defOperand(oTblFill.GetShd63()); - - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShd, defOperand)); - arCellsPrls.push_back(ASCDocFileFormat::Prl((short)DocFileFormat::sprmTDefTableShdRaw, defOperand)); - } - - return arCellsPrls; - } -} - -namespace DOCXTODOC // FONTS -{ - void CFileTransformer::AddInternalFont(const std::wstring& strFontName) - { - // шрифт может не содержаться в таблице шрифтов, а определен прямо по ходу текста - - std::map::const_iterator findResult = m_mapFontTableMap.find(strFontName); - if (findResult == m_mapFontTableMap.end()) - { - m_mapFontTableMap.insert(pair(strFontName, m_mapFontTableMap.size())); - - m_arrInternalFonts.push_back(strFontName); - } - } - - void CFileTransformer::ConvertFontTable(const OOX::FontTable& oFontTable) - { - vector ffns; - - for (size_t i = 0; i < oFontTable.m_fonts.size(); ++i) - { - const OOX::FontTable::Font& oFont = oFontTable.m_fonts[i]; - - ASCDocFileFormat::FFID ffid(DOCXDOCUTILS::FontPitchFromString(oFont.m_pitch.get()), true, DOCXDOCUTILS::FontFamilyFromString(oFont.m_family.get())); - - //!!!TODO!!! - short wWeight = 400; - - FONTSIGNATURE fs; - - fs.fsCsb[0] = HexString2IntW(oFont.m_csb0.get()); - fs.fsCsb[1] = HexString2IntW(oFont.m_csb1.get()); - fs.fsUsb[0] = HexString2IntW(oFont.m_usb0.get()); - fs.fsUsb[1] = HexString2IntW(oFont.m_usb1.get()); - fs.fsUsb[2] = HexString2IntW(oFont.m_usb2.get()); - fs.fsUsb[3] = HexString2IntW(oFont.m_usb3.get()); - - ASCDocFileFormat::FFN ffn (ffid, wWeight, - DOCXDOCUTILS::FontCharsetFromString(oFont.m_charset.get()), - ConvertPanose(oFont.m_panose1.get()), fs, oFont.m_name.get()); - - ffns.push_back(ffn); - } - - for (size_t i = 0; i < m_arrInternalFonts.size(); ++i) - { - ASCDocFileFormat::FFID ffid (DOCXDOCUTILS::FontPitchFromString(std::wstring(L"")), true, DOCXDOCUTILS::FontFamilyFromString(std::wstring(L"auto"))); - - //!!!TODO!!! - short wWeight = 400; - - FONTSIGNATURE fs; - - fs.fsCsb[0] = 0; - fs.fsCsb[1] = 0; - fs.fsUsb[0] = 0; - fs.fsUsb[1] = 0; - fs.fsUsb[2] = 0; - fs.fsUsb[3] = 0; - - ASCDocFileFormat::FFN ffn (ffid, wWeight, - DOCXDOCUTILS::FontCharsetFromString (std::wstring(L"")), - ConvertPanose(std::wstring(L"")), fs, m_arrInternalFonts[i]); - - ffns.push_back(ffn); - } - - m_pDocFile->SetFontTable(ASCDocFileFormat::STTB(false, &ffns)); - } - - ASCDocFileFormat::PANOSE CFileTransformer::ConvertPanose(const std::wstring& strPanose) - { - if (20 == strPanose.size()) - { - unsigned char bFamilyType = HexString2IntW(std::wstring((strPanose.begin() ), ( strPanose.begin() + 2 ) ) ); - unsigned char bSerifStyle = HexString2IntW(std::wstring((strPanose.begin() + 2 ), ( strPanose.begin() + 4 ) ) ); - unsigned char bWeight = HexString2IntW(std::wstring((strPanose.begin() + 4 ), ( strPanose.begin() + 6 ) ) ); - unsigned char bProportion = HexString2IntW(std::wstring((strPanose.begin() + 6 ), ( strPanose.begin() + 8 ) ) ); - unsigned char bContrast = HexString2IntW(std::wstring((strPanose.begin() + 8 ), ( strPanose.begin() + 10 ) ) ); - unsigned char bStrokeVariation = HexString2IntW(std::wstring((strPanose.begin() + 10 ), ( strPanose.begin() + 12 ) ) ); - unsigned char bArmStyle = HexString2IntW(std::wstring((strPanose.begin() + 12 ), ( strPanose.begin() + 14 ) ) ); - unsigned char bLetterform = HexString2IntW(std::wstring((strPanose.begin() + 14 ), ( strPanose.begin() + 16 ) ) ); - unsigned char bMidline = HexString2IntW(std::wstring((strPanose.begin() + 16 ), ( strPanose.begin() + 18 ) ) ); - unsigned char bHeight = HexString2IntW(std::wstring((strPanose.begin() + 18 ), ( strPanose.end() ) ) ); - - return ASCDocFileFormat::PANOSE (bFamilyType, bSerifStyle, bWeight, bProportion, bContrast, bStrokeVariation, bArmStyle, bLetterform, bMidline, bHeight); - } - - return ASCDocFileFormat::PANOSE(); - } -} - -namespace DOCXTODOC // run rule transform -{ - template ASCDocFileFormat::Run CFileTransformer::ConvertRun(const OOX::Logic::Run& oXml, const PrlList& styleDocRunProperties, std::wstring& strRunType) - { - ASCDocFileFormat::Run oBinRun; - for (vector::const_iterator iter = oXml.Items->begin(); iter != oXml.Items->end(); ++iter) - { - if (iter->is()) - BreakXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - TabXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - FootnoteReferenceXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - FootnoteRefXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - EndnoteReferenceXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - EndnoteRefXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - TextXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - FldCharXmlRunTransform (iter->as(),oBinRun,strRunType); - else if (iter->is()) - InstrTextXmlRunTransform (iter->as(),oBinRun,strRunType); - else if (iter->is()) - DrawingXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - PictXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - SymbolXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - DelTextXmlRunTransform(iter->as(),oBinRun); - else if (iter->is()) - { - /// TODO - } - } - - oBinRun.AddProperties(ConvertRunProperties(m_docxInputFile.find().find().Default->RunProperty)); - - if (oXml.Property.is_init()) - { - if (oXml.Property->RStyle.is_init()) - { - //!!!TODO!!! - //short istd = m_mapStyleSheetMap[*oXml.Property->RStyle]; - //oBinRun.AddProperty( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCIstd, (unsigned char*)&istd ) ); - - PrlList styleDocRunProperties = GetRunPropertiesFromStyleHierarchy(*oXml.Property->RStyle); - oBinRun.AddOrReplaceProperties( styleDocRunProperties ); - } - else - { - const OOX::Styles::Style defaultStyle = m_docxInputFile.find().find().GetDefaultStyle("character"); - oBinRun.AddOrReplaceProperties (GetRunPropertiesFromStyleHierarchy(*defaultStyle.StyleId)); - } - } - - oBinRun.AddOrReplaceProperties(styleDocRunProperties); - - if (oXml.Property.is_init()) - { - oBinRun.AddOrReplaceProperties(ConvertRunProperties(*oXml.Property)); - } - - return oBinRun; - } - - // - template bool CFileTransformer::FldCharXmlRunTransform(const OOX::Logic::FldChar& oXml, ASCDocFileFormat::Run& oBinRun, std::wstring& strRunType) - { - std::wstring fldCharType = FormatUtils::UTF8Decode (*oXml.FldCharType); - if (fldCharType.empty()) - return FALSE; - - ASCDocFileFormat::FldChar oFldChar(fldCharType); - - strRunType = fldCharType; - - if (oFldChar.CharType() == ASCDocFileFormat::FldChar::FldCharSeparate) - { - oFldChar.SetFieldCharacterProperties((unsigned char)ASCDocFileFormat::grffldEnd(true, true, true, true, true, true, true, true)); - m_bHaveSeparateFldChar = true; - } - - if (oFldChar.CharType() == ASCDocFileFormat::FldChar::FldCharEnd) - { - oFldChar.SetFieldCharacterProperties((unsigned char)ASCDocFileFormat::grffldEnd(false, false, true, true, false, false, false, m_bHaveSeparateFldChar)); - m_bHaveSeparateFldChar = false; - } - - oBinRun.AddRunItem (oFldChar); - - return TRUE; - } - - template bool CFileTransformer::TextXmlRunTransform(const OOX::Logic::Text& oXml, ASCDocFileFormat::Run& oBinRun) - { - ASCDocFileFormat::Text oText(FormatUtils::UTF8Decode(oXml.toTxt()).c_str()); - oBinRun.AddRunItem (oText); - - return TRUE; - } - - template bool CFileTransformer::InstrTextXmlRunTransform(const OOX::Logic::InstrText& oXml, ASCDocFileFormat::Run& oBinRun, std::wstring& strRunType) - { - std::wstring strText = FormatUtils::UTF8Decode(oXml.Text.get_value_or_default()); - - std::wstring Source; - std::wstring FieldCode = DOCXDOCUTILS::GetInstrText_FieldCode(strText, Source); - if (FieldCode.empty()) - return FALSE; - - strRunType = FieldCode; - - oBinRun.AddRunItem(ASCDocFileFormat::Text(strText)); - - return TRUE; - } - - template bool CFileTransformer::DrawingXmlRunTransform(const OOX::Logic::Drawing& oXml, ASCDocFileFormat::Run& oBinRun) - { - OOX::Image* pImage = GetImageDOCX (&oXml); - if (pImage) - { - if (oXml.haveAnchor) - { - return m_oOArtBuilder.BuildImageRun (*pImage, oXml, oBinRun); - } - - std::wstring sFileName = pImage->GetPath(); - if (sFileName.length()) - { - Unit twWidth = *oXml.Inline->Extent->Size->Width; - Unit twHeight = *oXml.Inline->Extent->Size->Height; - - ASCDocFileFormat::Picture oPicture (sFileName, twWidth, twHeight); - if (oPicture.IsValid()) - { - oBinRun.AddRunItem (oPicture); - return TRUE; - } - } - } - - return FALSE; - } - - template bool CFileTransformer::PictXmlRunTransform(const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (oXml.group.is_init()) - return PictGroupXmlTransform(oXml, oBinRun); - - // фигура имеет заливку текстурой - - if (CreateTextureFillShape(oXml, oBinRun)) - return TRUE; - - CShapeRun oShapeRun; - if (m_oOArtBuilder.BuildShapeRun(oXml, oShapeRun)) - { - BuildContentTbRef (oXml); - - if (oShapeRun.IsInline()) - { - m_oInlineShape.RemoveAllRuns(); - - // TODO : сделать нормальное сорхранение Inline фигур (разобраться с недокументированым форматом сохранения объекта) - - //m_oInlineShape.SetShape (oShapeRun); - //ASCDocFileFormat::Picture oPicture (std::wstring(L""), 0, 0, 0, 0); // fake image - //m_oInlineShape.SetPicture (oPicture); - //m_oInlineShape.AddRun (ASCDocFileFormat::Run(ASCDocFileFormat::Picture (std::wstring(L""), 0, 0, 0, 0)));// fake image - //m_oInlineShape.AddRun (ASCDocFileFormat::Run(oShapeRun));// fake image - - //m_oInlineShape.AddRun (ASCDocFileFormat::Run(ASCDocFileFormat::CInlineShape (oShapeRun) )); // fake image - //m_oInlineShape.AddRun (ASCDocFileFormat::Run(oShapeRun)); - //m_oInlineShape.AddRun (ASCDocFileFormat::Run(ASCDocFileFormat::CShapeRun())); - - //m_bIsInlineShape = TRUE; - - // TODO : временное решение для Inline Shape - объектов (бинарный парсер доделать) - - oBinRun.AddRunItem (ASCDocFileFormat::CInlineShape (oShapeRun) ); - m_bIsInlineShape = FALSE; - - return TRUE; - } - else - { - oBinRun.AddRunItem(oShapeRun); - - m_bIsInlineShape = FALSE; - - return TRUE; - } - } - else - { - m_bIsInlineShape = FALSE; - - if (CreateImage(oXml, oBinRun)) - { - return TRUE; - } - - return FALSE; - } - - return TRUE; - } - template bool CFileTransformer::DelTextXmlRunTransform(const OOX::Logic::DelText& oXml, ASCDocFileFormat::Run& oBinRun) - { - ASCDocFileFormat::Text oText( FormatUtils::UTF8Decode( oXml.toTxt() ).c_str() ); - oBinRun.AddRunItem(oText); - - return TRUE; - } - template bool CFileTransformer::SymbolXmlRunTransform(const OOX::Logic::Symbol& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (oXml.Font.is_init() && oXml.Char.is_init()) - { - ASCDocFileFormat::Text oSymbol ((wchar_t)TextMark::Symbol); - oBinRun.AddRunItem(oSymbol); - - ASCDocFileFormat::CSymbolOperand oSymbolOp (m_mapFontTableMap[string2wstring__(*oXml.Font)], HexString2Int(*oXml.Char)); - oBinRun.AddProperty(ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCSymbol, oSymbolOp)); - - return TRUE; - } - - return FALSE; - } - - template bool CFileTransformer::BreakXmlRunTransform(const OOX::Logic::Break& oXml, ASCDocFileFormat::Run& oBinRun) - { - /// TODO - - ASCDocFileFormat::Text oText; - - if ( oXml.Type.is_init() ) - { - if ( *oXml.Type == std::string( "page" ) ) - { - oText.SetText( &TextMark::PageBreakOrSectionMark ); - } - else if ( *oXml.Type == std::string( "column" ) ) - { - oText.SetText( &TextMark::ColumnBreak ); - } - else if ( *oXml.Type == std::string( "textWrapping" ) ) - { - oText.SetText( &TextMark::HardLineBreak ); - } - } - else - { - oText.SetText( &TextMark::HardLineBreak ); - } - - oBinRun.AddRunItem(oText); - - return TRUE; - } - - template bool CFileTransformer::TabXmlRunTransform(const OOX::Logic::Tab& oXml, ASCDocFileFormat::Run& oBinRun) - { - /// TODO - - ASCDocFileFormat::Text oText; - oText.SetText(&TextMark::Tab); - - oBinRun.AddRunItem(oText); - - return TRUE; - } - - template bool CFileTransformer::FootnoteReferenceXmlRunTransform(const OOX::Logic::FootnoteReference& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (m_docxInputFile.find().exist()) - { - static short footnoteIndex = 1; - - const OOX::FootNote::Note& footNote = m_docxInputFile.find().find().find(oXml); - - ASCDocFileFormat::FootnoteReference docFootnoteReference( footnoteIndex ); - ASCDocFileFormat::Footnote docFootnote( footnoteIndex++ ); - - size_t count = (*footNote.Items).size(); - const std::vector& items = (*footNote.Items); - - for (size_t i = 0; i < count; ++i) - { - if (items[i].is()) - { - const OOX::Logic::Paragraph& docxParagraph = items[i].as(); - - ASCDocFileFormat::Paragraph oParagraph = ConvertParagraph(docxParagraph); - docFootnote.AddTextItem (oParagraph); - } - else if (items[i].is()) - { - ASCDocFileFormat::Table oTable = CreateTable(items[i].as()); - docFootnote.AddTextItem (oTable); - } - } - - oBinRun.AddRunItem (docFootnoteReference); - m_pDocFile->AddFootnote(docFootnote); - - return TRUE; - } - - return FALSE; - } - - template bool CFileTransformer::FootnoteRefXmlRunTransform(const OOX::Logic::FootnoteRef& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (m_docxInputFile.find().exist()) - { - static short footnoteIndex = 1; - - oBinRun.AddRunItem(ASCDocFileFormat::FootnoteRef(footnoteIndex++)); - - return TRUE; - } - - return FALSE; - } - - template bool CFileTransformer::EndnoteReferenceXmlRunTransform(const OOX::Logic::EndnoteReference& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (m_docxInputFile.find().exist()) - { - static short endnoteIndex = 1; - - const OOX::EndNote::Note& endNote = m_docxInputFile.find().find().find(oXml); - - ASCDocFileFormat::EndnoteReference docEndnoteReference(endnoteIndex); - ASCDocFileFormat::Endnote docEndnote(endnoteIndex++); - - size_t count = (*endNote.Items).size(); - const std::vector& items = (*endNote.Items); - - for (size_t j = 0; j < count; ++j) - { - if (items[j].is()) - { - const OOX::Logic::Paragraph& docxParagraph = items[j].as(); - - ASCDocFileFormat::Paragraph oParagraph = ConvertParagraph(docxParagraph); - docEndnote.AddTextItem(oParagraph); - } - else if (items[j].is()) - { - ASCDocFileFormat::Table oTable = CreateTable(items[j].as()); - docEndnote.AddTextItem(oTable); - } - } - - oBinRun.AddRunItem( docEndnoteReference ); - m_pDocFile->AddEndnote( docEndnote ); - - return TRUE; - } - - return FALSE; - } - - template bool CFileTransformer::EndnoteRefXmlRunTransform(const OOX::Logic::EndnoteRef& oXml, ASCDocFileFormat::Run& oBinRun) - { - if (m_docxInputFile.find().exist()) - { - static short endnoteIndex = 1; - - oBinRun.AddRunItem(ASCDocFileFormat::EndnoteRef(endnoteIndex++)); - - return TRUE; - } - - return FALSE; - } - template bool CFileTransformer::PictGroupXmlTransform(const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun) - { - ASCDocFileFormat::COArtStorage* pStorage = ASCDocFileFormat::COArtStorage::Instance(); - if (NULL == pStorage) - return FALSE; - - ASCDocFileFormat::COArtGroup* pShapes = CreateGroup(oXml.group); - if (NULL == pShapes) - return FALSE; - - oBinRun.AddRunItem(m_oOArtBuilder.BuildGroupRun(oXml.group,pShapes)); - return TRUE; - } -} - -namespace DOCXTODOC -{ - template OOX::Image* CFileTransformer::GetImageDOCX(const TXmlImage* pXmlImage) - { - if (pXmlImage) - { - bool bFindOK = FALSE; - OOX::RId nID; - - if (typeid(TXmlImage) == typeid(OOX::Logic::Drawing)) - { - OOX::Logic::Drawing* pPicture = (OOX::Logic::Drawing*)(pXmlImage); - if (pPicture) - { - if (pPicture->Inline->Graphic->Pic->rId.is_init()) - { - nID = pPicture->Inline->Graphic->Pic->rId; - bFindOK = TRUE; - } - } - } - - if (typeid(TXmlImage) == typeid(OOX::Logic::Pict)) - { - OOX::Logic::Pict* pPicture = (OOX::Logic::Pict*)(pXmlImage); - if (pPicture) - { - if(pPicture->shape.is_init()) - { - if (pPicture->shape->imageData.is_init()) - { - nID = pPicture->shape->imageData->rId; - bFindOK = TRUE; - } - } - } - } - - if (typeid(TXmlImage) == typeid(OOX::Logic::Shape)) - { - OOX::Logic::Shape* pShape = (OOX::Logic::Shape*)(pXmlImage); - if (pShape) - { - if (pShape->imageData.is_init()) - { - nID = pShape->imageData->rId; - bFindOK = TRUE; - } - } - } - - if (bFindOK) - { - if (typeid(T) != typeid(OOX::Document)) - { - if (m_docxInputFile.find().find().exist(nID)) - return dynamic_cast(m_docxInputFile.find().find()[nID].operator->()); - } - else - { - if (m_docxInputFile.find().exist(nID)) - return dynamic_cast(m_docxInputFile.find()[nID].operator->()); - } - } - } - - return NULL; - } - - template OOX::Image* CFileTransformer::GetImageWithId(const OOX::RId& nID) - { - if (typeid(T) != typeid(OOX::Document)) - { - if (m_docxInputFile.find().find().exist(nID)) - return dynamic_cast(m_docxInputFile.find().find()[nID].operator->()); - } - - if (m_docxInputFile.find().exist(nID)) - return dynamic_cast(m_docxInputFile.find()[nID].operator->()); - - return NULL; - } - - template bool CFileTransformer::CreateImage(const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun) - { - OOX::Image* pImage = GetImageDOCX (&oXml); - - if (pImage) - { - std::wstring sFileName = pImage->GetPath(); - if (sFileName.length()) - { - if (oXml.shape.is_init()) - { - if (oXml.shape->imageData.is_init()) - { - return m_oOArtBuilder.BuildImageRun(oXml.shape, std::wstring(pImage->GetPath()), oBinRun); - } - } - - Unit twWidth = *oXml.shape->style->Size->Width; - Unit twHeight = *oXml.shape->style->Size->Height; - - ASCDocFileFormat::Picture oPicture (sFileName, twWidth, twHeight); - if (oPicture.IsValid()) - { - oBinRun.AddRunItem (ASCDocFileFormat::Picture()); - - return TRUE; - } - } - } - - return FALSE; - } - - template ASCDocFileFormat::COArtGroup* CFileTransformer::CreateGroup(const OOX::Logic::Group& oXmlGroup) - { - ASCDocFileFormat::COArtStorage* pStorage = ASCDocFileFormat::COArtStorage::Instance(); - if (NULL == pStorage) - return FALSE; - - ASCDocFileFormat::COArtGroup* pBinGroup = new ASCDocFileFormat::COArtGroup(pStorage->GenID(m_oOArtBuilder.Location())); - if (NULL == pBinGroup) - return FALSE; - - pBinGroup->SetCoord(DOCX::CFPoint(oXmlGroup.coordorigin, 0.0, 0.0), DOCX::CFPoint(oXmlGroup.coordsize, 0.0, 0.0)); - pBinGroup->SetBounds(oXmlGroup.style); - pBinGroup->SetupFromStyleXml(oXmlGroup.style); - - for (size_t i = 0; i < oXmlGroup.items->size(); ++i) - { - const OOX::Logic::GroupItem& oXmlItem = oXmlGroup.items->operator[](i); - - if (oXmlItem.is()) - { - const OOX::Logic::Oval& shape = oXmlItem.as(); - - if (shape.fillstyle->Id.is_init()) - { - OOX::Image* image = GetImageWithId (OOX::RId(string2wstring__(shape.fillstyle->Id))); - if (image) - { - m_oOArtBuilder.SetTextureFill(image->GetPath()); - } - } - - pBinGroup->Append (m_oOArtBuilder.BuildOArtGroupShape(shape, OfficeArt::Enumerations::msosptEllipse)); - } - - if (oXmlItem.is()) - { - const OOX::Logic::Roundrect& shape = oXmlItem.as(); - - if (shape.fillstyle->Id.is_init()) - { - OOX::Image* image = GetImageWithId (OOX::RId(string2wstring__(shape.fillstyle->Id))); - if (image) - { - m_oOArtBuilder.SetTextureFill(image->GetPath()); - } - } - - pBinGroup->Append (m_oOArtBuilder.BuildOArtGroupShape(oXmlItem.as(), OfficeArt::Enumerations::msosptRoundRectangle)); - } - - if (oXmlItem.is()) - { - const OOX::Logic::Rect& shape = oXmlItem.as(); - - if (shape.fillstyle->Id.is_init()) - { - OOX::Image* image = GetImageWithId (OOX::RId(string2wstring__(shape.fillstyle->Id))); - if (image) - { - m_oOArtBuilder.SetTextureFill(image->GetPath()); - } - } - - pBinGroup->Append (m_oOArtBuilder.BuildOArtGroupShape(oXmlItem.as(), OfficeArt::Enumerations::msosptRectangle)); - } - - if (oXmlItem.is()) - { - pBinGroup->Append (m_oOArtBuilder.BuildOArtGroupShape(oXmlItem.as(), OfficeArt::Enumerations::msosptLine)); - } - - if (oXmlItem.is()) - { - const OOX::Logic::Shape& shape = oXmlItem.as(); - if (shape.imageData.is_init()) - { - OOX::Image* image = GetImageDOCX (&shape); - if (image) - { - //pBinGroup->Append (m_oOArtBuilder.BuildOArtImage(shape, std::wstring(image->filename().GetPath()))); - pBinGroup->Append (m_oOArtBuilder.BuildOArtImage(shape, std::wstring(image->GetPath()))); - } - } - else - { - if (shape.fillstyle->Id.is_init()) - { - OOX::Image* image = GetImageWithId (OOX::RId(string2wstring__(shape.fillstyle->Id))); - if (image) - { - m_oOArtBuilder.SetTextureFill(std::wstring(image->GetPath())); - } - } - - pBinGroup->Append (m_oOArtBuilder.BuildOArtShape(shape, oXmlGroup)); - } - } - - if (oXmlItem.is()) - { - const OOX::Logic::Group& oXmlInGroup = oXmlItem.as(); - pBinGroup->Append (CreateGroup(oXmlInGroup)); - } - } - - if (pBinGroup->IsValid()) - return pBinGroup; - - RELEASEOBJECT(pBinGroup); - return NULL; - } - - template bool CFileTransformer::CreateTextureFillShape(const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun) - { - // фигура имеет заливку текстурой - - // RECT - - if (oXml.rect.is_init()) - { - if (oXml.rect->fillstyle->Id.is_init()) - { - OOX::Image* pImage = GetImageWithId (OOX::RId(string2wstring__(oXml.rect->fillstyle->Id))); - if (pImage) - { - return m_oOArtBuilder.BuildShapeWithTextureFill(oXml.rect, std::wstring(pImage->GetPath()), OfficeArt::Enumerations::msosptRectangle, oXml, oBinRun); - } - - return FALSE; - } - } - - // OVAL - - if (oXml.oval.is_init()) - { - if (oXml.oval->fillstyle->Id.is_init()) - { - OOX::Image* pImage = GetImageWithId (OOX::RId(string2wstring__(oXml.oval->fillstyle->Id))); - if (pImage) - { - return m_oOArtBuilder.BuildShapeWithTextureFill(oXml.oval, std::wstring(pImage->GetPath()), OfficeArt::Enumerations::msosptEllipse, oXml, oBinRun); - } - - return FALSE; - } - } - - // ROUNDRECT - - if (oXml.roundrect.is_init()) - { - if (oXml.roundrect->fillstyle->Id.is_init()) - { - OOX::Image* pImage = GetImageWithId (OOX::RId(string2wstring__(oXml.roundrect->fillstyle->Id))); - if (pImage) - { - return m_oOArtBuilder.BuildShapeWithTextureFill(oXml.roundrect, std::wstring(pImage->GetPath()), OfficeArt::Enumerations::msosptRoundRectangle, oXml, oBinRun); - } - - return FALSE; - } - } - - // SHAPE CUSTOM - - if (oXml.shape.is_init()) - { - if (oXml.shape->fillstyle->Id.is_init()) - { - OOX::Image* pImage = GetImageWithId (OOX::RId(string2wstring__(oXml.shape->fillstyle->Id))); - if (pImage) - { - return m_oOArtBuilder.BuildShapeWithTextureFill(oXml.shape, std::wstring(pImage->GetPath()), 0, oXml, oBinRun); - } - - return FALSE; - } - } - - return FALSE; - } - -} - -namespace DOCXTODOC -{ - bool CFileTransformer::BuildContentTbRef(const OOX::Logic::Pict& oXml) - { - CTextBoxRef* pTbRef = m_oOArtBuilder.LastTbRef (); - if (pTbRef) - { - std::vector oTextItems; - - if (oXml.rect.is_init()) - { - if (oXml.rect->textbox.is_init()) - TransformTb(oXml.rect->textbox->content->items, oTextItems); - } - - if (oXml.oval.is_init()) - { - if (oXml.oval->textbox.is_init()) - TransformTb(oXml.oval->textbox->content->items, oTextItems); - } - - if (oXml.roundrect.is_init()) - { - if (oXml.roundrect->textbox.is_init()) - TransformTb(oXml.roundrect->textbox->content->items, oTextItems); - } - - if (oXml.line.is_init()) - { - if (oXml.line->textbox.is_init()) - TransformTb(oXml.line->textbox->content->items, oTextItems); - } - - if (oXml.shape.is_init()) - { - if (oXml.shape->textbox.is_init()) - TransformTb(oXml.shape->textbox->content->items, oTextItems); - } - - if (oTextItems.size()) - { - pTbRef->AppendTbItems(oTextItems); - return TRUE; - } - } - - return FALSE; - } - - bool CFileTransformer::TransformTb(const std::vector& oXmlItems, std::vector& oTextItems) - { - for (size_t i = 0; i < oXmlItems.size(); ++i) - { - const OOX::Logic::TextItem& oXmlItem = oXmlItems[i]; - - if (oXmlItem.is()) - { - ASCDocFileFormat::Paragraph oBinPr = ConvertParagraph(oXmlItem.as()); - oTextItems.push_back(TextItem(oBinPr)); - } - - if (oXmlItem.is()) - { - ASCDocFileFormat::Table oBinTable = CreateTable(oXmlItem.as()); - oTextItems.push_back(TextItem(oBinTable)); - } - - if (oXmlItem.is()) - { - //const OOX::Logic::SdtContent& content = oXmlItem.as().Content; - //TransformTb(*content.Items, oTextItems); - } - } - - return TRUE; - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.h b/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.h deleted file mode 100644 index 3064d4ea3f..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FileConverter.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "DocFile.h" - -#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h" -//#include "../../Common/DocxFormat/Source/Utility/Parse.h" -#include "../../Common/DocxFormat/Source/Utility/Unit.h" - -#include "InternalElements.h" -#include "TableUtils.h" - -#include "../Common/Callback.h" - -namespace DOCXTODOC -{ - class CPrCopier - { - public: - CPrCopier(PrlList* dest, PrlList* source): m_dest(dest), m_source(source) - { - if ((NULL != m_dest) && (NULL != m_source)) - { - AddOrReplaceProperties(); - } - } - - private: - inline void AddOrReplaceProperties() - { - for (vector::const_iterator iter = m_source->begin(); iter != m_source->end(); ++iter) - { - RemovePropertyByCode(iter->GetSprmCode()); - m_dest->push_back(*iter); - } - } - - inline void RemovePropertyByCode(unsigned short sprm) - { - for (vector::iterator iter = m_dest->begin(); iter != m_dest->end(); ++iter) - { - if (iter->GetSprmCode() == sprm) - { - m_dest->erase(iter); - - RemovePropertyByCode(sprm); - - break; - } - } - } - - private: - - PrlList* m_dest; - PrlList* m_source; - }; - - class CFileTransformer - { - public: - - CFileTransformer (); - ~CFileTransformer(); - - long Convert(const wchar_t* ooxFolder, const wchar_t* docFile, const ProgressCallback* ffCallBack); - - private: - - bool UpdateProgress (const ProgressCallback* ffCallBack, long nComplete); - - void ConvertDocument (const OOX::Document& oXmlDoc); - void ConvertContent (const vector& oItems); - template ASCDocFileFormat::Paragraph ConvertParagraph (const OOX::Logic::Paragraph& oXmlParagraph); - - // Document - std::wstring GetFontNameByThemeName(const std::wstring& themeName); - vector BuildXASs(const OOX::Logic::Table& docxTable, const vector& tableCells); - - bool ValidParagraph (const OOX::Logic::Paragraph& oXmlParagraph); - template ASCDocFileFormat::Hyperlink ConvertHyperlink( const OOX::Logic::Hyperlink& docxHyperlink, const PrlList& styleDocRunProperties); - template void UpdateItemByCondition( T* docItem, const wstring& condition); - - const PrlList ConvertRunProperties (const OOX::Logic::RunProperty& docxRunProperties); - const PrlList ConvertParagraphProperties( const OOX::Logic::ParagraphProperty& docxParagraphProperties); - PrlList ConvertTableProperties( const OOX::Logic::TableProperty& docxTableProperties, unsigned int cellsCount = 0); - - ASCDocFileFormat::Constants::VerticalMergeFlag ConvertTableVerticalMergeFlag( const nullable& vMerge); - - template void ConvertFldSimple( const OOX::Logic::FldSimple& fldSimpleDocx, const PrlList& styleDocRunProperties, ASCDocFileFormat::Paragraph& docParagraph, wstring& runType); - - // настройки страниц документа - - ASCDocFileFormat::SectionProperties ConvertSectionProperties (const OOX::Logic::SectorProperty& oSection); - bool AddLineNumberingSettings (const OOX::Logic::SectorProperty& oSection, PrlList& arrSettings); - - // верхний колонтитул - ASCDocFileFormat::Header ConvertHeader (const OOX::Header& oHeader); - - // нижний колонтитул - ASCDocFileFormat::Footer ConvertFooter (const OOX::Footer& oFooter); - - // Table - - template ASCDocFileFormat::Table CreateTable (const OOX::Logic::Table& oXmlTable); - const PrlList ConvertTableRowCellsProperties(const OOX::Logic::Table& oXmlTable, int nY, int nCY, const vector& docxTableCells, const OOX::Styles::Style& oStyle); - const PrlList ConvertTableRowProperties(int nY, const OOX::Logic::TableRowProperties& oXmlRow); - - // Fonts - - void AddInternalFont(const std::wstring& strFontName); - void ConvertFontTable(const OOX::FontTable& oFontTable); - ASCDocFileFormat::PANOSE ConvertPanose (const std::wstring& strPanose); - - // Styles - - PrlList GetParagraphPropertiesFromStyleHierarchy (const string& styleID, PrlList* styleDocRunLinkProperties); - PrlList GetRunPropertiesFromStyleHierarchy (const string& styleID); - PrlList GetTablePropertiesFromStyleHierarchy (const string& styleID); - - void ConvertStyleSheet (const OOX::Styles& oStyleSheet); - vector ConvertLatentStyles (/*const OOX::Styles::LattentStyles& latentStyles*/); - vector ConvertStyleDefinitions (const vector& arrStyles); - - - std::string GetStyleID (const OOX::Logic::Paragraph& oXmlParagraph); - - // Numbering - - const vector ConvertAbstractNums (const vector& arrNums); - const vector ConvertLVLs (const OOX::Numbering& numbering, const vector& _abstractNums); - const ASCDocFileFormat::LVL ConvertLVL (const OOX::Numbering::Level& _level); - const ASCDocFileFormat::Xst ConvertLvlText (const std::wstring& _lvlText, ASCDocFileFormat::Constants::MSONFC _nfc); - void ConvertNumbering (const OOX::Numbering& _numbering); - const ASCDocFileFormat::PlfLfo ConvertNums (const vector& _nums); - int FindAbstractNumIdWithStyleRef (const OOX::Numbering& numbering, const std::wstring& refLink); - - // run rule transform - template ASCDocFileFormat::Run ConvertRun(const OOX::Logic::Run& oXml, const PrlList& styleDocRunProperties, std::wstring& strRunType); - template bool TextXmlRunTransform (const OOX::Logic::Text& oXml, ASCDocFileFormat::Run& oBinRun); - template bool FldCharXmlRunTransform (const OOX::Logic::FldChar& oXml, ASCDocFileFormat::Run& oBinRun, std::wstring& strRunType); - template bool InstrTextXmlRunTransform (const OOX::Logic::InstrText& oXml, ASCDocFileFormat::Run& oBinRun, std::wstring& strRunType); - template bool DrawingXmlRunTransform (const OOX::Logic::Drawing& oDrawing, ASCDocFileFormat::Run& oBinRun); - template bool PictXmlRunTransform (const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun); - template bool DelTextXmlRunTransform (const OOX::Logic::DelText& oXml, ASCDocFileFormat::Run& oBinRun); - template bool SymbolXmlRunTransform (const OOX::Logic::Symbol& oXml, ASCDocFileFormat::Run& oBinRun); - template bool BreakXmlRunTransform (const OOX::Logic::Break& oXml, ASCDocFileFormat::Run& oBinRun); - template bool TabXmlRunTransform (const OOX::Logic::Tab& oXml, ASCDocFileFormat::Run& oBinRun); - template bool FootnoteReferenceXmlRunTransform (const OOX::Logic::FootnoteReference& oXml, ASCDocFileFormat::Run& oBinRun); - template bool FootnoteRefXmlRunTransform (const OOX::Logic::FootnoteRef& oXml, ASCDocFileFormat::Run& oBinRun); - template bool EndnoteReferenceXmlRunTransform (const OOX::Logic::EndnoteReference& oXml, ASCDocFileFormat::Run& oBinRun); - template bool EndnoteRefXmlRunTransform (const OOX::Logic::EndnoteRef& oXml, ASCDocFileFormat::Run& oBinRun); - - // Images - - template OOX::Image* GetImageDOCX (const TXmlImage* pXmlImage); - template bool CreateImage (const OOX::Logic::Pict& oPicture, ASCDocFileFormat::Run& oBinRun); - template OOX::Image* GetImageWithId(const OOX::RId& nID); - template bool CreateTextureFillShape (const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun); - - // Group - - template ASCDocFileFormat::COArtGroup* CreateGroup(const OOX::Logic::Group& oXmlGroup); - template bool PictGroupXmlTransform (const OOX::Logic::Pict& oXml, ASCDocFileFormat::Run& oBinRun); - - - // TextBox - - bool BuildContentTbRef (const OOX::Logic::Pict& oXml); - bool TransformTb (const std::vector& oXmlItems, std::vector& oTextItems); - - private: - - std::map m_mapFontTableMap; - std::vector m_arrInternalFonts; - - map lidMap; - map predefinedStyleIDMap; - std::map m_mapStyleSheetMap; - - map styleTypeMap; - map numFmtMap; - map idLsidMap; - map idIndexMap; - map kulMap; - map sectionBreakTypeMap; - map verticalPositionCodeMap; - map horizontalPositionCodeMap; - map textFrameWrappingMap; - map tableCellWidthMap; - map customTabStopAlignment; - map customTabStopLeader; - - Docx::Folder m_docxInputFile; - ASCDocFileFormat::CDocFile* m_pDocFile; - - bool m_bHaveSeparateFldChar; - bool m_bIsInlineShape; - - ASCDocFileFormat::COArtBuilder m_oOArtBuilder; // Office Drawing Binary File Format - Builder - ASCDocFileFormat::InlineShape m_oInlineShape; - - bool m_bIsHaveRunPr; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FldChar.h b/ASCOfficeDocFile_old/DocxDocConverter/FldChar.h deleted file mode 100644 index 4001545a70..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FldChar.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "Constants.h" -#include "Plcfld.h" - -namespace ASCDocFileFormat -{ - static const wchar_t* FldCharTypeBegin = _T("begin"); - static const wchar_t* FldCharTypeSeparate = _T("separate"); - static const wchar_t* FldCharTypeEnd = _T("end"); - - class FldChar : public IRunItem - { - public: - static const unsigned char FldCharBegin = 0x13; - static const unsigned char FldCharSeparate = 0x14; - static const unsigned char FldCharEnd = 0x15; - public: - - FldChar () : fld() - { - text = wstring(&TextMark::FieldBeginMark); - properties.push_back(Prl((short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec))); - } - - explicit FldChar (const wstring& charType, unsigned char grffld = 0) - { - if (charType == wstring (FldCharTypeBegin)) - { - text = wstring (&TextMark::FieldBeginMark); - fld = Fld (FldCharBegin, grffld); - } - - if (charType == wstring (FldCharTypeSeparate)) - { - text = wstring (&TextMark::FieldSeparator); - fld = Fld (FldCharSeparate, grffld); - } - - if (charType == wstring (FldCharTypeEnd)) - { - text = wstring(&TextMark::FieldEndMark); - fld = Fld (FldCharEnd, grffld); - } - - properties.push_back (Prl((short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec))); - } - - virtual ~FldChar() - { - - } - - inline const Fld& GetField() const - { - return fld; - } - - inline unsigned char CharType () const - { - return fld.GetFieldCharacterType(); - } - - inline void SetFieldCharacterProperties (unsigned char grffld) - { - fld.SetProperties(grffld); - } - - // IRunItem - - virtual IVirtualConstructor* New() const - { - return new FldChar(); - } - - virtual IVirtualConstructor* Clone() const - { - return new FldChar(*this); - } - - virtual unsigned long GetTextSize() const - { - return text.size(); - } - - virtual wstring GetAllText() const - { - return text; - } - - virtual vector GetRunProperties() const - { - vector prls; - - for (list::const_iterator iter = properties.begin(); iter != this->properties.end(); ++iter) - prls.push_back( *iter ); - - return prls; - } - - virtual unsigned int PrlSize () const - { - return (unsigned int)properties.size(); - } - - private: - static const unsigned char CFSpec = 1; - - wstring text; - list properties; - Fld fld; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Footer.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Footer.cpp deleted file mode 100644 index 50828f5f0a..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Footer.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Footer.h" - -namespace ASCDocFileFormat -{ - Footer::Footer() : footerItemsOffset(0) - { - Paragraph paragraph; - paragraph.AddParagraphItem( Run() ); - this->textItems.push_back( FooterItemWithOffset( TextItemPtr( static_cast(paragraph.Clone()) ), this->footerItemsOffset ) ); - this->footerItemsOffset += ( sizeof(wchar_t) * paragraph.GetAllText().size() ); - } - - Footer::Footer( const Footer& _footer ) : footerItemsOffset(_footer.footerItemsOffset) - { - for ( list::const_iterator iter = _footer.textItems.begin(); iter != _footer.textItems.end(); iter++ ) - { - this->textItems.push_back( FooterItemWithOffset( TextItemPtr( static_cast( iter->footerItem->Clone() ) ), iter->footerItemOffset ) ); - } - } - - void Footer::AddTextItem( const ITextItem& _textItem ) - { - ITextItem* textItem = static_cast( _textItem.Clone() ); - - if ( !this->textItems.empty() ) - { - list::iterator iter = this->textItems.begin(); - - for ( unsigned int i = 0; i < ( this->textItems.size() - 1 ); i++, iter++ ); - - this->textItems.erase( iter ); - - this->footerItemsOffset -= sizeof(wchar_t); - } - - if ( textItem != NULL ) - { - this->textItems.push_back( FooterItemWithOffset( TextItemPtr( textItem ), this->footerItemsOffset ) ); - this->footerItemsOffset += ( sizeof(wchar_t) * textItem->GetAllText().size() ); - Paragraph paragraph; - paragraph.AddParagraphItem( Run() ); - this->textItems.push_back( FooterItemWithOffset( TextItemPtr( static_cast(paragraph.Clone()) ), this->footerItemsOffset ) ); - this->footerItemsOffset += ( sizeof(wchar_t) * paragraph.GetAllText().size() ); - } - } - - Footer::~Footer() - { - } - - wstring Footer::GetAllText() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += iter->footerItem->GetAllText(); - } - - return allText; - } - - Footer::operator wstring() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += *(iter->footerItem); - } - - return allText; - } - - vector Footer::GetAllParagraphsCopy() const - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector textItemParagraphs = iter->footerItem->GetAllParagraphsCopy(); - - for ( vector::const_iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*textItemParagraphsIter)->Clone() ) ) ); - } - } - - return allParagraphs; - } - - vector Footer::GetAllParagraphs() - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - ITextItem* item = (ITextItem*)iter->footerItem.operator->(); - - vector textItemParagraphs = item->GetAllParagraphs(); - - for ( vector::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( *textItemParagraphsIter ); - } - } - - return allParagraphs; - } - - vector Footer::GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - unsigned int paragraphOffset = 0; - - if ( allParagraphsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector footerItemParagraphsOffsets; - vector footerItemParagraphsProperties = iter->footerItem->GetAllParagraphsProperties( &footerItemParagraphsOffsets ); - - for ( unsigned int i = 0; i < footerItemParagraphsProperties.size(); i++ ) - { - allParagraphsProperties.push_back( footerItemParagraphsProperties[i] ); - allParagraphsOffsets->push_back( paragraphOffset + footerItemParagraphsOffsets[i] ); - } - - paragraphOffset += ( sizeof(wchar_t) * iter->footerItem->GetAllText().size() ); - } - } - - return allParagraphsProperties; - } - - vector Footer::GetAllRunProperties( vector* allRunsOffsets ) const - { - vector allRunsProperties; - unsigned int runOffset = 0; - - if ( allRunsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector footerItemRunsOffsets; - vector footerItemRunsProperties = iter->footerItem->GetAllRunProperties( &footerItemRunsOffsets ); - - for ( unsigned int i = 0; i < footerItemRunsProperties.size(); i++ ) - { - allRunsProperties.push_back( footerItemRunsProperties[i] ); - allRunsOffsets->push_back( runOffset + footerItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->footerItem->GetAllText().size() ); - } - } - - return allRunsProperties; - } - - vector Footer::GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int runOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemRunsOffsets; - vector allTextItemRuns = iter->footerItem->GetAllRunsCopy( &allTextItemRunsOffsets ); - - for ( unsigned int i = 0; i < allTextItemRuns.size(); i++ ) - { - allRuns.push_back( IParagraphItemPtr( static_cast(allTextItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( runOffset + allTextItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->footerItem->GetAllText().size() ); - } - } - - return allRuns; - } - - vector Footer::GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int textItemOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemParagraphItemsOffsets; - vector allTextItemParagraphItems = iter->footerItem->GetAllParagraphItemsCopy( &allTextItemParagraphItemsOffsets ); - - for ( unsigned int i = 0; i < allTextItemParagraphItems.size(); i++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast(allTextItemParagraphItems[i]->Clone()) ) ); - allParagraphItemsOffsets->push_back( textItemOffset + allTextItemParagraphItemsOffsets[i] ); - } - - textItemOffset += ( sizeof(wchar_t) * iter->footerItem->GetAllText().size() ); - } - } - - return allParagraphItems; - } - - IVirtualConstructor* Footer::New() const - { - return new Footer(); - } - - IVirtualConstructor* Footer::Clone() const - { - return new Footer( *this ); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Footer.h b/ASCOfficeDocFile_old/DocxDocConverter/Footer.h deleted file mode 100644 index 71970f10cb..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Footer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Paragraph.h" - -namespace ASCDocFileFormat -{ - class Footer: public ITextItem - { - struct FooterItemWithOffset - { - TextItemPtr footerItem; - unsigned int footerItemOffset; - - FooterItemWithOffset() : footerItem(), footerItemOffset(0) - { - - } - - FooterItemWithOffset(const TextItemPtr& _footerItem, unsigned int _footerItemOffset) : footerItem(_footerItem), footerItemOffset(_footerItemOffset) - { - - } - }; - - private: - list textItems; - unsigned int footerItemsOffset; - - public: - explicit Footer(); - Footer( const Footer& _footer ); - void AddTextItem( const ITextItem& _textItem ); - virtual ~Footer(); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Footnote.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Footnote.cpp deleted file mode 100644 index 7172aa23c9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Footnote.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Footnote.h" - -namespace ASCDocFileFormat -{ - Footnote::Footnote( short _aFtnIdx ) : footnoteItemsOffset(0), aFtnIdx(_aFtnIdx) - { - } - - Footnote::Footnote( const Footnote& _footnote ) : footnoteItemsOffset(_footnote.footnoteItemsOffset), aFtnIdx(_footnote.aFtnIdx) - { - for ( list::const_iterator iter = _footnote.textItems.begin(); iter != _footnote.textItems.end(); iter++ ) - { - this->textItems.push_back( FootnoteItemWithOffset( TextItemPtr( static_cast( iter->footnoteItem->Clone() ) ), iter->footnoteItemOffset ) ); - } - } - - void Footnote::AddTextItem( const ITextItem& _textItem ) - { - ITextItem* textItem = static_cast( _textItem.Clone() ); - - if ( textItem != NULL ) - { - this->textItems.push_back( FootnoteItemWithOffset( TextItemPtr( textItem ), this->footnoteItemsOffset ) ); - this->footnoteItemsOffset += ( sizeof(wchar_t) * textItem->GetAllText().size() ); - } - } - - short Footnote::GetIndex() const - { - return this->aFtnIdx; - } - - Footnote::~Footnote() - { - } - - wstring Footnote::GetAllText() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += iter->footnoteItem->GetAllText(); - } - - return allText; - } - - Footnote::operator wstring() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += *(iter->footnoteItem); - } - - return allText; - } - - vector Footnote::GetAllParagraphsCopy() const - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector textItemParagraphs = iter->footnoteItem->GetAllParagraphsCopy(); - - for ( vector::const_iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*textItemParagraphsIter)->Clone() ) ) ); - } - } - - return allParagraphs; - } - - vector Footnote::GetAllParagraphs() - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - ITextItem* item = (ITextItem*)iter->footnoteItem.operator->(); - - vector textItemParagraphs = item->GetAllParagraphs(); - - for ( vector::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( *textItemParagraphsIter ); - } - } - - return allParagraphs; - } - - vector Footnote::GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - unsigned int paragraphOffset = 0; - - if ( allParagraphsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector footnoteItemParagraphsOffsets; - vector footnoteItemParagraphsProperties = iter->footnoteItem->GetAllParagraphsProperties( &footnoteItemParagraphsOffsets ); - - for ( unsigned int i = 0; i < footnoteItemParagraphsProperties.size(); i++ ) - { - allParagraphsProperties.push_back( footnoteItemParagraphsProperties[i] ); - allParagraphsOffsets->push_back( paragraphOffset + footnoteItemParagraphsOffsets[i] ); - } - - paragraphOffset += ( sizeof(wchar_t) * iter->footnoteItem->GetAllText().size() ); - } - } - - return allParagraphsProperties; - } - - vector Footnote::GetAllRunProperties( vector* allRunsOffsets ) const - { - vector allRunsProperties; - unsigned int runOffset = 0; - - if ( allRunsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector footnoteItemRunsOffsets; - vector footnoteItemRunsProperties = iter->footnoteItem->GetAllRunProperties( &footnoteItemRunsOffsets ); - - for ( unsigned int i = 0; i < footnoteItemRunsProperties.size(); i++ ) - { - allRunsProperties.push_back( footnoteItemRunsProperties[i] ); - allRunsOffsets->push_back( runOffset + footnoteItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->footnoteItem->GetAllText().size() ); - } - } - - return allRunsProperties; - } - - vector Footnote::GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int runOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemRunsOffsets; - vector allTextItemRuns = iter->footnoteItem->GetAllRunsCopy( &allTextItemRunsOffsets ); - - for ( unsigned int i = 0; i < allTextItemRuns.size(); i++ ) - { - allRuns.push_back( IParagraphItemPtr( static_cast(allTextItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( runOffset + allTextItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->footnoteItem->GetAllText().size() ); - } - } - - return allRuns; - } - - vector Footnote::GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int textItemOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemParagraphItemsOffsets; - vector allTextItemParagraphItems = iter->footnoteItem->GetAllParagraphItemsCopy( &allTextItemParagraphItemsOffsets ); - - for ( unsigned int i = 0; i < allTextItemParagraphItems.size(); i++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast(allTextItemParagraphItems[i]->Clone()) ) ); - allParagraphItemsOffsets->push_back( textItemOffset + allTextItemParagraphItemsOffsets[i] ); - } - - textItemOffset += ( sizeof(wchar_t) * iter->footnoteItem->GetAllText().size() ); - } - } - - return allParagraphItems; - } - - IVirtualConstructor* Footnote::New() const - { - return new Footnote(); - } - - IVirtualConstructor* Footnote::Clone() const - { - return new Footnote( *this ); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Footnote.h b/ASCOfficeDocFile_old/DocxDocConverter/Footnote.h deleted file mode 100644 index b4ce1aee65..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Footnote.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ITextItem.h" -#include "FootnoteRef.h" -#include "FootnoteReference.h" -#include "PLC.h" - -namespace ASCDocFileFormat -{ - typedef PLC PlcffndTxt; - typedef PLC PlcffndRef; - - class Footnote : public ITextItem - { - struct FootnoteItemWithOffset - { - TextItemPtr footnoteItem; - unsigned int footnoteItemOffset; - - FootnoteItemWithOffset(): - footnoteItem(), footnoteItemOffset(0) - { - } - - FootnoteItemWithOffset( const TextItemPtr& _footnoteItem, unsigned int _footnoteItemOffset ): - footnoteItem(_footnoteItem), footnoteItemOffset(_footnoteItemOffset) - { - } - }; - - private: - list textItems; - unsigned int footnoteItemsOffset; - short aFtnIdx; - - public: - explicit Footnote( short _aFtnIdx = 0 ); - Footnote( const Footnote& _footnote ); - void AddTextItem( const ITextItem& _textItem ); - short GetIndex() const; - virtual ~Footnote(); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FootnoteRef.h b/ASCOfficeDocFile_old/DocxDocConverter/FootnoteRef.h deleted file mode 100644 index 014bf6512d..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FootnoteRef.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "CSymbolOperand.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class FootnoteRef: public IRunItem - { - private: - static const unsigned char CFSpec = 1; - short aFtnIdx; - - wstring text; - list properties; - - public: - explicit FootnoteRef( short _aFtnIdx = 0, unsigned short _ftc = 0, wchar_t _xchar = 0x0000 ): - aFtnIdx(_aFtnIdx) - { - if ( this->aFtnIdx == 0 ) - { - //!!!TODO!!! - this->properties.push_back( Prl( (short)DocFileFormat::sprmCSymbol, (unsigned char*)CSymbolOperand( _ftc, _xchar ) ) ); - } - else - { - this->text = wstring( &TextMark::AutoNumberedFootnoteReference ); - this->properties.push_back( Prl( (short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec) ) ); - } - } - - FootnoteRef( const FootnoteRef& _footnoteRef ): - aFtnIdx(_footnoteRef.aFtnIdx), text(_footnoteRef.text), properties(_footnoteRef.properties) - { - } - - short GetIndex() const - { - return this->aFtnIdx; - } - - virtual ~FootnoteRef() - { - } - - virtual IVirtualConstructor* New() const - { - return new FootnoteRef(); - } - - virtual IVirtualConstructor* Clone() const - { - return new FootnoteRef(*this); - } - - virtual unsigned long GetTextSize() const - { - return this->text.size(); - } - - virtual wstring GetAllText() const - { - return this->text; - } - - virtual vector GetRunProperties() const - { - vector prls; - - for ( list::const_iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - prls.push_back( *iter ); - } - - return prls; - } - - virtual unsigned int PrlSize () const - { - return (unsigned int)properties.size(); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FootnoteReference.h b/ASCOfficeDocFile_old/DocxDocConverter/FootnoteReference.h deleted file mode 100644 index 44d61a4460..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FootnoteReference.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "CSymbolOperand.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class FootnoteReference: public IRunItem - { - private: - static const unsigned char CFSpec = 1; - short aFtnIdx; - - wstring text; - list properties; - - public: - explicit FootnoteReference( short _aFtnIdx = 0, unsigned short _ftc = 0, wchar_t _xchar = 0x0000 ): - aFtnIdx(_aFtnIdx) - { - if ( this->aFtnIdx == 0 ) - { - //!!!TODO!!! - this->properties.push_back( Prl( (short)DocFileFormat::sprmCSymbol, (unsigned char*)CSymbolOperand( _ftc, _xchar ) ) ); - } - else - { - this->text = wstring( &TextMark::AutoNumberedFootnoteReference ); - this->properties.push_back( Prl( (short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec) ) ); - } - } - - FootnoteReference( const FootnoteReference& _footnoteReference ): - aFtnIdx(_footnoteReference.aFtnIdx), text(_footnoteReference.text), properties(_footnoteReference.properties) - { - } - - short GetIndex() const - { - return this->aFtnIdx; - } - - virtual ~FootnoteReference() - { - } - - virtual IVirtualConstructor* New() const - { - return new FootnoteReference(); - } - - virtual IVirtualConstructor* Clone() const - { - return new FootnoteReference(*this); - } - - virtual unsigned long GetTextSize() const - { - return this->text.size(); - } - - virtual wstring GetAllText() const - { - return this->text; - } - - virtual vector GetRunProperties() const - { - vector prls; - - for ( list::const_iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - prls.push_back( *iter ); - } - - return prls; - } - - virtual unsigned int PrlSize() const - { - return (unsigned int)properties.size(); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/FtsWWidth.h b/ASCOfficeDocFile_old/DocxDocConverter/FtsWWidth.h deleted file mode 100644 index c0d4f7b556..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/FtsWWidth.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class FtsWWidth_Table: public IOperand - { - private: - Constants::Fts ftsWidth; - unsigned short wWidth; - static const unsigned char SIZE_IN_BYTES = 3; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - explicit FtsWWidth_Table( Constants::Fts _ftsWidth, unsigned short _wWidth = 0 ) - { - if ( _ftsWidth == Constants::ftsDxaSys ) - { - this->ftsWidth = Constants::ftsNil; - } - else - { - this->ftsWidth = _ftsWidth; - } - - if ( ( this->ftsWidth == Constants::ftsNil ) || ( this->ftsWidth == Constants::ftsAuto ) ) - { - this->wWidth = 0; - } - else if ( this->ftsWidth == Constants::ftsPercent ) - { - if ( _wWidth > 30000 ) - { - this->wWidth = 30000; - } - else - { - this->wWidth = _wWidth; - } - } - else if ( this->ftsWidth == Constants::ftsDxa ) - { - if ( _wWidth > 31680 ) - { - this->wWidth = 31680; - } - else - { - this->wWidth = _wWidth; - } - } - - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - FtsWWidth_Table( const FtsWWidth_Table& ftsWWidth_Table ): - ftsWidth(ftsWWidth_Table.ftsWidth), wWidth(ftsWWidth_Table.wWidth) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - virtual ~FtsWWidth_Table() - { - } - - virtual unsigned int Size() const - { - return SIZE_IN_BYTES; - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - }; - - class FtsWWidth_TablePart: public IOperand - { - private: - Constants::Fts ftsWidth; - unsigned short wWidth; - static const unsigned char SIZE_IN_BYTES = 3; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - explicit FtsWWidth_TablePart( Constants::Fts _ftsWidth, unsigned short _wWidth = 0 ) - { - if ( _ftsWidth == Constants::ftsDxaSys ) - { - this->ftsWidth = Constants::ftsNil; - } - else if(_ftsWidth == Constants::ftsDxa && 0 == _wWidth) - { - this->ftsWidth = Constants::ftsAuto; - } - else - { - this->ftsWidth = _ftsWidth; - } - - if ( ( this->ftsWidth == Constants::ftsNil ) || ( this->ftsWidth == Constants::ftsAuto ) ) - { - this->wWidth = 0; - } - else if ( this->ftsWidth == Constants::ftsPercent ) - { - if ( _wWidth > 5000 ) - { - this->wWidth = 5000; - } - else - { - this->wWidth = _wWidth; - } - } - else if ( this->ftsWidth == Constants::ftsDxa ) - { - if ( _wWidth > 31680 ) - { - this->wWidth = 31680; - } - else - { - this->wWidth = _wWidth; - } - } - - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - FtsWWidth_TablePart( const FtsWWidth_TablePart& ftsWWidth_TablePart ): - ftsWidth(ftsWWidth_TablePart.ftsWidth), wWidth(ftsWWidth_TablePart.wWidth) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - virtual ~FtsWWidth_TablePart() - { - } - - virtual unsigned int Size() const - { - return SIZE_IN_BYTES; - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - }; - - class FtsWWidth_Indent: public IOperand - { - private: - Constants::Fts ftsWidth; - short wWidth; - static const unsigned char SIZE_IN_BYTES = 3; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - explicit FtsWWidth_Indent( Constants::Fts _ftsWidth, short _wWidth = 0 ) - { - if ( ( _ftsWidth == Constants::ftsPercent ) || ( _ftsWidth == Constants::ftsDxaSys ) ) - { - this->ftsWidth = Constants::ftsNil; - } - else - { - this->ftsWidth = _ftsWidth; - } - - if ( ( this->ftsWidth == Constants::ftsNil ) || ( this->ftsWidth == Constants::ftsAuto ) ) - { - this->wWidth = 0; - } - else if ( this->ftsWidth == Constants::ftsDxa ) - { - if ( _wWidth > 31680 ) - { - this->wWidth = 31680; - } - else if ( _wWidth < -31560 ) - { - this->wWidth = -31560; - } - else - { - this->wWidth = _wWidth; - } - } - - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - FtsWWidth_Indent( const FtsWWidth_Indent& ftsWWidth_Indent ): - ftsWidth(ftsWWidth_Indent.ftsWidth), wWidth(ftsWWidth_Indent.wWidth) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->bytes[0] = this->ftsWidth; - memcpy( ( this->bytes + sizeof(unsigned char) ), &(this->wWidth), sizeof(this->wWidth) ); - } - - virtual ~FtsWWidth_Indent() - { - } - - virtual unsigned int Size() const - { - return SIZE_IN_BYTES; - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/GRFSTD.h b/ASCOfficeDocFile_old/DocxDocConverter/GRFSTD.h deleted file mode 100644 index d1510345d6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/GRFSTD.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union GRFSTD - { - private: - struct - { - unsigned short fAutoRedef:1; - unsigned short fHidden:1; - unsigned short f97LidsSet:1; - unsigned short fCopyLang:1; - unsigned short fPersonalCompose:1; - unsigned short fPersonalReply:1; - unsigned short fPersonal:1; - unsigned short fNoHtmlExport:1; - unsigned short fSemiHidden:1; - unsigned short fLocked:1; - unsigned short fInternalUse:1; - unsigned short fUnhideWhenUsed:1; - unsigned short fQFormat:1; - unsigned short fReserved:3; - } GRFSTDStruct; - unsigned short GRFSTDUnsignedShort; - - public: - GRFSTD(): - GRFSTDUnsignedShort(0) - { - } - - explicit GRFSTD( unsigned short _grfstd ): - GRFSTDUnsignedShort(_grfstd) - { - } - - explicit GRFSTD( bool _fAutoRedef, bool _fHidden, bool _fPersonalCompose, bool _fPersonalReply, bool _fPersonal, - bool _fSemiHidden, bool _fLocked, bool _fUnhideWhenUsed, bool _fQFormat ): - GRFSTDUnsignedShort(0) - { - ( _fAutoRedef ) ? ( this->GRFSTDStruct.fAutoRedef = 1 ) : ( this->GRFSTDStruct.fAutoRedef = 0 ); - ( _fHidden ) ? ( this->GRFSTDStruct.fHidden = 1 ) : ( this->GRFSTDStruct.fHidden = 0 ); - this->GRFSTDStruct.f97LidsSet = 0; - this->GRFSTDStruct.fCopyLang = 0; - ( _fPersonalCompose ) ? ( this->GRFSTDStruct.fPersonalCompose = 1 ) : ( this->GRFSTDStruct.fPersonalCompose = 0 ); - ( _fPersonalReply ) ? ( this->GRFSTDStruct.fPersonalReply = 1 ) : ( this->GRFSTDStruct.fPersonal = 0 ); - ( _fPersonal ) ? ( this->GRFSTDStruct.fPersonal = 1 ) : ( this->GRFSTDStruct.fPersonal = 0 ); - this->GRFSTDStruct.fNoHtmlExport = 0; - ( _fSemiHidden ) ? ( this->GRFSTDStruct.fSemiHidden = 1 ) : ( this->GRFSTDStruct.fSemiHidden = 0 ); - ( _fLocked ) ? ( this->GRFSTDStruct.fLocked = 1 ) : ( this->GRFSTDStruct.fLocked = 0 ); - this->GRFSTDStruct.fInternalUse = 0; - ( _fUnhideWhenUsed ) ? ( this->GRFSTDStruct.fUnhideWhenUsed = 1 ) : ( this->GRFSTDStruct.fUnhideWhenUsed = 0 ); - ( _fQFormat ) ? ( this->GRFSTDStruct.fQFormat = 1 ) : ( this->GRFSTDStruct.fQFormat = 0 ); - this->GRFSTDStruct.fReserved = 0; - } - - operator unsigned short() const - { - return this->GRFSTDUnsignedShort; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/GrLPUpxSw.h b/ASCOfficeDocFile_old/DocxDocConverter/GrLPUpxSw.h deleted file mode 100644 index 5c9e9dcc7b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/GrLPUpxSw.h +++ /dev/null @@ -1,608 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LPUpxPapx.h" -#include "LPUpxChpx.h" -#include "LPUpxTapx.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - //!!!TODO: The revision-marking information and formatting for the style.!!! - class StkParaGRLPUPX: public IOperand - { - private: - LPUpxPapx lPUpxPapx; - LPUpxChpx lPUpxChpx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - public: - - StkParaGRLPUPX () : lPUpxPapx(), lPUpxChpx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit StkParaGRLPUPX( const LPUpxPapx& _lPUpxPapx, const LPUpxChpx& _lPUpxChpx ) : lPUpxPapx(_lPUpxPapx), lPUpxChpx(_lPUpxChpx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = ( _lPUpxPapx.Size() + _lPUpxChpx.Size() ); - this->sizeInBytesWithoutPadding = ( _lPUpxPapx.SizeWithoutPadding() + _lPUpxChpx.SizeWithoutPadding() ); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_lPUpxPapx, _lPUpxPapx.Size() ); - memcpy( ( this->bytes + _lPUpxPapx.Size() ), (unsigned char*)_lPUpxChpx, _lPUpxChpx.Size() ); - } - } - } - - StkParaGRLPUPX( const StkParaGRLPUPX& _stkParaGRLPUPX ) : lPUpxPapx(_stkParaGRLPUPX.lPUpxPapx), lPUpxChpx(_stkParaGRLPUPX.lPUpxChpx), bytes(NULL), sizeInBytes(_stkParaGRLPUPX.sizeInBytes), sizeInBytesWithoutPadding(_stkParaGRLPUPX.sizeInBytesWithoutPadding) - { - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _stkParaGRLPUPX.bytes, this->sizeInBytes ); - } - } - } - - virtual ~StkParaGRLPUPX() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - vector chpxProperties = this->lPUpxChpx.GetProperties(); - vector papxProperties = this->lPUpxPapx.GetProperties(); - - vector properties; - - for ( vector::const_iterator iter = chpxProperties.begin(); iter != chpxProperties.end(); iter++ ) - { - properties.push_back( *iter ); - } - - for ( vector::const_iterator iter = papxProperties.begin(); iter != papxProperties.end(); iter++ ) - { - properties.push_back( *iter ); - } - - return properties; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; - - //!!!TODO: The revision-marking information and formatting for the style.!!! - class StkCharGRLPUPX: public IOperand - { - private: - LPUpxChpx lPUpxChpx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - public: - - StkCharGRLPUPX() : lPUpxChpx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit StkCharGRLPUPX( const LPUpxChpx& _lPUpxChpx ) : lPUpxChpx(_lPUpxChpx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _lPUpxChpx.Size(); - this->sizeInBytesWithoutPadding = _lPUpxChpx.SizeWithoutPadding(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_lPUpxChpx, _lPUpxChpx.Size() ); - } - } - } - - StkCharGRLPUPX( const StkCharGRLPUPX& _stkCharGRLPUPX ) : lPUpxChpx(_stkCharGRLPUPX.lPUpxChpx), bytes(NULL), sizeInBytes(_stkCharGRLPUPX.sizeInBytes), sizeInBytesWithoutPadding(_stkCharGRLPUPX.sizeInBytesWithoutPadding) - { - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _stkCharGRLPUPX.bytes, this->sizeInBytes ); - } - } - } - - virtual ~StkCharGRLPUPX() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return this->lPUpxChpx.GetProperties(); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; - - class StkTableGRLPUPX: public IOperand - { - private: - LPUpxTapx lPUpxTapx; - LPUpxPapx lPUpxPapx; - LPUpxChpx lPUpxChpx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - public: - StkTableGRLPUPX(): - lPUpxTapx(), lPUpxPapx(), lPUpxChpx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit StkTableGRLPUPX( const LPUpxTapx& _lPUpxTapx, const LPUpxPapx& _lPUpxPapx, const LPUpxChpx& _lPUpxChpx ): - lPUpxTapx(_lPUpxTapx), lPUpxPapx(_lPUpxPapx), lPUpxChpx(_lPUpxChpx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = ( _lPUpxTapx.Size() + _lPUpxPapx.Size() + _lPUpxChpx.Size() ); - this->sizeInBytesWithoutPadding = ( _lPUpxTapx.SizeWithoutPadding() + _lPUpxPapx.SizeWithoutPadding() + _lPUpxChpx.SizeWithoutPadding() ); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_lPUpxTapx, _lPUpxTapx.Size() ); - memcpy( ( this->bytes + _lPUpxTapx.Size() ), (unsigned char*)_lPUpxPapx, _lPUpxPapx.Size() ); - memcpy( ( this->bytes + _lPUpxTapx.Size() + _lPUpxPapx.Size() ), (unsigned char*)_lPUpxChpx, _lPUpxChpx.Size() ); - } - } - } - - StkTableGRLPUPX( const StkTableGRLPUPX& _stkTableGRLPUPX ): - lPUpxTapx(_stkTableGRLPUPX.lPUpxTapx), lPUpxPapx(_stkTableGRLPUPX.lPUpxPapx), lPUpxChpx(_stkTableGRLPUPX.lPUpxChpx), bytes(NULL), sizeInBytes(_stkTableGRLPUPX.sizeInBytes), sizeInBytesWithoutPadding(_stkTableGRLPUPX.sizeInBytesWithoutPadding) - { - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _stkTableGRLPUPX.bytes, this->sizeInBytes ); - } - } - } - - virtual ~StkTableGRLPUPX() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - vector chpxProperties = this->lPUpxChpx.GetProperties(); - vector papxProperties = this->lPUpxPapx.GetProperties(); - vector tapxProperties = this->lPUpxTapx.GetProperties(); - - vector properties; - - for ( vector::const_iterator iter = chpxProperties.begin(); iter != chpxProperties.end(); iter++ ) - { - properties.push_back( *iter ); - } - - for ( vector::const_iterator iter = papxProperties.begin(); iter != papxProperties.end(); iter++ ) - { - properties.push_back( *iter ); - } - - for ( vector::const_iterator iter = tapxProperties.begin(); iter != tapxProperties.end(); iter++ ) - { - properties.push_back( *iter ); - } - - return properties; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; - - class StkListGRLPUPX: public IOperand - { - private: - LPUpxPapx lPUpxPapx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - public: - StkListGRLPUPX(): - lPUpxPapx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit StkListGRLPUPX( const LPUpxPapx& _lPUpxPapx ): - lPUpxPapx(_lPUpxPapx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _lPUpxPapx.Size(); - this->sizeInBytesWithoutPadding = _lPUpxPapx.SizeWithoutPadding(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_lPUpxPapx, _lPUpxPapx.Size() ); - } - } - } - - StkListGRLPUPX( const StkListGRLPUPX& _stkListGRLPUPX ): - lPUpxPapx(_stkListGRLPUPX.lPUpxPapx), bytes(NULL), sizeInBytes(_stkListGRLPUPX.sizeInBytes), sizeInBytesWithoutPadding(_stkListGRLPUPX.sizeInBytesWithoutPadding) - { - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _stkListGRLPUPX.bytes, this->sizeInBytes ); - } - } - } - - virtual ~StkListGRLPUPX() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return this->lPUpxPapx.GetProperties(); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; - - class GrLPUpxSw: public IOperand - { - public: - GrLPUpxSw() : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit GrLPUpxSw( const StkParaGRLPUPX& _stkParaGRLPUPX ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _stkParaGRLPUPX.Size(); - this->sizeInBytesWithoutPadding = _stkParaGRLPUPX.SizeWithoutPadding(); - this->properties = _stkParaGRLPUPX.GetProperties(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_stkParaGRLPUPX, _stkParaGRLPUPX.Size() ); - } - } - } - - explicit GrLPUpxSw( const StkCharGRLPUPX& _stkCharGRLPUPX ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _stkCharGRLPUPX.Size(); - this->sizeInBytesWithoutPadding = _stkCharGRLPUPX.SizeWithoutPadding(); - this->properties = _stkCharGRLPUPX.GetProperties(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_stkCharGRLPUPX, _stkCharGRLPUPX.Size() ); - } - } - } - - explicit GrLPUpxSw( const StkTableGRLPUPX& _stkTableGRLPUPX ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _stkTableGRLPUPX.Size(); - this->sizeInBytesWithoutPadding = _stkTableGRLPUPX.SizeWithoutPadding(); - this->properties = _stkTableGRLPUPX.GetProperties(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_stkTableGRLPUPX, _stkTableGRLPUPX.Size() ); - } - } - } - - explicit GrLPUpxSw( const StkListGRLPUPX& _stkListGRLPUPX ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = _stkListGRLPUPX.Size(); - this->sizeInBytesWithoutPadding = _stkListGRLPUPX.SizeWithoutPadding(); - this->properties = _stkListGRLPUPX.GetProperties(); - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_stkListGRLPUPX, _stkListGRLPUPX.Size() ); - } - } - } - - explicit GrLPUpxSw( const Constants::StyleType _styleType, const ASCDocFileFormat::LPUpxPapx& _lPUpxPapx, const ASCDocFileFormat::LPUpxChpx& _lPUpxChpx, const ASCDocFileFormat::LPUpxTapx& _lPUpxTapx ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - switch ( _styleType ) - { - case Constants::styleTypeParagraph: - { - *this = GrLPUpxSw( ASCDocFileFormat::StkParaGRLPUPX( _lPUpxPapx, _lPUpxChpx ) ); - } - break; - - case Constants::styleTypeCharacter: - { - *this = GrLPUpxSw( ASCDocFileFormat::StkCharGRLPUPX( _lPUpxChpx ) ); - } - break; - - case Constants::styleTypeTable: - { - *this = GrLPUpxSw( ASCDocFileFormat::StkTableGRLPUPX( _lPUpxTapx, _lPUpxPapx, _lPUpxChpx ) ); - } - break; - - case Constants::styleTypeNumbering: - { - *this = GrLPUpxSw( ASCDocFileFormat::StkListGRLPUPX( _lPUpxPapx ) ); - } - break; - } - } - - GrLPUpxSw( const GrLPUpxSw& _grLPUpxSw ) : properties(_grLPUpxSw.properties), bytes(NULL), sizeInBytes(_grLPUpxSw.sizeInBytes), sizeInBytesWithoutPadding(_grLPUpxSw.sizeInBytesWithoutPadding) - { - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _grLPUpxSw.bytes, this->sizeInBytes ); - } - } - } - - bool operator == ( const GrLPUpxSw& _grLPUpxSw ) - { - return ( ( this->sizeInBytes == _grLPUpxSw.sizeInBytes ) && - ( this->sizeInBytesWithoutPadding == _grLPUpxSw.sizeInBytesWithoutPadding ) && - ( memcmp( this->bytes, _grLPUpxSw.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const GrLPUpxSw& _grLPUpxSw ) - { - return !( this->operator == ( _grLPUpxSw ) ); - } - - GrLPUpxSw& operator = ( const GrLPUpxSw& _grLPUpxSw ) - { - if ( *this != _grLPUpxSw ) - { - RELEASEARRAYOBJECTS (bytes); - - this->sizeInBytes = _grLPUpxSw.sizeInBytes; - this->sizeInBytesWithoutPadding = _grLPUpxSw.sizeInBytesWithoutPadding; - this->properties = _grLPUpxSw.properties; - - if ( this->sizeInBytes > 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _grLPUpxSw.bytes, this->sizeInBytes ); - } - } - } - - return *this; - } - - virtual ~GrLPUpxSw() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return this->properties; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - private: - - vector properties; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/GrpPrlAndIstd.h b/ASCOfficeDocFile_old/DocxDocConverter/GrpPrlAndIstd.h deleted file mode 100644 index b201baf6d0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/GrpPrlAndIstd.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class GrpPrlAndIstd: public IStreamWriter - { - public: - GrpPrlAndIstd() : istd(0), grpprlSize(0) - { - } - - GrpPrlAndIstd( short _istd, const vector& _grpprl ) : istd(_istd), grpprlSize(0) - { - for ( unsigned int i = 0; i < _grpprl.size(); i++ ) - { - this->grpprlSize += (unsigned short)_grpprl[i].Size(); - this->grpprl.push_back( _grpprl[i] ); - } - } - - GrpPrlAndIstd( const GrpPrlAndIstd& gpai ) : istd(0), grpprlSize(0) - { - this->istd = gpai.istd; - this->grpprlSize = gpai.grpprlSize; - - for ( unsigned int i = 0; i < gpai.grpprl.size(); i++ ) - { - this->grpprl.push_back( gpai.grpprl[i] ); - } - } - - virtual ~GrpPrlAndIstd() - { - } - - inline bool operator == ( const GrpPrlAndIstd& gpai ) - { - if ( ( this->istd != gpai.istd ) || ( this->grpprlSize != gpai.grpprlSize ) || ( this->grpprl.size() != gpai.grpprl.size() ) ) - { - return false; - } - else - { - unsigned int minPrlCount = min( this->grpprl.size(), gpai.grpprl.size() ); - - for ( unsigned int i = 0; i < minPrlCount; i++ ) - { - if ( this->grpprl[i] != gpai.grpprl[i] ) - { - return false; - } - } - } - - return true; - } - - inline bool operator != ( const GrpPrlAndIstd& gpai ) - { - return !( *this == gpai ); - } - - inline GrpPrlAndIstd& operator = ( const GrpPrlAndIstd& gpai ) - { - if ( *this != gpai ) - { - this->istd = gpai.istd; - this->grpprlSize = gpai.grpprlSize; - - this->grpprl.clear(); - - for ( unsigned int i = 0; i < gpai.grpprl.size(); i++ ) - { - this->grpprl.push_back( gpai.grpprl[i] ); - } - } - - return *this; - } - - inline unsigned long Size() const - { - return ( sizeof(this->istd) + this->grpprlSize ); - } - - inline Prl operator[] ( unsigned int index ) const - { - return this->grpprl[index]; - } - - inline unsigned int GetPrlCount() const - { - return (unsigned int)this->grpprl.size(); - } - - inline vector GetPrls() const - { - return this->grpprl; - } - - inline short GetIstd() const - { - return istd; - } - - // IStreamWriter - virtual unsigned char* GetBytes(unsigned long* size) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = sizeof(this->istd) + this->grpprlSize; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - FormatUtils::SetBytes( bytes, this->istd ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( unsigned int i = 0; i < this->grpprl.size(); i++ ) - { - prlBytes = this->grpprl[i].GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( bytes + sizeof(this->istd) + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - - return bytes; - } - - private: - - short istd; //The style applied to this paragraph, cell marker or table row marker. - vector grpprl; - unsigned short grpprlSize; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Header.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Header.cpp deleted file mode 100644 index 92205b76b6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Header.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Header.h" - -namespace ASCDocFileFormat -{ - Header::Header() - { - headerItemsOffset = 0; - - Paragraph paragraph; - paragraph.AddParagraphItem( Run() ); - this->textItems.push_back( HeaderItemWithOffset( TextItemPtr( static_cast(paragraph.Clone()) ), this->headerItemsOffset ) ); - this->headerItemsOffset += ( sizeof(wchar_t) * paragraph.GetAllText().size() ); - } - - /*========================================================================================================*/ - - Header::Header( const Header& _header ): - headerItemsOffset(_header.headerItemsOffset) - { - for ( list::const_iterator iter = _header.textItems.begin(); iter != _header.textItems.end(); iter++ ) - { - this->textItems.push_back( HeaderItemWithOffset( TextItemPtr( static_cast( iter->headerItem->Clone() ) ), iter->headerItemOffset ) ); - } - } - - /*========================================================================================================*/ - - void Header::AddTextItem( const ITextItem& _textItem ) - { - ITextItem* textItem = static_cast( _textItem.Clone() ); - - if ( !this->textItems.empty() ) - { - list::iterator iter = this->textItems.begin(); - - for ( unsigned int i = 0; i < ( this->textItems.size() - 1 ); i++, iter++ ); - - this->textItems.erase( iter ); - - this->headerItemsOffset -= sizeof(wchar_t); - } - - if ( textItem != NULL ) - { - this->textItems.push_back( HeaderItemWithOffset( TextItemPtr( textItem ), this->headerItemsOffset ) ); - this->headerItemsOffset += ( sizeof(wchar_t) * textItem->GetAllText().size() ); - Paragraph paragraph; - paragraph.AddParagraphItem( Run() ); - this->textItems.push_back( HeaderItemWithOffset( TextItemPtr( static_cast(paragraph.Clone()) ), this->headerItemsOffset ) ); - this->headerItemsOffset += ( sizeof(wchar_t) * paragraph.GetAllText().size() ); - } - } - - /*========================================================================================================*/ - - Header::~Header() - { - } - - /*========================================================================================================*/ - - wstring Header::GetAllText() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += iter->headerItem->GetAllText(); - } - - return allText; - } - - /*========================================================================================================*/ - - Header::operator wstring() const - { - wstring allText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allText += *(iter->headerItem); - } - - return allText; - } - - /*========================================================================================================*/ - - vector Header::GetAllParagraphsCopy() const - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector textItemParagraphs = iter->headerItem->GetAllParagraphsCopy(); - - for ( vector::const_iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*textItemParagraphsIter)->Clone() ) ) ); - } - } - - return allParagraphs; - } - - /*========================================================================================================*/ - - vector Header::GetAllParagraphs() - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - ITextItem* item = (ITextItem*)iter->headerItem.operator->(); - vector textItemParagraphs = item->GetAllParagraphs(); - - for ( vector::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) - { - allParagraphs.push_back( *textItemParagraphsIter ); - } - } - - return allParagraphs; - } - - /*========================================================================================================*/ - - vector Header::GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - unsigned int paragraphOffset = 0; - - if ( allParagraphsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector headerItemParagraphsOffsets; - vector headerItemParagraphsProperties = iter->headerItem->GetAllParagraphsProperties( &headerItemParagraphsOffsets ); - - for ( unsigned int i = 0; i < headerItemParagraphsProperties.size(); i++ ) - { - allParagraphsProperties.push_back( headerItemParagraphsProperties[i] ); - allParagraphsOffsets->push_back( paragraphOffset + headerItemParagraphsOffsets[i] ); - } - - paragraphOffset += ( sizeof(wchar_t) * iter->headerItem->GetAllText().size() ); - } - } - - return allParagraphsProperties; - } - - /*========================================================================================================*/ - - vector Header::GetAllRunProperties( vector* allRunsOffsets ) const - { - vector allRunsProperties; - unsigned int runOffset = 0; - - if ( allRunsOffsets != NULL ) - { - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector headerItemRunsOffsets; - vector headerItemRunsProperties = iter->headerItem->GetAllRunProperties( &headerItemRunsOffsets ); - - for ( unsigned int i = 0; i < headerItemRunsProperties.size(); i++ ) - { - allRunsProperties.push_back( headerItemRunsProperties[i] ); - allRunsOffsets->push_back( runOffset + headerItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->headerItem->GetAllText().size() ); - } - } - - return allRunsProperties; - } - - /*========================================================================================================*/ - - vector Header::GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int runOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemRunsOffsets; - vector allTextItemRuns = iter->headerItem->GetAllRunsCopy( &allTextItemRunsOffsets ); - - for ( unsigned int i = 0; i < allTextItemRuns.size(); i++ ) - { - allRuns.push_back( IParagraphItemPtr( static_cast(allTextItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( runOffset + allTextItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * iter->headerItem->GetAllText().size() ); - } - } - - return allRuns; - } - - /*========================================================================================================*/ - - vector Header::GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int textItemOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemParagraphItemsOffsets; - vector allTextItemParagraphItems = iter->headerItem->GetAllParagraphItemsCopy( &allTextItemParagraphItemsOffsets ); - - for ( unsigned int i = 0; i < allTextItemParagraphItems.size(); i++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast(allTextItemParagraphItems[i]->Clone()) ) ); - allParagraphItemsOffsets->push_back( textItemOffset + allTextItemParagraphItemsOffsets[i] ); - } - - textItemOffset += ( sizeof(wchar_t) * iter->headerItem->GetAllText().size() ); - } - } - - return allParagraphItems; - } - - /*========================================================================================================*/ - - IVirtualConstructor* Header::New() const - { - return new Header(); - } - - /*========================================================================================================*/ - - IVirtualConstructor* Header::Clone() const - { - return new Header( *this ); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Header.h b/ASCOfficeDocFile_old/DocxDocConverter/Header.h deleted file mode 100644 index 6fcab5fb1a..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Header.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Paragraph.h" - -namespace ASCDocFileFormat -{ - class Header: public ITextItem - { - struct HeaderItemWithOffset - { - TextItemPtr headerItem; - unsigned int headerItemOffset; - - HeaderItemWithOffset(): - headerItem(), headerItemOffset(0) - { - } - - HeaderItemWithOffset( const TextItemPtr& _headerItem, unsigned int _headerItemOffset ): - headerItem(_headerItem), headerItemOffset(_headerItemOffset) - { - } - }; - - private: - list textItems; - unsigned int headerItemsOffset; - - public: - explicit Header(); - Header( const Header& _header ); - void AddTextItem( const ITextItem& _textItem ); - virtual ~Header(); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.cpp deleted file mode 100644 index 7027799d9b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - - -#include "Hyperlink.h" - -namespace ASCDocFileFormat -{ - Hyperlink::Hyperlink () - { - - } - - Hyperlink::Hyperlink (const vector& runs) - { - for (size_t i = 0; i < runs.size(); ++i) - { - textRuns.push_back(ParagraphItem(runs[i])); - } - } - Hyperlink::~Hyperlink() - { - - } -} - -namespace ASCDocFileFormat -{ - void Hyperlink::BuildUrlRuns() const - { - std::wstring text; - - specialRuns.clear(); - - text.push_back( TextMark::FieldBeginMark ); - - ASCDocFileFormat::Run fieldBeginRun( ASCDocFileFormat::Text( text.c_str() ) ); - fieldBeginRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - text = wstring( _T( " HYPERLINK" ) ); - - if ( !url.empty() ) - { - text += wstring( _T( " \"" ) ); - text += url; - text.push_back( _T( '"' ) ); - text.push_back( _T( ' ' ) ); - } - - if ( !locationInTheFile.empty() ) - { - text += wstring( _T( " \\l \"" ) ); - text += locationInTheFile; - text.push_back( _T( '"' ) ); - } - - ASCDocFileFormat::Run specialRun (ASCDocFileFormat::Text(text.c_str())); - - text.clear(); - text.push_back( TextMark::FieldSeparator ); - - ASCDocFileFormat::Run fieldSeperatorRun( ASCDocFileFormat::Text( text.c_str() ) ); - fieldSeperatorRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - text.clear(); - text.push_back( TextMark::FieldEndMark ); - - ASCDocFileFormat::Run fieldEndRun( ASCDocFileFormat::Text( text.c_str() ) ); - fieldEndRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - specialRuns.push_back( ParagraphItem( fieldBeginRun ) ); - specialRuns.push_back( ParagraphItem( specialRun ) ); - specialRuns.push_back( ParagraphItem( fieldSeperatorRun ) ); - specialRuns.push_back( ParagraphItem( fieldEndRun ) ); - } - - /*========================================================================================================*/ - - void Hyperlink::AddRun( const Run& _run ) - { - textRuns.push_back( ParagraphItem( _run ) ); - } - - /*========================================================================================================*/ - - void Hyperlink::SetURL( const wchar_t* _url ) - { - if ( _url != NULL ) - { - url = wstring( _url ); - } - } - - wstring Hyperlink::GetURL() const - { - return url; - } - - /*========================================================================================================*/ - - void Hyperlink::SetLocationInTheFile( const wchar_t* _locationInTheFile ) - { - if ( _locationInTheFile != NULL ) - { - locationInTheFile = wstring( _locationInTheFile ); - } - } - - wstring Hyperlink::GetLocationInTheFile() const - { - return locationInTheFile; - } - - /*========================================================================================================*/ - - wstring Hyperlink::GetHyperlinkText() const - { - wstring hyperlinkText; - - for (list::const_iterator iter = textRuns.begin(); iter != textRuns.end(); ++iter) - { - hyperlinkText += (*iter)->GetAllText(); - } - - return hyperlinkText; - } - - - /*========================================================================================================*/ - - unsigned long Hyperlink::GetTextSize() const - { - return (unsigned long)GetAllText().size(); - } - - /*========================================================================================================*/ - - wstring Hyperlink::GetAllText() const - { - BuildUrlRuns(); - - wstring allText; - - for (unsigned int i = 0; i < specialRuns.size() - 1; ++i) - { - allText += specialRuns[i]->GetAllText(); - } - - allText += GetHyperlinkText(); - allText += specialRuns.back()->GetAllText(); - - return allText; - } - - /*========================================================================================================*/ - - vector Hyperlink::GetRunProperties( vector* runOffsets ) const - { - vector allRunsProperties; - - if ( runOffsets != NULL ) - { - unsigned int allRunsOffset = 0; - - this->BuildUrlRuns(); - - for ( unsigned int i = 0; i < ( this->specialRuns.size() - 1 ); i++ ) - { - vector runOffset; - vector runProperties = this->specialRuns[i]->GetRunProperties( &runOffset ); - - for ( unsigned int j = 0; j < runProperties.size(); j++ ) - { - allRunsProperties.push_back( runProperties[j] ); - runOffsets->push_back( allRunsOffset + runOffset[j] ); - } - - allRunsOffset += ( sizeof(wchar_t) * this->specialRuns[i]->GetTextSize() ); - } - - for ( list::const_iterator iter = this->textRuns.begin(); iter != this->textRuns.end(); iter++ ) - { - vector runOffset; - vector runProperties = (*iter)->GetRunProperties( &runOffset ); - - for ( unsigned int i = 0; i < runProperties.size(); i++ ) - { - allRunsProperties.push_back( runProperties[i] ); - runOffsets->push_back( allRunsOffset + runOffset[i] ); - } - - allRunsOffset += ( sizeof(wchar_t) * (*iter)->GetTextSize() ); - } - - vector runOffset; - vector runProperties = this->specialRuns.back()->GetRunProperties( &runOffset ); - - for ( unsigned int i = 0; i < runProperties.size(); i++ ) - { - allRunsProperties.push_back( runProperties[i] ); - runOffsets->push_back( allRunsOffset + runOffset[i] ); - } - - allRunsOffset += ( sizeof(wchar_t) * this->specialRuns.back()->GetTextSize() ); - } - - return allRunsProperties; - } - - /*========================================================================================================*/ - - unsigned int Hyperlink::PrlSize () const - { - vector runOffsets; - - return (unsigned int)GetRunProperties( &runOffsets ).size(); - } - - /*========================================================================================================*/ - - vector Hyperlink::GetAllRunsCopy( vector* runOffsets ) const - { - vector allRunsCopy; - - if ( runOffsets != NULL ) - { - this->BuildUrlRuns(); - - unsigned int runOffset = 0; - - for ( unsigned int i = 0; i < ( this->specialRuns.size() - 1 ); i++ ) - { - allRunsCopy.push_back( IParagraphItemPtr( static_cast(this->specialRuns[i]->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * this->specialRuns[i]->GetTextSize() ); - } - - for ( list::const_iterator iter = this->textRuns.begin(); iter != this->textRuns.end(); iter++ ) - { - allRunsCopy.push_back( IParagraphItemPtr( static_cast((*iter)->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * (*iter)->GetTextSize() ); - } - - allRunsCopy.push_back( IParagraphItemPtr( static_cast(this->specialRuns.back()->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * this->specialRuns.back()->GetTextSize() ); - } - - return allRunsCopy; - } - - /*========================================================================================================*/ - - IVirtualConstructor* Hyperlink::New() const - { - return new Hyperlink(); - } - - /*========================================================================================================*/ - - IVirtualConstructor* Hyperlink::Clone() const - { - return new Hyperlink( *this ); - } - - /*========================================================================================================*/ - - vector Hyperlink::GetFieldCharactersPositions() const - { - vector fieldCharactersPositions; - - BuildUrlRuns(); - - fieldCharactersPositions.push_back ( CP( 0 ) ); - fieldCharactersPositions.push_back ( CP( specialRuns[0]->GetTextSize() + specialRuns[1]->GetTextSize() ) ); - fieldCharactersPositions.push_back ( CP( specialRuns[0]->GetTextSize() + specialRuns[1]->GetTextSize() + specialRuns[2]->GetTextSize() + GetHyperlinkText().size() ) ); - - //int m0 = specialRuns[0]->GetTextSize(); - //int m1 = specialRuns[1]->GetTextSize(); - //int m2 = specialRuns[2]->GetTextSize(); - //int m3 = specialRuns[3]->GetTextSize(); - //int m4 = GetHyperlinkText().size(); - - //fieldCharactersPositions.push_back ( CP( 0 ) ); - //fieldCharactersPositions.push_back ( CP( specialRuns[0]->GetTextSize() + specialRuns[1]->GetTextSize()) ); - //fieldCharactersPositions.push_back ( CP( - // //specialRuns[0]->GetTextSize() - // specialRuns[1]->GetTextSize() + 2 - // //+ specialRuns[2]->GetTextSize() - // //+ specialRuns[3]->GetTextSize() - // + GetHyperlinkText().size() - // )); - - return fieldCharactersPositions; - } - - /*========================================================================================================*/ - - vector Hyperlink::GetFieldCharactersProperties() const - { - vector fieldCharactersProperties; - - fieldCharactersProperties.push_back (Fld (FldChar::FldCharBegin, Constants::fltHYPERLINK ) ); - fieldCharactersProperties.push_back (Fld (FldChar::FldCharSeparate, 0 ) ); - fieldCharactersProperties.push_back (Fld (FldChar::FldCharEnd, (unsigned char)grffldEnd( false, false, false, false, false, false, false, true ) ) ); - - return fieldCharactersProperties; - } -} - -namespace ASCDocFileFormat -{ - Hyperlink::const_iterator Hyperlink::begin() const - { - return textRuns.begin(); - } - - Hyperlink::const_iterator Hyperlink::end() const - { - return textRuns.end(); - } - - Hyperlink::iterator Hyperlink::begin() - { - return textRuns.begin(); - } - - Hyperlink::iterator Hyperlink::end() - { - return textRuns.end(); - } - - Hyperlink::const_reverse_iterator Hyperlink::rbegin() const - { - return textRuns.rbegin(); - } - - Hyperlink::const_reverse_iterator Hyperlink::rend() const - { - return textRuns.rend(); - } - - Hyperlink::reverse_iterator Hyperlink::rbegin() - { - return textRuns.rbegin(); - } - - Hyperlink::reverse_iterator Hyperlink::rend() - { - return textRuns.rend(); - } - - Hyperlink::const_reference Hyperlink::front() const - { - return *begin(); - } - - Hyperlink::const_reference Hyperlink::back() const - { - return *(--end()); - } - - Hyperlink::reference Hyperlink::front() - { - return *begin(); - } - - Hyperlink::reference Hyperlink::back() - { - return *(--end()); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.h b/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.h deleted file mode 100644 index 533aa73a9b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Hyperlink.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Run.h" -#include "ParagraphItem.h" -#include "CP.h" - -namespace ASCDocFileFormat -{ - class Hyperlink : public IParagraphItem - { - public: - typedef list::const_iterator const_iterator; - typedef list::iterator iterator; - typedef list::const_reverse_iterator const_reverse_iterator; - typedef list::reverse_iterator reverse_iterator; - typedef list::const_reference const_reference; - typedef list::reference reference; - - public: - Hyperlink(); - explicit Hyperlink( const vector& _runs ); - protected: - void BuildUrlRuns() const; - - public: - - const_iterator begin() const; - const_iterator end() const; - iterator begin(); - iterator end(); - const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; - reverse_iterator rbegin(); - reverse_iterator rend(); - const_reference front() const; - const_reference back() const; - reference front(); - reference back(); - - public: - void AddRun( const Run& _run ); - void SetURL( const wchar_t* _url ); - wstring GetURL() const; - void SetLocationInTheFile( const wchar_t* _locationInTheFile ); - wstring GetLocationInTheFile() const; - wstring GetHyperlinkText() const; - virtual ~Hyperlink(); - virtual unsigned long GetTextSize() const; - virtual std::wstring GetAllText() const; - virtual vector GetRunProperties( vector* runOffsets ) const; - virtual unsigned int PrlSize() const; - virtual vector GetAllRunsCopy( vector* runOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - vector GetFieldCharactersPositions() const; - vector GetFieldCharactersProperties() const; - - private: - static const unsigned char CFSpec = 1; - - std::list textRuns; - mutable std::vector specialRuns; - std::wstring url; - std::wstring locationInTheFile; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/IParagraphItem.h b/ASCOfficeDocFile_old/DocxDocConverter/IParagraphItem.h deleted file mode 100644 index 6866401a34..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/IParagraphItem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Chpx.h" - -#include "../../Common/DocxFormat/Source/Base/SmartPtr.h" -#include "../Common/IVirtualConstructor.h" - -namespace ASCDocFileFormat -{ - class IParagraphItem; - typedef NSCommon::smart_ptr IParagraphItemPtr; - - class IParagraphItem : public IVirtualConstructor - { - public: - virtual unsigned long GetTextSize() const = 0; - virtual std::wstring GetAllText() const = 0; - virtual vector GetRunProperties( vector* runOffsets ) const = 0; - virtual unsigned int PrlSize () const = 0; - virtual vector GetAllRunsCopy( vector* runOffsets ) const = 0; - - virtual ~IParagraphItem() {} - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/IRunItem.h b/ASCOfficeDocFile_old/DocxDocConverter/IRunItem.h deleted file mode 100644 index e0b6d95ac6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/IRunItem.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" -#include "../Common/IVirtualConstructor.h" - -namespace ASCDocFileFormat -{ - struct IRunItem : public IVirtualConstructor - { - virtual unsigned long GetTextSize() const = 0; - virtual wstring GetAllText() const = 0; - virtual vector GetRunProperties() const = 0; - virtual unsigned int PrlSize () const = 0; - virtual ~IRunItem() {} - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/IStreamWriter.h b/ASCOfficeDocFile_old/DocxDocConverter/IStreamWriter.h deleted file mode 100644 index 917e1d15f6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/IStreamWriter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../pole/pole.h" -#include "../../DesktopEditor/common/Types.h" - -namespace ASCDocFileFormat -{ - struct IStreamWriter - { - virtual ~IStreamWriter() - { - - } - - virtual long WriteToStream(POLE::Stream* pStream, unsigned long offset = 0) const - { - HRESULT hr = S_FALSE; - - unsigned long size = 0; - ULONG writtenSize = 0; - - unsigned char* bytes = GetBytes(&size); - - if (NULL != bytes) - { - pStream->seek(offset/*, STREAM_SEEK_SET*/); - writtenSize = pStream->write(bytes, size ); - - RELEASEARRAYOBJECTS (bytes); - } - - return hr; - } - - // - virtual unsigned char* GetBytes(unsigned long* size) const = 0; - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ITableItem.h b/ASCOfficeDocFile_old/DocxDocConverter/ITableItem.h deleted file mode 100644 index c6efab032e..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ITableItem.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ITextItem.h" - -namespace AVSDocFileFormat -{ - struct ITableItem: public ITextItem - { - virtual vector GetAllMarkersProperties( vector* allMarkersOffsets ) const = 0; - virtual ~ITableItem() {}; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ITextItem.h b/ASCOfficeDocFile_old/DocxDocConverter/ITextItem.h deleted file mode 100644 index 50a34cb437..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ITextItem.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PapxInFkp.h" -#include "Run.h" - -namespace ASCDocFileFormat -{ - struct ITextItem; - - typedef NSCommon::smart_ptr TextItemPtr; - - struct ITextItem : public IVirtualConstructor - { - virtual wstring GetAllText() const = 0; - virtual operator wstring() const = 0; - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const = 0; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const = 0; - virtual vector GetAllParagraphsCopy() const = 0; - virtual vector GetAllParagraphs() = 0; - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const = 0; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const = 0; - - virtual ~ITextItem() {} - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.cpp b/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.cpp deleted file mode 100644 index 27f469c993..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - - -#include "InlineShape.h" - -namespace ASCDocFileFormat -{ - InlineShape::InlineShape () - { - - } - - InlineShape::InlineShape (const vector& oRuns) - { - for (size_t i = 0; i < oRuns.size(); ++i) - { - m_oTextRuns.push_back(ParagraphItem(oRuns[i])); - } - } - - InlineShape::~InlineShape() - { - - } - - IVirtualConstructor* InlineShape::New() const - { - return new InlineShape(); - } - - IVirtualConstructor* InlineShape::Clone() const - { - return new InlineShape( *this ); - } -} - -namespace ASCDocFileFormat -{ - void InlineShape::BuildRuns() const - { - m_oSpecialRuns.clear(); - - //static const unsigned char CFLoc = 0; - static const unsigned char CFSpec = 1; - - ASCDocFileFormat::Run oBegin(ASCDocFileFormat::Text((wchar_t)TextMark::FieldBeginMark)); - - //oBegin.AddProperty( (short)DocFileFormat::sprmCPicLocation, (void*)&CFLoc ); - oBegin.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - ASCDocFileFormat::Run oSpecial (ASCDocFileFormat::Text(L" SHAPE \\* MERGEFORMAT ")); - - ASCDocFileFormat::Run oSeperator(ASCDocFileFormat::Text((wchar_t)TextMark::FieldSeparator)); - //oSeperator.AddProperty( (short)DocFileFormat::sprmCPicLocation, (void*)&CFLoc ); - oSeperator.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - ASCDocFileFormat::Run oEnd(ASCDocFileFormat::Text((wchar_t)TextMark::FieldEndMark)); - //oEnd.AddProperty( (short)DocFileFormat::sprmCPicLocation, (void*)&CFLoc ); - oEnd.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - m_oSpecialRuns.push_back(ParagraphItem(oBegin)); - m_oSpecialRuns.push_back(ParagraphItem(oSpecial)); - m_oSpecialRuns.push_back(ParagraphItem(oSeperator)); - m_oSpecialRuns.push_back(ParagraphItem(oEnd)); - - /* - - ASCDocFileFormat::Run oBegin(ASCDocFileFormat::Text((wchar_t)TextMark::FieldBeginMark)); - - oBegin.AddProperty( (short)DocFileFormat::sprmCPicLocation, (void*)&CFLoc ); - oBegin.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - ASCDocFileFormat::Run oSpecial (ASCDocFileFormat::Text(L" SHAPE \\* MERGEFORMAT ")); - - ASCDocFileFormat::Run oSeperator( ASCDocFileFormat::Text((wchar_t)TextMark::FieldSeparator)); - oSeperator.AddProperty( (short)DocFileFormat::sprmCPicLocation, (void*)&CFLoc ); - oSeperator.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); - - ASCDocFileFormat::Run oEnd; - - //oEnd.AddRunItem (m_oShape); - oEnd.AddRunItem (m_oPicture); - oEnd.AddRunItem (ASCDocFileFormat::Text(TextMark::FieldEndMark)); - - m_oSpecialRuns.push_back(ParagraphItem(oBegin)); - m_oSpecialRuns.push_back(ParagraphItem(oSpecial)); - m_oSpecialRuns.push_back(ParagraphItem(oSeperator)); - m_oSpecialRuns.push_back(ParagraphItem(oEnd)); - */ - } - - void InlineShape::AddRun(const Run& oRun) - { - m_oTextRuns.push_back(ParagraphItem(oRun)); - } - - void InlineShape::SetShape(const ASCDocFileFormat::CShapeRun& oShape) - { - m_oShape = oShape; - } - - void InlineShape::SetPicture(const ASCDocFileFormat::Picture& oPicture) - { - m_oPicture = oPicture; - } - - void InlineShape::RemoveAllRuns () - { - m_oTextRuns.clear (); - } - - unsigned long InlineShape::GetTextSize() const - { - return (unsigned long)GetAllText().size(); - } - - std::wstring InlineShape::GetAllText() const - { - BuildRuns(); - - std::wstring allText; - - for (unsigned int i = 0; i < m_oSpecialRuns.size() - 1; ++i) - { - allText += m_oSpecialRuns[i]->GetAllText(); - } - - allText += GetInnerText(); - allText += m_oSpecialRuns.back()->GetAllText(); - - return allText; - } - - std::vector InlineShape::GetRunProperties(vector* runOffsets) const - { - vector allRunsProperties; - - if ( runOffsets != NULL ) - { - unsigned int allRunsOffset = 0; - - BuildRuns(); - - for (unsigned int i = 0; i < ( m_oSpecialRuns.size() - 1 ); ++i) - { - vector runOffset; - vector runProperties = m_oSpecialRuns[i]->GetRunProperties( &runOffset ); - - for ( unsigned int j = 0; j < runProperties.size(); j++ ) - { - allRunsProperties.push_back( runProperties[j] ); - runOffsets->push_back( allRunsOffset + runOffset[j] ); - } - - allRunsOffset += ( sizeof(wchar_t) * m_oSpecialRuns[i]->GetTextSize() ); - } - - for ( list::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); iter++ ) - { - vector runOffset; - vector runProperties = ((IParagraphItem*)iter.operator->())->GetRunProperties( &runOffset ); - - for ( unsigned int i = 0; i < runProperties.size(); i++ ) - { - allRunsProperties.push_back( runProperties[i] ); - runOffsets->push_back( allRunsOffset + runOffset[i] ); - } - - allRunsOffset += ( sizeof(wchar_t) * ((IParagraphItem*)iter.operator->())->GetTextSize() ); - } - - vector runOffset; - vector runProperties = m_oSpecialRuns.back()->GetRunProperties( &runOffset ); - - for ( unsigned int i = 0; i < runProperties.size(); i++ ) - { - allRunsProperties.push_back( runProperties[i] ); - runOffsets->push_back( allRunsOffset + runOffset[i] ); - } - - allRunsOffset += ( sizeof(wchar_t) * m_oSpecialRuns.back()->GetTextSize() ); - } - - return allRunsProperties; - } - - - unsigned int InlineShape::PrlSize () const - { - vector runOffsets; - - return (unsigned int)GetRunProperties( &runOffsets ).size(); - } - - vector InlineShape::GetAllRunsCopy(vector* runOffsets) const - { - vector allRunsCopy; - - if ( runOffsets ) - { - BuildRuns(); - - unsigned int runOffset = 0; - - for (unsigned int i = 0; i < ( m_oSpecialRuns.size() - 1 ); ++i) - { - allRunsCopy.push_back( IParagraphItemPtr( static_cast(m_oSpecialRuns[i]->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * m_oSpecialRuns[i]->GetTextSize() ); - } - - for (list::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter) - { - allRunsCopy.push_back( IParagraphItemPtr( static_cast(((IParagraphItem*)iter.operator->())->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * ((IParagraphItem*)iter.operator->())->GetTextSize() ); - } - - allRunsCopy.push_back( IParagraphItemPtr( static_cast(m_oSpecialRuns.back()->Clone()) ) ); - runOffsets->push_back( runOffset ); - runOffset += ( sizeof(wchar_t) * m_oSpecialRuns.back()->GetTextSize() ); - } - - return allRunsCopy; - } - - vector InlineShape::GetFieldCharactersPositions() const - { - vector fieldCharactersPositions; - - BuildRuns(); - - fieldCharactersPositions.push_back ( CP( 0 ) ); - fieldCharactersPositions.push_back ( CP( m_oSpecialRuns[0]->GetTextSize() + m_oSpecialRuns[1]->GetTextSize() ) ); - fieldCharactersPositions.push_back ( CP( m_oSpecialRuns[0]->GetTextSize() + - m_oSpecialRuns[1]->GetTextSize() + - m_oSpecialRuns[2]->GetTextSize() + - GetInnerText().size() /*- 2*/ ) ); - - return fieldCharactersPositions; - } - - vector InlineShape::GetFieldCharactersProperties() const - { - vector fieldCharactersProperties; - - fieldCharactersProperties.push_back (Fld (FldChar::FldCharBegin, Constants::fltSHAPE ) ); - fieldCharactersProperties.push_back (Fld (FldChar::FldCharSeparate, (unsigned char)grffldEnd( true, true, true, true, true, true, true, true ) ) ); - fieldCharactersProperties.push_back (Fld (FldChar::FldCharEnd, (unsigned char)grffldEnd( false, false, false, false, false, false, false, true ) ) ); - - return fieldCharactersProperties; - } - - std::wstring InlineShape::GetInnerText() const - { - wstring strText; - - for (list::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter) - { - strText += ((IParagraphItem*)iter.operator->())->GetAllText(); - } - - return strText; - } -} - -namespace ASCDocFileFormat -{ - InlineShape::const_iterator InlineShape::begin() const - { - return m_oTextRuns.begin(); - } - - InlineShape::const_iterator InlineShape::end() const - { - return m_oTextRuns.end(); - } - - InlineShape::iterator InlineShape::begin() - { - return m_oTextRuns.begin(); - } - - InlineShape::iterator InlineShape::end() - { - return m_oTextRuns.end(); - } - - InlineShape::const_reverse_iterator InlineShape::rbegin() const - { - return m_oTextRuns.rbegin(); - } - - InlineShape::const_reverse_iterator InlineShape::rend() const - { - return m_oTextRuns.rend(); - } - - InlineShape::reverse_iterator InlineShape::rbegin() - { - return m_oTextRuns.rbegin(); - } - - InlineShape::reverse_iterator InlineShape::rend() - { - return m_oTextRuns.rend(); - } - - InlineShape::const_reference InlineShape::front() const - { - return *begin(); - } - - InlineShape::const_reference InlineShape::back() const - { - return *(--end()); - } - - InlineShape::reference InlineShape::front() - { - return *begin(); - } - - InlineShape::reference InlineShape::back() - { - return *(--end()); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.h b/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.h deleted file mode 100644 index 0519f8fbf1..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/InlineShape.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Run.h" -#include "ParagraphItem.h" -#include "CP.h" - -#include "ShapeBuilder.h" -/* - -http://support.microsoft.com/kb/276862 - -TODO : надо разобраться каким образом идет запись инлайн объектов - -*/ - -namespace ASCDocFileFormat -{ - class InlineShape : public IParagraphItem - { - public: - typedef list::const_iterator const_iterator; - typedef list::iterator iterator; - typedef list::const_reverse_iterator const_reverse_iterator; - typedef list::reverse_iterator reverse_iterator; - typedef list::const_reference const_reference; - typedef list::reference reference; - - public: - - InlineShape(); - InlineShape (const vector& oRuns); - virtual ~InlineShape(); - - public: - - void AddRun(const Run& oRun); - void SetShape(const ASCDocFileFormat::CShapeRun& oShape); - void SetPicture(const ASCDocFileFormat::Picture& oPicture); - - void RemoveAllRuns (); - void BuildRuns() const; - - virtual unsigned long GetTextSize() const; - virtual std::wstring GetAllText() const; - virtual vector GetRunProperties( vector* runOffsets ) const; - virtual unsigned int PrlSize() const; - virtual vector GetAllRunsCopy( vector* runOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - std::vector GetFieldCharactersPositions() const; - std::vector GetFieldCharactersProperties() const; - std::wstring GetInnerText() const; - - public: - - const_iterator begin() const; - const_iterator end() const; - iterator begin(); - iterator end(); - const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; - reverse_iterator rbegin(); - reverse_iterator rend(); - const_reference front() const; - const_reference back() const; - reference front(); - reference back(); - - private: - - std::list m_oTextRuns; - ASCDocFileFormat::CShapeRun m_oShape; - ASCDocFileFormat::Picture m_oPicture; - mutable std::vector m_oSpecialRuns; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/InternalElements.h b/ASCOfficeDocFile_old/DocxDocConverter/InternalElements.h deleted file mode 100644 index 2db9c369ca..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/InternalElements.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include -#include - -#include "../DocxDocConverter/Prl.h" - -typedef std::vector PrlList; - -namespace DOCXTODOC -{ - class CInternalStyle - { - public: - - CInternalStyle () : m_bIsRenewed(FALSE) - { - - } - - CInternalStyle (std::string strName, const PrlList& arRun, const PrlList& arParagraph) : m_bIsRenewed(FALSE), m_strName(strName) - { - SetPrlsLists (arRun, arParagraph); - } - - CInternalStyle (std::string strBaseStyle) : m_bIsRenewed(FALSE) - { - - } - - inline void SetPrlsLists (const PrlList& arRun, const PrlList& arParagraph) - { - m_arRun = arRun; - m_arParagraph = arParagraph; - } - - inline void SetName (const std::string& strName) - { - m_strName = strName; - } - - inline bool UpdateRunPrls (const PrlList& arRun) - { - if (0 == arRun.size()) // не дополняем стиль - return FALSE; - - if (0 == m_arRun.size()) // стиль не имеет параметров для символов - { - m_arRun = arRun; - return TRUE; - } - - bool bModifity = FALSE; - - for (size_t i = 0; i < arRun.size(); ++i) - { - int nInd = FindSprm (arRun[i].GetSprmCode()); - if (nInd >= 0) - { - if (m_arRun[nInd] != arRun[i]) - { - m_arRun[nInd] = arRun[i]; - bModifity = TRUE; - } - } - else - { - m_arRun.push_back (arRun[i]); - bModifity = TRUE; - } - } - - m_bIsRenewed = bModifity; - - return bModifity; - } - - inline bool IsRenewed () - { - return m_bIsRenewed; - } - - inline bool operator == (const CInternalStyle& oStyle) - { - if ((oStyle.m_arRun.size() != m_arRun.size()) || (oStyle.m_arParagraph.size() != m_arParagraph.size()) ) - return false; - - for (size_t i = 0; i < m_arRun.size(); ++i) - { - if (m_arRun[i] != oStyle.m_arRun[i]) - return false; - } - - for (size_t i = 0; i < m_arParagraph.size(); ++i) - { - if (m_arParagraph[i] != oStyle.m_arParagraph[i]) - return false; - } - - return true; // ((oStyle.m_strName == m_strName) );//&& (oStyle.m_arRun == m_arRun) && (oStyle.m_arParagraph == m_arParagraph)); - } - - inline const PrlList& GetRun() - { - return m_arRun; - } - - private: - - inline int FindSprm (unsigned short sprm) - { - for (size_t i = 0; i < m_arRun.size(); ++i) - { - if (sprm == m_arRun[i].GetSprmCode()) - return i; - } - - return -1; - } - - private: - - bool m_bIsRenewed; - - std::string m_strName; - - PrlList m_arRun; - PrlList m_arParagraph; - }; - -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ItcFirstLim.h b/ASCOfficeDocFile_old/DocxDocConverter/ItcFirstLim.h deleted file mode 100644 index c6842f921a..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ItcFirstLim.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union ItcFirstLim - { - private: - struct - { - unsigned short itcFirst:8; - unsigned short itcLim:8; - } ItcFirstLimStruct; - unsigned short ItcFirstLimShort; - - public: - - explicit ItcFirstLim( unsigned char _itcFirst, unsigned char _itcLim ) : ItcFirstLimShort(0) - { - this->ItcFirstLimStruct.itcFirst = _itcFirst; - - if ( _itcLim < this->ItcFirstLimStruct.itcFirst ) - { - this->ItcFirstLimStruct.itcLim = this->ItcFirstLimStruct.itcFirst; - } - else - { - this->ItcFirstLimStruct.itcLim = _itcLim; - } - } - - operator short() const - { - return this->ItcFirstLimShort; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LFO.h b/ASCOfficeDocFile_old/DocxDocConverter/LFO.h deleted file mode 100644 index cf7ec94ee5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LFO.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" -#include "grfhic.h" - -namespace ASCDocFileFormat -{ - class LFO: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 16; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - LFO() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit LFO( int _lsid, unsigned char _clfolvl, Constants::LFOField _ibstFltAutoNum, grfhic _grfhic ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( this->bytes, _lsid ); - - this->bytes[sizeof(_lsid) + sizeof(int) + sizeof(int)] = _clfolvl; - this->bytes[sizeof(_lsid) + sizeof(int) + sizeof(int) + sizeof(_clfolvl)] = (unsigned char)_ibstFltAutoNum; - this->bytes[sizeof(_lsid) + sizeof(int) + sizeof(int) + sizeof(_clfolvl) + sizeof(unsigned char)] = (unsigned char)_grfhic; - } - - LFO( const LFO& _lFO ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _lFO.bytes, SIZE_IN_BYTES ); - } - - virtual ~LFO() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LFOData.h b/ASCOfficeDocFile_old/DocxDocConverter/LFOData.h deleted file mode 100644 index f84347683b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LFOData.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LFOLVL.h" - -namespace ASCDocFileFormat -{ - class LFOData: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - - LFOData() : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = sizeof(unsigned int); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0xFF, this->sizeInBytes ); - } - } - } - - explicit LFOData( unsigned int _cp, const vector& _rgLfoLvl ) : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = sizeof(_cp); - - for ( vector::const_iterator iter = _rgLfoLvl.begin(); iter != _rgLfoLvl.end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, _cp ); - - unsigned int offset = 0; - - for ( vector::const_iterator iter = _rgLfoLvl.begin(); iter != _rgLfoLvl.end(); iter++ ) - { - memcpy( ( this->bytes + sizeof(_cp) + offset ), (unsigned char*)(*iter), iter->Size() ); - - offset += iter->Size(); - } - } - } - } - - LFOData( const LFOData& _lFOData ) : bytes(NULL), sizeInBytes(_lFOData.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _lFOData.bytes, this->sizeInBytes ); - } - } - - virtual ~LFOData() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LFOLVL.h b/ASCOfficeDocFile_old/DocxDocConverter/LFOLVL.h deleted file mode 100644 index 9a397de869..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LFOLVL.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LVL.h" - -namespace ASCDocFileFormat -{ - class LFOLVL: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - - LFOLVL() : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = ( sizeof(int) + sizeof(unsigned int) ); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - } - - explicit LFOLVL( int _iStartAt, unsigned char _iLvl, bool _fStartAt, grfhic _grfhic, const LVL* _lvl = NULL ) : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = ( sizeof(_iStartAt) + sizeof(unsigned int) ); - - if ( _lvl != NULL ) - { - this->sizeInBytes += _lvl->Size(); - } - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - int iStartAt = 0; - - if ( _iStartAt > 0x7FFF ) - { - iStartAt = 0x7FFF; - } - else if ( _iStartAt < 0 ) - { - iStartAt = 0; - } - else - { - iStartAt = _iStartAt; - } - - FormatUtils::SetBytes( this->bytes, iStartAt ); - - unsigned int flags = 0; - unsigned int fStartAt = 0; - unsigned int fFormatting = 0; - unsigned int grfhicValue = (unsigned int)(unsigned char)_grfhic; - grfhicValue <<= 6; - - ( _iLvl <= 0x08 ) ? ( flags = _iLvl ) : ( flags = 0x08 ); - ( _fStartAt ) ? ( fStartAt = 0x10 ) : ( fStartAt = 0 ); - ( _lvl != NULL ) ? ( fFormatting = 0x20 ) : ( fFormatting = 0 ); - - flags |= ( fStartAt | fFormatting | grfhicValue ); - - FormatUtils::SetBytes( ( this->bytes + sizeof(iStartAt) ), flags ); - - if ( _lvl != NULL ) - { - memcpy( ( this->bytes + sizeof(iStartAt) + sizeof(flags) ), (unsigned char*)(*_lvl), _lvl->Size() ); - } - } - } - } - - LFOLVL( const LFOLVL& _lFOLVL ) : bytes(NULL), sizeInBytes(_lFOLVL.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _lFOLVL.bytes, this->sizeInBytes ); - } - } - - virtual ~LFOLVL() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LID.h b/ASCOfficeDocFile_old/DocxDocConverter/LID.h deleted file mode 100644 index 01c4dbdc0e..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LID.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Common/LanguageCodes.h" - -namespace ASCDocFileFormat -{ - class LID: public IOperand - { - private: - DocFileFormat::LanguageCode lid; - - public: - LID(): - lid(DocFileFormat::Nothing) - { - } - - explicit LID( DocFileFormat::LanguageCode _lid ): - lid(_lid) - { - } - - virtual ~LID() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(&(this->lid)); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(&(this->lid)); - } - - virtual unsigned int Size() const - { - return sizeof(unsigned short); - } - - operator unsigned int() const - { - return (unsigned int)this->lid; - } - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPStd.h b/ASCOfficeDocFile_old/DocxDocConverter/LPStd.h deleted file mode 100644 index c033b352c2..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPStd.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Stdf.h" -#include "Xstz.h" -#include "GrLPUpxSw.h" - -namespace ASCDocFileFormat -{ - class STD: public IOperand - { - friend class LPStd; - - public: - STD(): bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - explicit STD( const Stdf& _stdf, const Xstz& _xstzName, const GrLPUpxSw& _grLPUpxSw ): bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytes = ( _stdf.Size() + _xstzName.Size() + _grLPUpxSw.Size() ); - this->sizeInBytesWithoutPadding = ( _stdf.Size() + _xstzName.Size() + _grLPUpxSw.SizeWithoutPadding() ); - this->properties = _grLPUpxSw.GetProperties(); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if (bytes) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_stdf, _stdf.Size() ); - memcpy( ( this->bytes + _stdf.Size() ), (unsigned char*)_xstzName, _xstzName.Size() ); - memcpy( ( this->bytes + _stdf.Size() + _xstzName.Size() ), (unsigned char*)_grLPUpxSw, _grLPUpxSw.Size() ); - } - } - - STD( const STD& _sTD ) : properties(_sTD.properties), bytes(NULL), sizeInBytes(_sTD.sizeInBytes), sizeInBytesWithoutPadding(_sTD.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _sTD.bytes, this->sizeInBytes ); - } - } - - virtual ~STD() - { - RELEASEARRAYOBJECTS(bytes); - } - - const vector GetProperties() const - { - return this->properties; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - private: - - vector properties; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; - - class LPStd: public IOperand - { - private: - vector properties; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - public: - LPStd() : bytes(NULL), sizeInBytes(sizeof(short)), sizeInBytesWithoutPadding(sizeof(short)) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - - explicit LPStd( const STD& _std ) : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - STD std(_std); - - FormatUtils::SetBytes( ( std.bytes + 6 ), (unsigned short)std.Size()/*SizeWithoutPadding()*/ ); - - this->sizeInBytes = ( sizeof(short) + std.Size() ); - this->sizeInBytesWithoutPadding = ( sizeof(short) + std.SizeWithoutPadding() ); - this->properties = _std.GetProperties(); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (short)std.Size()/*SizeWithoutPadding()*/ ); - - memcpy( ( this->bytes + sizeof(short) ), (unsigned char*)std, std.Size() ); - // заполняем поле bchUpe StdfBase - FormatUtils::SetBytes( this->bytes + sizeof(short) + 6, (short)std.Size() ); - } - } - - LPStd( const LPStd& _lPStd ) : properties(_lPStd.properties), bytes(NULL), sizeInBytes(_lPStd.sizeInBytes), sizeInBytesWithoutPadding(_lPStd.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _lPStd.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const LPStd& _lPStd ) - { - return ( ( this->sizeInBytes == _lPStd.sizeInBytes ) && - ( this->sizeInBytesWithoutPadding == _lPStd.sizeInBytesWithoutPadding ) && - ( memcmp( this->bytes, _lPStd.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const LPStd& _lPStd ) - { - return !( this->operator == ( _lPStd ) ); - } - - LPStd& operator = ( const LPStd& _lPStd ) - { - if ( *this != _lPStd ) - { - RELEASEARRAYOBJECTS(bytes); - - this->sizeInBytes = _lPStd.sizeInBytes; - this->sizeInBytesWithoutPadding = _lPStd.sizeInBytesWithoutPadding; - this->properties = _lPStd.properties; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _lPStd.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~LPStd() - { - RELEASEARRAYOBJECTS(bytes); - } - - const vector GetProperties() const - { - return this->properties; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPStshi.h b/ASCOfficeDocFile_old/DocxDocConverter/LPStshi.h deleted file mode 100644 index 66a1b5dfae..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPStshi.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "STSHI.h" - -namespace ASCDocFileFormat -{ - class LPStshi : public IOperand - { - public: - - LPStshi () : bytes(NULL), sizeInBytes(0) - { - - } - - LPStshi( const STSHI& oSTSHI ): bytes(NULL), sizeInBytes(0) - { - sizeInBytes = ( sizeof(unsigned short) + oSTSHI.Size() ); - - bytes = new unsigned char[sizeInBytes]; - - if ( NULL != bytes ) - { - memset ( bytes, 0, sizeInBytes ); - - FormatUtils::SetBytes( bytes, (unsigned short)oSTSHI.Size() ); - memcpy ( ( bytes + sizeof(unsigned short) ), (unsigned char*)oSTSHI, oSTSHI.Size() ); - } - } - - LPStshi (const LPStshi& oLPStshi) : bytes (NULL), sizeInBytes (oLPStshi.sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - - if ( NULL != bytes ) - { - memset ( bytes, 0, sizeInBytes ); - memcpy ( bytes, oLPStshi.bytes, sizeInBytes ); - } - } - - virtual ~LPStshi() - { - RELEASEARRAYOBJECTS(bytes); - } - - virtual operator unsigned char*() const - { - return bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)bytes; - } - - virtual unsigned int Size() const - { - return sizeInBytes; - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPStshiGrpPrl.h b/ASCOfficeDocFile_old/DocxDocConverter/LPStshiGrpPrl.h deleted file mode 100644 index 2f738c30dd..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPStshiGrpPrl.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class LPStshiGrpPrl: public IOperand - { - public: - - LPStshiGrpPrl() : bytes(NULL), sizeInBytes(0) - { - } - - explicit LPStshiGrpPrl( const vector& _grpprl ) : bytes(NULL), sizeInBytes(0), grpprl(_grpprl) - { - this->sizeInBytes = sizeof(int); - - for ( vector::const_iterator iter = this->grpprl.begin(); iter != this->grpprl.end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (int)( this->sizeInBytes - sizeof(int) ) ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( vector::iterator iter = this->grpprl.begin(); iter != this->grpprl.end(); iter++ ) - { - prlBytes = iter->GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + sizeof(int) + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - - LPStshiGrpPrl( const LPStshiGrpPrl& _lPStshiGrpPrl ) : bytes(NULL), sizeInBytes(_lPStshiGrpPrl.sizeInBytes), grpprl(_lPStshiGrpPrl.grpprl) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _lPStshiGrpPrl.bytes, this->sizeInBytes ); - } - } - - virtual ~LPStshiGrpPrl() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - vector grpprl; - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxChpx.h b/ASCOfficeDocFile_old/DocxDocConverter/LPUpxChpx.h deleted file mode 100644 index db5a1fc5ed..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxChpx.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class UpxChpx: public IOperand - { - public: - UpxChpx() : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - } - - UpxChpx( const vector& _grpprlChpx ) : grpprlChpx(_grpprlChpx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - for ( vector::const_iterator iter = this->grpprlChpx.begin(); iter != this->grpprlChpx.end(); iter++ ) - { - this->sizeInBytesWithoutPadding += iter->Size(); - } - - this->sizeInBytes = this->sizeInBytesWithoutPadding; - - if ( this->sizeInBytes > 0 ) - { - //The padding to be an even length - if ( this->sizeInBytes % 2 != 0 ) - { - this->sizeInBytes++; - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( vector::iterator iter = this->grpprlChpx.begin(); iter != this->grpprlChpx.end(); iter++ ) - { - prlBytes = iter->GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - } - - UpxChpx( const UpxChpx& _upxChpx ) : grpprlChpx(_upxChpx.grpprlChpx), bytes(NULL), sizeInBytes(_upxChpx.sizeInBytes),sizeInBytesWithoutPadding(_upxChpx.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _upxChpx.bytes, this->sizeInBytes ); - } - } - - virtual ~UpxChpx() - { - RELEASEARRAYOBJECTS (bytes); - } - - UpxChpx& operator = ( const UpxChpx& _upxChpx ) - { - if ( this != &_upxChpx ) - { - RELEASEARRAYOBJECTS (bytes); - - this->grpprlChpx = _upxChpx.grpprlChpx; - this->sizeInBytes = _upxChpx.sizeInBytes; - this->sizeInBytesWithoutPadding = _upxChpx.sizeInBytesWithoutPadding; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _upxChpx.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - const vector GetProperties() const - { - return this->grpprlChpx; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - private: - - vector grpprlChpx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; - - class LPUpxChpx : public IOperand - { - private: - - void Init() - { - this->sizeInBytes = ( sizeof(unsigned short) + this->upxChpx.Size() ); - this->sizeInBytesWithoutPadding = ( sizeof(unsigned short) + this->upxChpx.SizeWithoutPadding() ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (unsigned short)this->upxChpx.SizeWithoutPadding() ); - - memcpy( ( this->bytes + sizeof(unsigned short) ), (unsigned char*)this->upxChpx, this->upxChpx.Size() ); - } - } - public: - - LPUpxChpx(): upxChpx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - LPUpxChpx( const UpxChpx& _upxChpx ): upxChpx(_upxChpx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - LPUpxChpx( const LPUpxChpx& _lPUpxChpx ) : upxChpx(_lPUpxChpx.upxChpx), bytes(NULL), sizeInBytes(_lPUpxChpx.sizeInBytes), sizeInBytesWithoutPadding(_lPUpxChpx.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0 ,this->sizeInBytes ); - - memcpy( this->bytes, _lPUpxChpx.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const LPUpxChpx& _lPUpxChpx ) - { - return ( ( this->sizeInBytes == _lPUpxChpx.sizeInBytes ) && - ( this->sizeInBytesWithoutPadding == _lPUpxChpx.sizeInBytesWithoutPadding ) && - ( memcmp( this->bytes, _lPUpxChpx.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const LPUpxChpx& _lPUpxChpx ) - { - return !( this->operator == ( _lPUpxChpx ) ); - } - - LPUpxChpx& operator = ( const LPUpxChpx& _lPUpxChpx ) - { - if ( this != &_lPUpxChpx ) - { - RELEASEARRAYOBJECTS (bytes); - - this->upxChpx = _lPUpxChpx.upxChpx; - this->sizeInBytes = _lPUpxChpx.sizeInBytes; - this->sizeInBytesWithoutPadding = _lPUpxChpx.sizeInBytesWithoutPadding; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _lPUpxChpx.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~LPUpxChpx() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return this->upxChpx.GetProperties(); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - private: - - UpxChpx upxChpx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxPapx.h b/ASCOfficeDocFile_old/DocxDocConverter/LPUpxPapx.h deleted file mode 100644 index ab2d2eaf61..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxPapx.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class UpxPapx: public IOperand - { - public: - - UpxPapx() : istd(0), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - - } - - explicit UpxPapx( unsigned short _istd, const vector& _grpprlPapx ) : istd(_istd), grpprlPapx(_grpprlPapx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - this->sizeInBytesWithoutPadding = sizeof(this->istd); - - for ( vector::const_iterator iter = this->grpprlPapx.begin(); iter != this->grpprlPapx.end(); iter++ ) - { - this->sizeInBytesWithoutPadding += iter->Size(); - } - - this->sizeInBytes = this->sizeInBytesWithoutPadding; - - if ( this->sizeInBytes > 0 ) - { - //The padding to be an even length - if ( this->sizeInBytes % 2 != 0 ) - { - this->sizeInBytes++; - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, this->istd ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( vector::iterator iter = this->grpprlPapx.begin(); iter != this->grpprlPapx.end(); iter++ ) - { - prlBytes = iter->GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + sizeof(this->istd) + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - } - - UpxPapx( const UpxPapx& _upxPapx ) : istd(_upxPapx.istd), grpprlPapx(_upxPapx.grpprlPapx), bytes(NULL), sizeInBytes(_upxPapx.sizeInBytes), sizeInBytesWithoutPadding(_upxPapx.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _upxPapx.bytes, this->sizeInBytes ); - } - } - - virtual ~UpxPapx() - { - RELEASEARRAYOBJECTS (bytes); - } - - UpxPapx& operator = ( const UpxPapx& _upxPapx ) - { - if ( this != &_upxPapx ) - { - RELEASEARRAYOBJECTS (bytes); - this->istd = _upxPapx.istd; - this->grpprlPapx = _upxPapx.grpprlPapx; - this->sizeInBytes = _upxPapx.sizeInBytes; - this->sizeInBytesWithoutPadding = _upxPapx.sizeInBytesWithoutPadding; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _upxPapx.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - const vector GetProperties() const - { - return this->grpprlPapx; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - - private: - - unsigned short istd; - vector grpprlPapx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; - - class LPUpxPapx: public IOperand - { - private: - UpxPapx upxPapx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - - private: - - void Init() - { - this->sizeInBytes = ( sizeof(unsigned short) + this->upxPapx.Size() ); - this->sizeInBytesWithoutPadding = ( sizeof(unsigned short) + this->upxPapx.SizeWithoutPadding() ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (unsigned short)this->upxPapx.SizeWithoutPadding() ); - - memcpy( ( this->bytes + sizeof(unsigned short) ), (unsigned char*)this->upxPapx, this->upxPapx.Size() ); - } - } - public: - - LPUpxPapx() : upxPapx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - explicit LPUpxPapx( const UpxPapx& _upxPapx ) : upxPapx(_upxPapx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - LPUpxPapx( const LPUpxPapx& _lPUpxPapx ) : upxPapx(_lPUpxPapx.upxPapx), bytes(NULL), sizeInBytes(_lPUpxPapx.sizeInBytes), sizeInBytesWithoutPadding(_lPUpxPapx.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0 ,this->sizeInBytes ); - - memcpy( this->bytes, _lPUpxPapx.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const LPUpxPapx& _lPUpxPapx ) - { - return ( ( this->sizeInBytes == _lPUpxPapx.sizeInBytes ) && - ( this->sizeInBytesWithoutPadding == _lPUpxPapx.sizeInBytesWithoutPadding ) && - ( memcmp( this->bytes, _lPUpxPapx.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const LPUpxPapx& _lPUpxPapx ) - { - return !( this->operator == ( _lPUpxPapx ) ); - } - - LPUpxPapx& operator = ( const LPUpxPapx& _lPUpxPapx ) - { - if ( this != &_lPUpxPapx ) - { - RELEASEARRAYOBJECTS (bytes); - - this->upxPapx = _lPUpxPapx.upxPapx; - this->sizeInBytes = _lPUpxPapx.sizeInBytes; - this->sizeInBytesWithoutPadding = _lPUpxPapx.sizeInBytesWithoutPadding; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _lPUpxPapx.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~LPUpxPapx() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return this->upxPapx.GetProperties(); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxTapx.h b/ASCOfficeDocFile_old/DocxDocConverter/LPUpxTapx.h deleted file mode 100644 index c133723c49..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LPUpxTapx.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Prl.h" - -namespace ASCDocFileFormat -{ - class UpxTapx : public IOperand - { - public: - - UpxTapx() : bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - - } - - UpxTapx( const vector& _grpprlTapx ) : grpprlTapx(_grpprlTapx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - for ( vector::const_iterator iter = this->grpprlTapx.begin(); iter != this->grpprlTapx.end(); iter++ ) - { - this->sizeInBytesWithoutPadding += iter->Size(); - } - - this->sizeInBytes = this->sizeInBytesWithoutPadding; - - if ( this->sizeInBytes > 0 ) - { - //The padding to be an even length - if ( this->sizeInBytes % 2 != 0 ) - { - this->sizeInBytes++; - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( vector::iterator iter = this->grpprlTapx.begin(); iter != this->grpprlTapx.end(); iter++ ) - { - prlBytes = iter->GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - } - } - } - - UpxTapx( const UpxTapx& _upxTapx ): - grpprlTapx(_upxTapx.grpprlTapx), bytes(NULL), sizeInBytes(_upxTapx.sizeInBytes), - sizeInBytesWithoutPadding(_upxTapx.sizeInBytesWithoutPadding) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _upxTapx.bytes, this->sizeInBytes ); - } - } - - virtual ~UpxTapx() - { - RELEASEARRAYOBJECTS (bytes); - } - - UpxTapx& operator = ( const UpxTapx& _upxTapx ) - { - if ( this != &_upxTapx ) - { - RELEASEARRAYOBJECTS (bytes); - - this->grpprlTapx = _upxTapx.grpprlTapx; - this->sizeInBytes = _upxTapx.sizeInBytes; - this->sizeInBytesWithoutPadding = _upxTapx.sizeInBytesWithoutPadding; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _upxTapx.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - const vector GetProperties() const - { - return this->grpprlTapx; - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return this->sizeInBytesWithoutPadding; - } - private: - - vector grpprlTapx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; - - class LPUpxTapx : public IOperand - { - public: - - LPUpxTapx () : upxTapx(), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - LPUpxTapx (const UpxTapx& _upxTapx) : upxTapx(_upxTapx), bytes(NULL), sizeInBytes(0), sizeInBytesWithoutPadding(0) - { - Init(); - } - - LPUpxTapx (const LPUpxTapx& _lPUpxTapx) : upxTapx(_lPUpxTapx.upxTapx), bytes(NULL), sizeInBytes(_lPUpxTapx.sizeInBytes), sizeInBytesWithoutPadding(_lPUpxTapx.sizeInBytesWithoutPadding) - { - bytes = new unsigned char[sizeInBytes]; - - if ( bytes != NULL ) - { - memset( bytes, 0, sizeInBytes ); - memcpy( bytes, _lPUpxTapx.bytes, sizeInBytes ); - } - } - - bool operator == (const LPUpxTapx& _lPUpxTapx) - { - return ( ( this->sizeInBytes == _lPUpxTapx.sizeInBytes ) && ( this->sizeInBytesWithoutPadding == _lPUpxTapx.sizeInBytesWithoutPadding ) && ( memcmp( this->bytes, _lPUpxTapx.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != (const LPUpxTapx& _lPUpxTapx) - { - return !( this->operator == ( _lPUpxTapx ) ); - } - - LPUpxTapx& operator = (const LPUpxTapx& _lPUpxTapx) - { - if ( this != &_lPUpxTapx ) - { - RELEASEARRAYOBJECTS (bytes); - - upxTapx = _lPUpxTapx.upxTapx; - sizeInBytes = _lPUpxTapx.sizeInBytes; - sizeInBytesWithoutPadding = _lPUpxTapx.sizeInBytesWithoutPadding; - - bytes = new unsigned char[sizeInBytes]; - - if ( bytes != NULL ) - { - memcpy ( bytes, _lPUpxTapx.bytes, sizeInBytes ); - } - } - - return *this; - } - - virtual ~LPUpxTapx() - { - RELEASEARRAYOBJECTS (bytes); - } - - const vector GetProperties() const - { - return upxTapx.GetProperties(); - } - - virtual operator unsigned char*() const - { - return bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)bytes; - } - - virtual unsigned int Size() const - { - return sizeInBytes; - } - - unsigned int SizeWithoutPadding() const - { - return sizeInBytesWithoutPadding; - } - - - private: - - void Init() - { - this->sizeInBytes = ( sizeof(unsigned short) + this->upxTapx.Size() ); - this->sizeInBytesWithoutPadding = ( sizeof(unsigned short) + this->upxTapx.SizeWithoutPadding() ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (unsigned short)this->upxTapx.SizeWithoutPadding() ); - - memcpy( ( this->bytes + sizeof(unsigned short) ), (unsigned char*)this->upxTapx, this->upxTapx.Size() ); - } - } - private: - - UpxTapx upxTapx; - - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int sizeInBytesWithoutPadding; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LSD.h b/ASCOfficeDocFile_old/DocxDocConverter/LSD.h deleted file mode 100644 index 8086b2ec40..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LSD.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - static const unsigned int LatentStylesTemplate [267] = - { - 8, 152, 158, 158, 158, 158, 158, 158, 158, 158, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 630, - 630, 630, 630, 630, 630, 630, 630, 630, 1590, 1590, 1590, 1590, 1590, 1590, 574, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 168, 1590, 1590, 22, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 184, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 360, 328, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 944, 1590, 1586, 24, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, - 1088, 1104, 1120, 1136, 1152, 1168, 960, 976, 992, 1008, 1024, 1040, 1586, 552, 472, 488, 1056, 1072, 1088, - 1104, 1120, 1136, 1152, 1168, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, 1120, 1136, 1152, - 1168, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, 1120, 1136, 1152, 1168, 960, 976, 992, 1008, - 1024, 1040, 1056, 1072, 1088, 1104, 1120, 1136, 1152, 1168, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, - 1088, 1104, 1120, 1136, 1152, 1168, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, 1120, 1136, - 1152, 1168, 312, 344, 504, 520, 536, 598, 638 - }; - - union LSD - { - private: - struct - { - unsigned int fLocked : 1; - unsigned int fSemiHidden : 1; - unsigned int fUnhideWhenUsed : 1; - unsigned int fQFormat : 1; - unsigned int iPriority : 12; - unsigned int fReserved : 16; - } LSDStruct; - unsigned int LSDUnsignedInt; - - public: - - LSD () : LSDUnsignedInt(0) - { - - } - - LSD (unsigned int _lsd): LSDUnsignedInt(_lsd) - { - - } - - LSD (bool _fLocked, bool _fSemiHidden, bool _fUnhideWhenUsed, bool _fQFormat, unsigned short _iPriority) : LSDUnsignedInt(0) - { - ( _fLocked ) ? ( LSDStruct.fLocked = 1 ) : ( LSDStruct.fLocked = 0 ); - ( _fSemiHidden ) ? ( LSDStruct.fSemiHidden = 1 ) : ( LSDStruct.fSemiHidden = 0 ); - ( _fUnhideWhenUsed ) ? ( LSDStruct.fUnhideWhenUsed = 1 ) : ( LSDStruct.fUnhideWhenUsed = 0 ); - ( _fQFormat ) ? ( LSDStruct.fQFormat = 1 ) : ( LSDStruct.fQFormat = 0 ); - - if ( _iPriority > 0x0063 ) - { - LSDStruct.iPriority = 0x0063; - } - else - { - LSDStruct.iPriority = _iPriority; - } - } - - operator unsigned int() const - { - return LSDUnsignedInt; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LSPD.h b/ASCOfficeDocFile_old/DocxDocConverter/LSPD.h deleted file mode 100644 index 1558a6e840..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LSPD.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class LSPD: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 4; - - short dyaLine; - short fMultLinespace; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - LSPD(): - dyaLine(0), fMultLinespace(0) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit LSPD( short _dyaLine, bool _fMultLinespace = true ): - dyaLine(0), fMultLinespace(0) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - this->dyaLine = _dyaLine; - ( _fMultLinespace ) ? ( this->fMultLinespace = 0x0001 ) : ( this->fMultLinespace = 0x0000 ); - - FormatUtils::SetBytes( this->bytes, this->dyaLine ); - FormatUtils::SetBytes( ( this->bytes + sizeof(this->dyaLine) ), this->fMultLinespace ); - } - - LSPD( const LSPD& _lspd ): - dyaLine(_lspd.dyaLine), fMultLinespace(_lspd.fMultLinespace) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _lspd.bytes, SIZE_IN_BYTES ); - } - - virtual ~LSPD() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return SIZE_IN_BYTES; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LSTF.h b/ASCOfficeDocFile_old/DocxDocConverter/LSTF.h deleted file mode 100644 index f38f9da9ec..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LSTF.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Tplc.h" -#include "grfhic.h" - -namespace ASCDocFileFormat -{ - class LSTF: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 28; - static const unsigned char RGISTD_PARA_COUNT = 9; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - LSTF() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit LSTF( int _lsid, const Tplc* _tplc, bool _fSimpleList, - bool _fAutoNum, bool _fHybrid, grfhic _grfhic, const vector* _rgistdPara = NULL ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( this->bytes, _lsid ); - - if ( _tplc != NULL ) - { - FormatUtils::SetBytes( ( this->bytes + sizeof(_lsid) ), (unsigned int)(*_tplc) ); - } - else - { - FormatUtils::SetBytes( ( this->bytes + sizeof(_lsid) ), (unsigned int)0 ); - } - - if ( ( _rgistdPara != NULL ) && ( _rgistdPara->size() == RGISTD_PARA_COUNT ) ) - { - for ( unsigned int i = 0; i < RGISTD_PARA_COUNT; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + sizeof(_lsid) + sizeof(unsigned int) + ( i * sizeof(short) ) ), _rgistdPara->at( i ) ); - } - } - else - { - for ( unsigned int i = 0; i < RGISTD_PARA_COUNT; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + sizeof(_lsid) + sizeof(unsigned int) + ( i * sizeof(short) ) ), (short)0x0FFF ); - } - } - - unsigned char simpleListAutoNumHybridFlags = 0x00; - unsigned char fSimpleList = 0x00; - unsigned char fAutoNum = 0x00; - unsigned char fHybrid = 0x00; - - ( _fSimpleList ) ? ( fSimpleList = 0x01 ) : ( fSimpleList = 0x00 ); - ( _fAutoNum ) ? ( fAutoNum = 0x04 ) : ( fAutoNum = 0x00 ); - ( _fHybrid ) ? ( fHybrid = 0x10 ) : ( fHybrid = 0x00 ); - - simpleListAutoNumHybridFlags |= ( fSimpleList | fAutoNum | fHybrid ); - - this->bytes[sizeof(_lsid) + sizeof(unsigned int) + ( RGISTD_PARA_COUNT * sizeof(short) )] = simpleListAutoNumHybridFlags; - this->bytes[sizeof(_lsid) + sizeof(unsigned int) + ( RGISTD_PARA_COUNT * sizeof(short) ) + sizeof(simpleListAutoNumHybridFlags)] = (unsigned char)_grfhic; - } - - LSTF( const LSTF& _lSTF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _lSTF.bytes, SIZE_IN_BYTES ); - } - - virtual ~LSTF() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LVL.h b/ASCOfficeDocFile_old/DocxDocConverter/LVL.h deleted file mode 100644 index 38dcd06b0d..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LVL.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LVLF.h" -#include "Prl.h" -#include "Xstz.h" - -namespace ASCDocFileFormat -{ - class LVL : public IOperand - { - public: - - LVL() : bytes(NULL), sizeInBytes(0) - { - - } - - explicit LVL( const LVLF& _lvlf, const vector& _grpprlPapx, const vector& _grpprlChpx, const Xst& _xst ) : bytes(NULL), sizeInBytes(0) - { - LVLF lvlf( _lvlf ); - unsigned int lvlfSize = lvlf.Size(); - - this->sizeInBytes = lvlfSize; - - unsigned int cbGrpprlChpx = 0; - unsigned int cbGrpprlPapx = 0; - - for ( vector::const_iterator iter = _grpprlPapx.begin(); iter != _grpprlPapx.end(); iter++ ) - { - cbGrpprlPapx += iter->Size(); - } - - for ( vector::const_iterator iter = _grpprlChpx.begin(); iter != _grpprlChpx.end(); iter++ ) - { - cbGrpprlChpx += iter->Size(); - } - - this->sizeInBytes += cbGrpprlChpx; - this->sizeInBytes += cbGrpprlPapx; - - //Get one-based character offset to a level placeholder in xst.rgtchar. - const vector rgbxchNums = this->GetRgbxchNums( _xst ); - //rgbxchNums starts at 6 unsigned char. Size MUST be 9 bytes. - unsigned int rgbxchNumsOffset = 6; - - //Write real rgbxchNums to the lvlf. - for ( vector::const_iterator iter = rgbxchNums.begin(); iter != rgbxchNums.end(); iter++ ) - { - lvlf.bytes[rgbxchNumsOffset++] = *iter; - } - - //Write real size of grpprlPapx ( 25 unsigned char ) and grpprlChpx ( 24 unsigned char ) to the lvlf. - lvlf.bytes[24] = cbGrpprlChpx; - lvlf.bytes[25] = cbGrpprlPapx; - - this->sizeInBytes += _xst.Size(); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)lvlf, lvlfSize ); - - unsigned char* prlBytes = NULL; - unsigned long prlSize = 0; - unsigned int prlPrevSize = 0; - - for ( unsigned int i = 0; i < _grpprlPapx.size(); i++ ) - { - prlBytes = _grpprlPapx[i].GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + lvlfSize + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - - prlBytes = NULL; - prlSize = 0; - prlPrevSize = 0; - - for ( unsigned int i = 0; i < _grpprlChpx.size(); i++ ) - { - prlBytes = _grpprlChpx[i].GetBytes( &prlSize ); - - if ( prlBytes != NULL ) - { - memcpy( ( this->bytes + lvlfSize + cbGrpprlPapx + prlPrevSize ), prlBytes, prlSize ); - prlPrevSize += prlSize; - - RELEASEARRAYOBJECTS (prlBytes); - } - } - - memcpy( ( this->bytes + lvlfSize + cbGrpprlPapx + cbGrpprlChpx ), (unsigned char*)_xst, _xst.Size() ); - } - } - } - - LVL( const LVL& _lVL ) : bytes(NULL), sizeInBytes(_lVL.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _lVL.bytes, this->sizeInBytes ); - } - } - - LVL& operator = ( const LVL& _lVL ) - { - if ( this != &_lVL ) - { - RELEASEARRAYOBJECTS (bytes); - - this->sizeInBytes = _lVL.sizeInBytes; - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _lVL.bytes, this->sizeInBytes ); - } - } - } - - return *this; - } - - virtual ~LVL() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - private: - const vector GetRgbxchNums( const Xst& _xst ) const - { - vector rgbxchNums( 9, 0 ); - - vector xstElements = _xst.GetElements(); - - for ( unsigned int i = 0, j = 0; i < xstElements.size(); i++ ) - { - if ( ( xstElements[i] == (wchar_t)0x0000 ) || ( xstElements[i] == (wchar_t)0x0001 ) || ( xstElements[i] == (wchar_t)0x0002 ) || - ( xstElements[i] == (wchar_t)0x0003 ) || ( xstElements[i] == (wchar_t)0x0004 ) || ( xstElements[i] == (wchar_t)0x0005 ) || - ( xstElements[i] == (wchar_t)0x0006 ) || ( xstElements[i] == (wchar_t)0x0007 ) || ( xstElements[i] == (wchar_t)0x0008 ) ) - { - rgbxchNums[j++] = ( i + 1 ); - } - } - - return rgbxchNums; - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/LVLF.h b/ASCOfficeDocFile_old/DocxDocConverter/LVLF.h deleted file mode 100644 index 3e93c3f882..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/LVLF.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" -#include "grfhic.h" - -namespace ASCDocFileFormat -{ - static const char NumberFormatCodes[60][29] = - { - "decimal", - "upperRoman", - "lowerRoman", - "upperLetter", - "lowerLetter", - "ordinal", - "cardinalText", - "ordinalText", - "hex", - "chicago", - "ideographDigital", - "japaneseCounting", - "aiueo", - "iroha", - "decimalFullWidth", - "decimalHalfWidth", - "japaneseLegal", - "japaneseDigitalTenThousand", - "decimalEnclosedCircle", - "decimalFullWidth2", - "aiueoFullWidth", - "irohaFullWidth", - "decimalZero", - "bullet", - "ganada", - "chosung", - "decimalEnclosedFullstop", - "decimalEnclosedParen", - "decimalEnclosedCircleChinese", - "ideographEnclosedCircle", - "ideographTraditional", - "ideographZodiac", - "ideographZodiacTraditional", - "taiwaneseCounting", - "ideographLegalTraditional", - "taiwaneseCountingThousand", - "taiwaneseDigital", - "chineseCounting", - "chineseLegalSimplified", - "chineseCountingThousand", - "koreanDigital", - "koreanCounting", - "koreanLegal", - "koreanDigital2", - "vietnameseCounting", - "russianLower", - "russianUpper", - "none", - "numberInDash", - "hebrew1", - "hebrew2", - "arabicAlpha", - "arabicAbjad", - "hindiVowels", - "hindiConsonants", - "hindiNumbers", - "hindiCounting", - "thaiLetters", - "thaiNumbers", - "thaiCounting" - }; - - class LVLF: public IOperand - { - friend class LVL; - - private: - static const unsigned char SIZE_IN_BYTES = 28; - static const unsigned char RGBXCH_NUMS_COUNT = 9; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - LVLF() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit LVLF( int _iStartAt, Constants::MSONFC _nfc, Constants::LevelJustification _jc, bool _fLegal, - bool _fNoRestart, bool _fIndentSav, bool _fConverted, bool _fTentative, - Constants::CharacterFollows _ixchFollow, int _dxaIndentSav, unsigned char _ilvlRestartLim, grfhic _grfhic, - const vector* _rgbxchNums = NULL /*LVL can set this value*/, unsigned char _cbGrpprlChpx = 0 /*LVL can set this value.*/, unsigned char _cbGrpprlPapx = 0 /*LVL can set this value.*/ ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - int iStartAt = 0; - - if ( _iStartAt > 0x7FFF ) - { - iStartAt = 0x7FFF; - } - else if ( _iStartAt < 0 ) - { - iStartAt = 0; - } - else - { - iStartAt = _iStartAt; - } - - FormatUtils::SetBytes( ( this->bytes + offset ), iStartAt ); - offset += sizeof(iStartAt); - - unsigned char nfc = 0x00; - - if ( ( _nfc != Constants::msonfcHex ) && ( _nfc != Constants::msonfcChiManSty ) && - ( _nfc != Constants::msonfcSbChar ) && ( _nfc != Constants::msonfcDArabic ) ) - { - nfc = (unsigned char)_nfc; - } - - this->bytes[offset] = nfc; - offset += sizeof(nfc); - - unsigned char flags = (unsigned char)_jc; - unsigned char fLegal = 0x00; - unsigned char fNoRestart = 0x00; - unsigned char fIndentSav = 0x00; - unsigned char fConverted = 0x00; - unsigned char fTentative = 0x00; - - ( _fLegal ) ? ( fLegal = 0x04 ) : ( fLegal = 0x00 ); - ( _fNoRestart ) ? ( fNoRestart = 0x08 ) : ( fNoRestart = 0x00 ); - ( _fIndentSav ) ? ( fIndentSav = 0x10 ) : ( fIndentSav = 0x00 ); - ( _fConverted ) ? ( fConverted = 0x20 ) : ( fConverted = 0x00 ); - ( _fTentative ) ? ( fTentative = 0x80 ) : ( fTentative = 0x00 ); - - flags |= ( fLegal | fNoRestart | fIndentSav | fConverted | fTentative ); - this->bytes[offset] = flags; - offset += sizeof(flags); - - if ( ( _rgbxchNums != NULL ) && ( _rgbxchNums->size() == RGBXCH_NUMS_COUNT ) ) - { - for ( vector::const_iterator iter = _rgbxchNums->begin(); iter != _rgbxchNums->end(); iter++ ) - { - this->bytes[offset] = *iter; - offset += sizeof(*iter); - } - } - else - { - offset += ( RGBXCH_NUMS_COUNT * sizeof(unsigned char) ); - } - - this->bytes[offset] = (unsigned char)_ixchFollow; - offset += sizeof(unsigned char); - - int dxaIndentSav = 0; - - if ( _fIndentSav ) - { - if ( _dxaIndentSav > 0x00007BC0 ) - { - dxaIndentSav = 0x00007BC0; - } - else if ( _dxaIndentSav < 0xFFFF8440 ) - { - dxaIndentSav = 0xFFFF8440; - } - else - { - dxaIndentSav = _dxaIndentSav; - } - } - - FormatUtils::SetBytes( ( this->bytes + offset ), dxaIndentSav ); - offset += sizeof(dxaIndentSav); - - offset += sizeof(int); //MUST be ignored. - - this->bytes[offset] = _cbGrpprlChpx; - offset += sizeof(_cbGrpprlChpx); - - this->bytes[offset] = _cbGrpprlPapx; - offset += sizeof(_cbGrpprlPapx); - - this->bytes[offset] = _ilvlRestartLim; - offset += sizeof(_ilvlRestartLim); - - this->bytes[offset] = (unsigned char)_grfhic; - offset += sizeof(unsigned char); - } - - LVLF( const LVLF& _lVLF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _lVLF.bytes, SIZE_IN_BYTES ); - } - - virtual ~LVLF() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/List.cpp b/ASCOfficeDocFile_old/DocxDocConverter/List.cpp deleted file mode 100644 index 1e133899d9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/List.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "List.h" - -namespace ASCDocFileFormat -{ - List::List(short _numID): numID(_numID), level(0) - { - } - - List::List(const list& _textItems, short _numID) : textItems(_textItems), numID(_numID), level(0) - { - SetLevel(level); - SetNumID(numID); - } - - List::List(const List& _list) : textItems(_list.textItems), numID(_list.numID), level(_list.level) - { - } - - - void List::SetLevel(unsigned char _level) - { - for (std::list::iterator iter = this->textItems.begin(); iter != this->textItems.end(); ++iter) - { - if (typeid(**iter) == typeid(Paragraph)) - { - Paragraph* paragraph = dynamic_cast(iter->operator->()); - if (paragraph) - { - paragraph->RemoveProperty( (short)DocFileFormat::sprmPIlvl, (unsigned char*)(&(this->level)) ); - paragraph->AddProperty( (short)DocFileFormat::sprmPIlvl, (unsigned char*)(&_level) ); - } - } - else if (typeid(**iter) == typeid(List)) - { - List* subList = dynamic_cast(iter->operator->()); - if (subList) - { - subList->SetLevel(_level + 1); - } - } - } - - this->level = _level; - } - - void List::SetNumID( short _numID ) - { - for (std::list::iterator iter = this->textItems.begin(); iter != textItems.end(); ++iter) - { - if (typeid(**iter) == typeid(Paragraph)) - { - Paragraph* paragraph = dynamic_cast(iter->operator->()); - if (paragraph) - { - paragraph->RemoveProperty( (short)DocFileFormat::sprmPIlfo, (unsigned char*)(&this->numID) ); - paragraph->AddProperty( (short)DocFileFormat::sprmPIlfo, (unsigned char*)(&_numID) ); - } - } - else if (typeid(**iter) == typeid(List)) - { - List* subList = dynamic_cast(iter->operator->()); - if (subList) - { - subList->SetNumID( _numID ); - } - } - } - - numID = _numID; - } - - void List::AddParagraph( const Paragraph& _paragraph ) - { - TextItemPtr newTextItem( static_cast( _paragraph.Clone() ) ); - - this->textItems.push_back( newTextItem ); - } - - void List::AddTextItem( const ITextItem& _textItem ) - { - TextItemPtr newTextItem( static_cast( _textItem.Clone() ) ); - - this->textItems.push_back( newTextItem ); - - this->SetLevel( this->level ); - this->SetNumID( this->numID ); - } - - wstring List::GetAllText() const - { - wstring allListText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - allListText += (*iter)->GetAllText(); - } - - return allListText; - } - - List::operator wstring() const - { - wstring listText; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - listText += (wstring)(**iter); - } - - return listText; - } - - vector List::GetAllParagraphsCopy() const - { - vector allParagraphs; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - if ( typeid(**iter) == typeid(Paragraph) ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*iter)->Clone() ) ) ); - } - else - { - vector textItemParagraphs = (*iter)->GetAllParagraphsCopy(); - - for ( vector::const_iterator textItemIter = textItemParagraphs.begin(); textItemIter != textItemParagraphs.end(); textItemIter++ ) - { - allParagraphs.push_back( TextItemPtr( static_cast( (*textItemIter)->Clone() ) ) ); - } - } - } - - return allParagraphs; - } - - vector List::GetAllParagraphs() - { - std::vector allParagraphs; - - for (std::list::iterator iter = textItems.begin(); iter != textItems.end(); ++iter) - { - if (typeid(**iter) == typeid(Paragraph)) - { - allParagraphs.push_back(iter->operator->()); - } - else - { - std::vector textItemParagraphs = (*iter)->GetAllParagraphs(); - - for (std::vector::iterator textItemIter = textItemParagraphs.begin(); textItemIter != textItemParagraphs.end(); ++textItemIter) - { - allParagraphs.push_back( *textItemIter ); - } - } - } - - return allParagraphs; - } - - vector List::GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int runOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemRunsOffsets; - vector allTextItemRuns = (*iter)->GetAllRunsCopy( &allTextItemRunsOffsets ); - - for ( unsigned int i = 0; i < allTextItemRuns.size(); i++ ) - { - allRuns.push_back( IParagraphItemPtr( static_cast(allTextItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( runOffset + allTextItemRunsOffsets[i] ); - } - - runOffset += ( sizeof(wchar_t) * (*iter)->GetAllText().size() ); - } - } - - return allRuns; - } - - vector List::GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int paragraphItemOffset = 0; - - for ( list::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) - { - vector allTextItemParagraphItemsOffsets; - vector allTextItemParagraphItems = (*iter)->GetAllParagraphItemsCopy( &allTextItemParagraphItemsOffsets ); - - for ( unsigned int i = 0; i < allTextItemParagraphItems.size(); i++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast(allTextItemParagraphItems[i]->Clone()) ) ); - allParagraphItemsOffsets->push_back( paragraphItemOffset + allTextItemParagraphItemsOffsets[i] ); - } - - paragraphItemOffset += ( sizeof(wchar_t) * (*iter)->GetAllText().size() ); - } - } - - return allParagraphItems; - } - - vector List::GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - unsigned int paragraphOffset = 0; - - if (allParagraphsOffsets) - { - std::vector allParagraphs = GetAllParagraphsCopy(); - - for (std::vector::const_iterator iter = allParagraphs.begin(); iter != allParagraphs.end(); ++iter) - { - ITextItem* item = (ITextItem*)(iter->operator->()); - Paragraph* paragraph = dynamic_cast(item); - if (paragraph) - { - allParagraphsProperties.push_back( paragraph->GetProperties()); - allParagraphsOffsets->push_back( paragraphOffset ); - paragraphOffset += (sizeof(wchar_t) * paragraph->GetAllText().size()); - } - } - } - - return allParagraphsProperties; - } - - vector List::GetAllRunProperties( vector* allRunsOffsets ) const - { - vector allRunProperties; - unsigned int runOffset = 0; - - if (allRunsOffsets) - { - std::vector allParagraphs = GetAllParagraphsCopy(); - - for (std::vector::const_iterator iter = allParagraphs.begin(); iter != allParagraphs.end(); ++iter) - { - std::vector paragraphRunProperties; - std::vector paragraphRunsOffsets; - - // - - ITextItem* item = (ITextItem*)(iter->operator->()); - Paragraph* paragraph = dynamic_cast(item); - if (paragraph) - { - paragraphRunProperties = paragraph->GetAllRunProperties(¶graphRunsOffsets); - - for (unsigned int i = 0; i < paragraphRunProperties.size(); ++i) - { - allRunProperties.push_back( paragraphRunProperties[i] ); - allRunsOffsets->push_back( runOffset + paragraphRunsOffsets[i] ); - } - - runOffset += (sizeof(wchar_t) * paragraph->GetAllText().size()); - } - } - } - - return allRunProperties; - } - - List::~List() - { - } - - IVirtualConstructor* List::New() const - { - return new List(); - } - - IVirtualConstructor* List::Clone() const - { - return new List( *this ); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/List.h b/ASCOfficeDocFile_old/DocxDocConverter/List.h deleted file mode 100644 index 05c0a18be3..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/List.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ITextItem.h" -#include "Paragraph.h" - -namespace ASCDocFileFormat -{ - class List: public ITextItem - { - private: - list textItems; - short numID; - unsigned char level; - - protected: - void SetLevel( unsigned char _level ); - void SetNumID( short _numID ); - - public: - List( short _numID = 1 ); - List( const list& _textItems, short _numID = 1 ); - List( const List& _list ); - /*Paragraphs MUST be already with LIST properties set.*/ - void AddParagraph( const Paragraph& _paragraph ); - /*List class sets LIST properties.*/ - void AddTextItem( const ITextItem& _textItem ); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - virtual ~List(); - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ListFormattingInformation.h b/ASCOfficeDocFile_old/DocxDocConverter/ListFormattingInformation.h deleted file mode 100644 index b20b8d3270..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ListFormattingInformation.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PlfLst.h" -#include "LVL.h" - -namespace ASCDocFileFormat -{ - class ListFormattingInformation: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - unsigned int listFormattingInformationSize; - unsigned int listLevelsSize; - - public: - - ListFormattingInformation() : bytes(NULL), sizeInBytes(0), listFormattingInformationSize(0), listLevelsSize(0) - { - } - - explicit ListFormattingInformation( const PlfLst& _plfLst, const vector& _lvls ) : bytes(NULL), sizeInBytes(0), listFormattingInformationSize(0), listLevelsSize(0) - { - this->listFormattingInformationSize = _plfLst.Size(); - - for ( vector::const_iterator iter = _lvls.begin(); iter != _lvls.end(); iter++ ) - { - this->listLevelsSize += iter->Size(); - } - - this->sizeInBytes = ( this->listFormattingInformationSize + this->listLevelsSize ); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, (unsigned char*)_plfLst, _plfLst.Size() ); - - unsigned int offset = _plfLst.Size(); - - for ( vector::const_iterator iter = _lvls.begin(); iter != _lvls.end(); iter++ ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(*iter), iter->Size() ); - offset += iter->Size(); - } - } - } - } - - ListFormattingInformation( const ListFormattingInformation& _lfi ) : bytes(NULL), sizeInBytes(_lfi.sizeInBytes), listFormattingInformationSize(_lfi.listFormattingInformationSize), listLevelsSize(_lfi.listLevelsSize) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _lfi.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const ListFormattingInformation& _lfi ) - { - return ( ( this->sizeInBytes == _lfi.sizeInBytes ) && - ( this->listFormattingInformationSize == _lfi.listFormattingInformationSize ) && - ( this->listLevelsSize == _lfi.listLevelsSize ) && - ( memcmp( this->bytes, _lfi.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const ListFormattingInformation& _lfi ) - { - return !( this->operator == ( _lfi ) ); - } - - ListFormattingInformation& operator = ( const ListFormattingInformation& _lfi ) - { - if ( *this != _lfi ) - { - RELEASEARRAYOBJECTS (bytes); - - this->sizeInBytes = _lfi.sizeInBytes; - this->listFormattingInformationSize = _lfi.listFormattingInformationSize; - this->listLevelsSize = _lfi.listLevelsSize; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _lfi.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~ListFormattingInformation() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - unsigned int ListFormattingInformationSize() const - { - return this->listFormattingInformationSize; - } - - unsigned int ListLevelsSize() const - { - return this->listLevelsSize; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/MFPF.h b/ASCOfficeDocFile_old/DocxDocConverter/MFPF.h deleted file mode 100644 index 4e2738aee8..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/MFPF.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" -#include "../Common/IOperand.h" -#include "../Common/FormatUtils.h" - - -namespace ASCDocFileFormat -{ - class MFPF: public IOperand - { - private: - Constants::PictureDataFormat mm; - static const unsigned char SIZE_IN_BYTES = 8; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - MFPF(): - mm(Constants::MM_SHAPE) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( this->bytes, (short)(this->mm) ); - } - - explicit MFPF( Constants::PictureDataFormat _mm ): - mm(_mm) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( this->bytes, (short)(this->mm) ); - } - - MFPF( const MFPF& _mFPF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _mFPF.bytes, SIZE_IN_BYTES ); - } - - virtual ~MFPF() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - operator Constants::PictureDataFormat() const - { - return this->mm; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Common.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Common.h deleted file mode 100644 index ffffdb43fe..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Common.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../../../DesktopEditor/common/Types.h" -namespace OfficeArt -{ - enum COMPRESSION_METHOD - { - COMPRESSION_METHOD_DEFLATE = 0x00, - COMPRESSION_METHOD_NO_COMPRESSION = 0xFE - }; - - struct POINT - { - int x; - int y; - - POINT(): - x(0), y(0) - { - } - - explicit POINT( int _x, int _y ): - x(_x), y(_y) - { - } - }; - - struct RECT - { - int left; - int top; - int right; - int bottom; - - RECT(): - left(0), top(0), right(0), bottom(0) - { - } - - explicit RECT( int _left, int _top, int _right, int _bottom ): - left(_left), top(_top), right(_right), bottom(_bottom) - { - } - }; - - class EnglishMetricUnit - { - private: - long value; - - public: - explicit EnglishMetricUnit( long _value = 0 ): - value(_value) - { - } - - void FromTwip( long _value ) - { - this->value = ( _value * 65 ); - } - - void FromHalfPoint( long _value ) - { - this->value = ( _value * 6350 ); - } - - void FromPoint( long _value ) - { - this->value = ( _value * 12700 ); - } - - void FromInch( long _value ) - { - this->value = ( _value * 914400 ); - } - - long GetValue() const - { - return this->value; - } - - long ToTwip() const - { - return ( this->value / 65 ); - } - - long ToHalfPoint() const - { - return ( this->value / 6350 ); - } - - long ToPoint() const - { - return ( this->value / 12700 ); - } - - long ToInch() const - { - return ( this->value / 914400 ); - } - }; - - typedef unsigned int MSOSPID; -} - -namespace OfficeArt -{ - struct ADJH - { - int handle[9]; - }; - - struct SG - { - int sg[2]; - }; - -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/ComplexOfficeArtProperty.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/ComplexOfficeArtProperty.h deleted file mode 100644 index 178ee8dcfd..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/ComplexOfficeArtProperty.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtFOPTE.h" - -namespace OfficeArt -{ - struct ComplexOfficeArtProperty - { - public: - ComplexOfficeArtProperty () : officeArtProperty(), m_pComplexData(NULL) - { - } - - ComplexOfficeArtProperty (const OfficeArtFOPTE& office, const unsigned char* pComplexData = NULL) : officeArtProperty(office), m_pComplexData(NULL) - { - // [dataSize + 3*short] - - if (pComplexData) - { - unsigned int bufSize = office.GetValue() + sizeof(unsigned short) * 3; - - m_pComplexData = new unsigned char [ bufSize ]; - if (m_pComplexData) - { - memset (m_pComplexData, 0, bufSize); - memcpy (m_pComplexData, pComplexData, bufSize); - } - } - } - - ComplexOfficeArtProperty (const ComplexOfficeArtProperty& prop) : officeArtProperty(prop.officeArtProperty), m_pComplexData(NULL) - { - // [dataSize + 3*short] - - if (prop.m_pComplexData) - { - unsigned int bufSize = officeArtProperty.GetValue() + sizeof(unsigned short) * 3; - - m_pComplexData = new unsigned char[bufSize]; - if (m_pComplexData) - { - memset (m_pComplexData, 0, bufSize); - memcpy (m_pComplexData, prop.m_pComplexData, bufSize); - } - } - } - - ~ComplexOfficeArtProperty() - { - RELEASEARRAYOBJECTS (m_pComplexData); - } - - public: - - OfficeArtFOPTE officeArtProperty; - unsigned char* m_pComplexData; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/DrawingContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/DrawingContainer.h deleted file mode 100644 index a5ce2944c5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/DrawingContainer.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtRecordHeader.h" -#include "OfficeArtDgContainer.h" - -namespace OfficeArt -{ - class DrawingContainer : public IOperand - { - public: - DrawingContainer () : rh(0xF, 0x000, 0xF000, 0), bytes(NULL), sizeInBytes(0) - { - } - - DrawingContainer (const OfficeArtDgContainer& shape) : rh(0xF, 0x000, 0xF000, 0), bytes(NULL), sizeInBytes(0) - { - sizeInBytes += shape.Size(); - sizeInBytes += sizeof(rh); - - if ( sizeInBytes != 0 ) - { - bytes = new unsigned char[sizeInBytes]; - - if (bytes != NULL ) - { - memset( bytes, 0, sizeInBytes ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), (unsigned char*)shape, shape.Size() ); - offset += shape.Size(); - } - } - } - - DrawingContainer(const DrawingContainer& data): bytes(NULL), sizeInBytes(data.sizeInBytes) - { - if (sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - - if ( bytes != NULL ) - { - memset(bytes, 0, sizeInBytes); - memcpy(bytes, data.bytes, sizeInBytes); - } - } - } - - bool operator == (const DrawingContainer& data) - { - return ( ( sizeInBytes == data.sizeInBytes ) && ( memcmp( bytes, data.bytes, sizeInBytes ) == 0 ) ); - } - - bool operator != (const DrawingContainer& data) - { - return !( this->operator == ( data ) ); - } - - DrawingContainer& operator = (const DrawingContainer& data) - { - if (*this != data) - { - RELEASEARRAYOBJECTS (bytes); - - sizeInBytes = data.sizeInBytes; - if (sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - if (bytes) - { - memcpy(bytes, data.bytes, sizeInBytes); - } - } - } - - return *this; - } - - virtual ~DrawingContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - OfficeArtRecordHeader rh; - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Enumerations.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Enumerations.h deleted file mode 100644 index eb7bba03dc..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/Enumerations.h +++ /dev/null @@ -1,581 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace OfficeArt -{ - namespace Enumerations - { - enum MSOSPT - { - msosptNotPrimitive = 0x00000000, // A shape that has no preset geometry, and is drawn with custom geometry instead. For example, freeform shapes drawn by users fall into this category. - msosptRectangle = 0x00000001, // A rectangle shape. - msosptRoundRectangle = 0x00000002, // A rectangle shape with rounded corners. - msosptEllipse = 0x00000003, // An ellipse shape. - msosptDiamond = 0x00000004, // A diamond shape. - msosptIsocelesTriangle = 0x00000005, // An isosceles triangle shape. - msosptRightTriangle = 0x00000006, // A right triangle shape. - msosptParallelogram = 0x00000007, // A parallelogram shape. - msosptTrapezoid = 0x00000008, // A trapezoid shape. - msosptHexagon = 0x00000009, // A hexagon shape. - msosptOctagon = 0x0000000A, // An octagon shape. - msosptPlus = 0x0000000B, // A plus shape. - msosptStar = 0x0000000C, // A star shape. - msosptArrow = 0x0000000D, // An arrow shape. - msosptThickArrow = 0x0000000E, // This value SHOULD NOT be used. - msosptHomePlate = 0x0000000F, // An irregular pentagon shape. - msosptCube = 0x00000010, // A cube shape. - msosptBalloon = 0x00000011, // A speech balloon shape. - msosptSeal = 0x00000012, // A seal shape. - msosptArc = 0x00000013, // A curved arc shape. - msosptLine = 0x00000014, // A line shape. - msosptPlaque = 0x00000015, // A plaque shape. - msosptCan = 0x00000016, // A cylinder shape. - msosptDonut = 0x00000017, // A donut shape. - msosptTextSimple = 0x00000018, // A simple text shape. Text SHOULD be drawn on a straight line. - msosptTextOctagon = 0x00000019, // An octagonal text shape. Text SHOULD be drawn within an octagonal boundary. - msosptTextHexagon = 0x0000001A, // A hexagonal text shape. Text SHOULD be drawn within a hexagonal boundary. - msosptTextCurve = 0x0000001B, // A curved text shape. Text SHOULD be drawn on a curved line. - msosptTextWave = 0x0000001C, // A wavy text shape. Text SHOULD be drawn on a wavy line. - msosptTextRing = 0x0000001D, // A ringed text shape. Text SHOULD be drawn within a semicircular arc. - msosptTextOnCurve = 0x0000001E, // A text shape that draws text on a curve. Text SHOULD be drawn on a curved line. - msosptTextOnRing = 0x0000001F, // A text shape that draws text on a ring. Text SHOULD be drawn on a semicircular arc. - msosptStraightConnector1 = 0x00000020, // A straight connector shape. - msosptBentConnector2 = 0x00000021, // A bent connector shape. - msosptBentConnector3 = 0x00000022, // A bent connector shape. - msosptBentConnector4 = 0x00000023, // A bent connector shape. - msosptBentConnector5 = 0x00000024, // A bent connector shape. - msosptCurvedConnector2 = 0x00000025, // A curved connector shape. - msosptCurvedConnector3 = 0x00000026, // A curved connector shape. - msosptCurvedConnector4 = 0x00000027, // A curved connector shape. - msosptCurvedConnector5 = 0x00000028, // A curved connector shape. - msosptCallout1 = 0x00000029, // A callout shape. - msosptCallout2 = 0x0000002A, // A callout shape. - msosptCallout3 = 0x0000002B, // A callout shape. - msosptAccentCallout1 = 0x0000002C, // A callout shape with side accent. - msosptAccentCallout2 = 0x0000002D, // A callout shape with side accent. - msosptAccentCallout3 = 0x0000002E, // A callout shape with side accent. - msosptBorderCallout1 = 0x0000002F, // A callout shape with border. - msosptBorderCallout2 = 0x00000030, // A callout shape with border. - msosptBorderCallout3 = 0x00000031, // A callout shape with border. - msosptAccentBorderCallout1 = 0x00000032, // A callout shape with border and side accent. - msosptAccentBorderCallout2 = 0x00000033, // A callout shape with border and side accent. - msosptAccentBorderCallout3 = 0x00000034, // A callout shape with border and side accent. - msosptRibbon = 0x00000035, // A ribbon shape. - msosptRibbon2 = 0x00000036, // A ribbon shape. - msosptChevron = 0x00000037, // A chevron shape. - msosptPentagon = 0x00000038, // A regular pentagon shape. - msosptNoSmoking = 0x00000039, // A circle-slash shape. - msosptSeal8 = 0x0000003A, // A seal shape with eight points. - msosptSeal16 = 0x0000003B, // A seal shape with sixteen points. - msosptSeal32 = 0x0000003C, // A seal shape with thirty-two points. - msosptWedgeRectCallout = 0x0000003D, // A rectangular callout shape. - msosptWedgeRRectCallout = 0x0000003E, // A rectangular callout shape with rounded corners. - msosptWedgeEllipseCallout = 0x0000003F, // An elliptical callout shape. - msosptWave = 0x00000040, // A wave shape. - msosptFoldedCorner = 0x00000041, // A rectangular shape with a folded corner. - msosptLeftArrow = 0x00000042, // An arrow shape pointing left. - msosptDownArrow = 0x00000043, // An arrow shape pointing down. - msosptUpArrow = 0x00000044, // An arrow shape pointing up. - msosptLeftRightArrow = 0x00000045, // An arrow shape pointing left and right. - msosptUpDownArrow = 0x00000046, // An arrow shape pointing down and up. - msosptIrregularSeal1 = 0x00000047, // An irregular seal shape. - msosptIrregularSeal2 = 0x00000048, // An irregular seal shape. - msosptLightningBolt = 0x00000049, // A lightning bolt shape. - msosptHeart = 0x0000004A, // A heart shape. - msosptPictureFrame = 0x0000004B, // A frame shape. - msosptQuadArrow = 0x0000004C, // A shape with arrows pointing down, left, right, and up. - msosptLeftArrowCallout = 0x0000004D, // A callout shape with an arrow pointing left. - msosptRightArrowCallout = 0x0000004E, // A callout shape with an arrow pointing right. - msosptUpArrowCallout = 0x0000004F, // A callout shape with an arrow pointing up. - msosptDownArrowCallout = 0x00000050, // A callout shape with an arrow pointing down. - msosptLeftRightArrowCallout = 0x00000051, // A callout shape with arrows pointing left and right. - msosptUpDownArrowCallout = 0x00000052, // A callout shape with arrows pointing down and up. - msosptQuadArrowCallout = 0x00000053, // A callout shape with arrows pointing down, left, right, and up. - msosptBevel = 0x00000054, // A beveled rectangle shape. - msosptLeftBracket = 0x00000055, // An opening bracket shape. - msosptRightBracket = 0x00000056, // A closing bracket shape. - msosptLeftBrace = 0x00000057, // An opening brace shape. - msosptRightBrace = 0x00000058, // A closing brace shape. - msosptLeftUpArrow = 0x00000059, // An arrow shape pointing left and up. - msosptBentUpArrow = 0x0000005A, // A bent arrow shape with its base on the left, pointing up. - msosptBentArrow = 0x0000005B, // A curved arrow shape with its base on the bottom, pointing right. - msosptSeal24 = 0x0000005C, // A seal shape with twenty-four points. - msosptStripedRightArrow = 0x0000005D, // A striped arrow shape pointing right. - msosptNotchedRightArrow = 0x0000005E, // A notched arrow shape pointing right. - msosptBlockArc = 0x0000005F, // A semicircular arc shape. - msosptSmileyFace = 0x00000060, // A smiling face shape. - msosptVerticalScroll = 0x00000061, // A scroll shape opened vertically. - msosptHorizontalScroll = 0x00000062, // A scroll shape opened horizontally. - msosptCircularArrow = 0x00000063, // A semicircular arrow shape. - msosptNotchedCircularArrow = 0x00000064, // This value SHOULD NOT be used. - msosptUturnArrow = 0x00000065, // A semicircular arrow shape with a straight tail. - msosptCurvedRightArrow = 0x00000066, // An arrow shape that curves to the right. - msosptCurvedLeftArrow = 0x00000067, // An arrow shape that curves to the left. - msosptCurvedUpArrow = 0x00000068, // An arrow shape that curves upward. - msosptCurvedDownArrow = 0x00000069, // An arrow shape that curves downward. - msosptCloudCallout = 0x0000006A, // A cloud-shaped callout. - msosptEllipseRibbon = 0x0000006B, // An elliptical ribbon shape. - msosptEllipseRibbon2 = 0x0000006C, // An elliptical ribbon shape. - msosptFlowChartProcess = 0x0000006D, // A process shape for flowcharts. - msosptFlowChartDecision = 0x0000006E, // A decision shape for flowcharts. - msosptFlowChartInputOutput = 0x0000006F, // An input-output shape for flowcharts. - msosptFlowChartPredefinedProcess = 0x00000070, // A predefined process shape for flowcharts. - msosptFlowChartInternalStorage = 0x00000071, // An internal storage shape for flowcharts. - msosptFlowChartDocument = 0x00000072, // A document shape for flowcharts. - msosptFlowChartMultidocument = 0x00000073, // A multidocument shape for flowcharts. - msosptFlowChartTerminator = 0x00000074, // A terminator shape for flowcharts. - msosptFlowChartPreparation = 0x00000075, // A preparation shape for flowcharts. - msosptFlowChartManualInput = 0x00000076, // A manual input shape for flowcharts. - msosptFlowChartManualOperation = 0x00000077, // A manual operation shape for flowcharts. - msosptFlowChartConnector = 0x00000078, // A connector shape for flowcharts. - msosptFlowChartPunchedCard = 0x00000079, // A punched card shape for flowcharts. - msosptFlowChartPunchedTape = 0x0000007A, // A punched tape shape for flowcharts. - msosptFlowChartSummingJunction = 0x0000007B, // A summing junction shape for flowcharts. - msosptFlowChartOr = 0x0000007C, // An OR shape for flowcharts. - msosptFlowChartCollate = 0x0000007D, // A collation shape for flowcharts. - msosptFlowChartSort = 0x0000007E, // A sorting shape for flowcharts. - msosptFlowChartExtract = 0x0000007F, // An extraction shape for flowcharts. - msosptFlowChartMerge = 0x00000080, // A merging shape for flowcharts. - msosptFlowChartOfflineStorage = 0x00000081, // An offline storage shape for flowcharts. - msosptFlowChartOnlineStorage = 0x00000082, // An online storage shape for flowcharts. - msosptFlowChartMagneticTape = 0x00000083, // A magnetic tape shape for flowcharts. - msosptFlowChartMagneticDisk = 0x00000084, // A magnetic disk shape for flowcharts. - msosptFlowChartMagneticDrum = 0x00000085, // A magnetic drum shape for flowcharts. - msosptFlowChartDisplay = 0x00000086, // A display shape for flowcharts. - msosptFlowChartDelay = 0x00000087, // A delay shape for flowcharts. - msosptTextPlainText = 0x00000088, // A plain text shape. - msosptTextStop = 0x00000089, // An octagonal text shape. - msosptTextTriangle = 0x0000008A, // A triangular text shape pointing upwards. - msosptTextTriangleInverted = 0x0000008B, // A triangular text shape pointing downwards. - msosptTextChevron = 0x0000008C, // A chevron text shape pointing upwards. - msosptTextChevronInverted = 0x0000008D, // A chevron text shape pointing downwards. - msosptTextRingInside = 0x0000008E, // A circular text shape, as if reading an inscription on the inside of a ring. - msosptTextRingOutside = 0x0000008F, // A circular text shape, as if reading an inscription on the outside of a ring. - msosptTextArchUpCurve = 0x00000090, // An upward arching curved text shape. - msosptTextArchDownCurve = 0x00000091, // A downward arching curved text shape. - msosptTextCircleCurve = 0x00000092, // A circular text shape. - msosptTextButtonCurve = 0x00000093, // A text shape that resembles a button. - msosptTextArchUpPour = 0x00000094, // An upward arching text shape. - msosptTextArchDownPour = 0x00000095, // A downward arching text shape. - msosptTextCirclePour = 0x00000096, // A circular text shape. - msosptTextButtonPour = 0x00000097, // A text shape that resembles a button. - msosptTextCurveUp = 0x00000098, // An upward curving text shape. - msosptTextCurveDown = 0x00000099, // A downward curving text shape. - msosptTextCascadeUp = 0x0000009A, // A cascading text shape pointed upwards. - msosptTextCascadeDown = 0x0000009B, // A cascading text shape pointed downwards. - msosptTextWave1 = 0x0000009C, // A wavy text shape. - msosptTextWave2 = 0x0000009D, // A wavy text shape. - msosptTextWave3 = 0x0000009E, // A wavy text shape. - msosptTextWave4 = 0x0000009F, // A wavy text shape. - msosptTextInflate = 0x000000A0, // A text shape that expands vertically in the middle. - msosptTextDeflate = 0x000000A1, // A text shape that shrinks vertically in the middle. - msosptTextInflateBottom = 0x000000A2, // A text shape that expands downward in the middle. - msosptTextDeflateBottom = 0x000000A3, // A text shape that shrinks upwards in the middle. - msosptTextInflateTop = 0x000000A4, // A text shape that expands upward in the middle. - msosptTextDeflateTop = 0x000000A5, // A text shape that shrinks downward in the middle. - msosptTextDeflateInflate = 0x000000A6, // A text shape where lower lines expand upward. Upper lines shrink to compensate. - msosptTextDeflateInflateDeflate = 0x000000A7, // A text shape where lines in the center expand vertically. Upper and lower lines shrink to compensate. - msosptTextFadeRight = 0x000000A8, // A text shape that shrinks vertically on the right side. - msosptTextFadeLeft = 0x000000A9, // A text shape that shrinks vertically on the left side. - msosptTextFadeUp = 0x000000AA, // A text shape that shrinks horizontally on top. - msosptTextFadeDown = 0x000000AB, // A text shape that shrinks horizontally on bottom. - msosptTextSlantUp = 0x000000AC, // An upward slanted text shape. - msosptTextSlantDown = 0x000000AD, // A downward slanted text shape. - msosptTextCanUp = 0x000000AE, // A text shape that is curved upwards as if being read on the side of a can. - msosptTextCanDown = 0x000000AF, // A text shape that is curved downwards as if being read on the side of a can. - msosptFlowChartAlternateProcess = 0x000000B0, // An alternate process shape for flowcharts. - msosptFlowChartOffpageConnector = 0x000000B1, // An off page connector shape for flowcharts. - msosptCallout90 = 0x000000B2, // A callout shape. - msosptAccentCallout90 = 0x000000B3, // A callout shape. - msosptBorderCallout90 = 0x000000B4, // A callout shape with border. - msosptAccentBorderCallout90 = 0x000000B5, // A callout shape with border. - msosptLeftRightUpArrow = 0x000000B6, // A shape with arrows pointing left, right, and up. - msosptSun = 0x000000B7, // A sun shape. - msosptMoon = 0x000000B8, // A moon shape. - msosptBracketPair = 0x000000B9, // A shape enclosed in brackets. - msosptBracePair = 0x000000BA, // A shape enclosed in braces. - msosptSeal4 = 0x000000BB, // A seal shape with four points. - msosptDoubleWave = 0x000000BC, // A double wave shape. - msosptActionButtonBlank = 0x000000BD, // A blank button shape. - msosptActionButtonHome = 0x000000BE, // A home button shape. - msosptActionButtonHelp = 0x000000BF, // A help button shape. - msosptActionButtonInformation = 0x000000C0, // An information button shape. - msosptActionButtonForwardNext = 0x000000C1, // A forward or next button shape. - msosptActionButtonBackPrevious = 0x000000C2, // A back or previous button shape. - msosptActionButtonEnd = 0x000000C3, // An end button shape. - msosptActionButtonBeginning = 0x000000C4, // A beginning button shape. - msosptActionButtonReturn = 0x000000C5, // A return button shape. - msosptActionButtonDocument = 0x000000C6, // A document button shape. - msosptActionButtonSound = 0x000000C7, // A sound button shape. - msosptActionButtonMovie = 0x000000C8, // A movie button shape. - msosptHostControl = 0x000000C9, // This value SHOULD NOT be used. - msosptTextBox = 0x000000CA // A text box shape. - }; - - enum MSOSHAPEPATH - { - msoshapeLines = 0x00000000, - msoshapeLinesClosed = 0x00000001, - msoshapeCurves = 0x00000002, - msoshapeCurvesClosed = 0x00000003, - msoshapeComplex = 0x00000004 - }; - - enum MSOFILLTYPE - { - msofillSolid = 0x00000000, // A solid fill - msofillPattern = 0x00000001, // A patterned fill - msofillTexture = 0x00000002, // A textured fill - msofillPicture = 0x00000003, // A picture fill - msofillShade = 0x00000004, // A gradient fill that starts and ends with defined endpoints - msofillShadeCenter = 0x00000005, // A gradient fill that starts and ends based on the bounds of the shape - msofillShadeShape = 0x00000006, // A gradient fill that starts on the outline of the shape and ends at a point defined within the shape - msofillShadeScale = 0x00000007, // A gradient fill that starts on the outline of the shape and ends at a point defined within the shape. The fill angle is scaled by the aspect ratio of the shape - msofillShadeTitle = 0x00000008, // A gradient fill interpreted by the host application - msofillBackground = 0x00000009 // A fill that matches the background fill - }; - } - - namespace Enumerations - { - enum MSOLINETYPE - { - msolineSolidType = 0x00000000, // A solid fill - msolinePattern = 0x00000001, // A patterned fill - msolineTexture = 0x00000002 // A textured fill - }; - - enum MSOLINESTYLE - { - msolineSimple = 0x00000000, - msolineDouble = 0x00000001, - msolineThickThin = 0x00000002, - msolineThinThick = 0x00000003, - msolineTriple = 0x00000004 - }; - - enum MSOLINEDASHING - { - msolineSolid = 0x00000000, - msolineDashSys = 0x00000001, - msolineDotSys = 0x00000002, - msolineDashDotSys = 0x00000003, - msolineDashDotDotSys = 0x00000004, - msolineDotGEL = 0x00000005, - msolineDashGEL = 0x00000006, - msolineLongDashGEL = 0x00000007, - msolineDashDotGEL = 0x00000008, - msolineLongDashDotGEL = 0x00000009, - msolineLongDashDotDotGEL = 0x0000000A - }; - - enum MSOLINECAP - { - msolineEndCapRound = 0x00000000, - msolineEndCapSquare = 0x00000001, - msolineEndCapFlat = 0x00000002 - }; - - enum MSOLINEEND - { - msolineNoEnd = 0x00000000, - msolineArrowEnd = 0x00000001, - msolineArrowStealthEnd = 0x00000002, - msolineArrowDiamondEnd = 0x00000003, - msolineArrowOvalEnd = 0x00000004, - msolineArrowOpenEnd = 0x00000005, - msolineArrowChevronEnd = 0x00000006, // A value that MUST be ignored. - msolineArrowDoubleChevronEnd = 0x00000007 // A value that MUST be ignored - }; - - enum MSOLINEENDWIDTH - { - msolineNarrowArrow = 0x00000000, - msolineMediumWidthArrow = 0x00000001, - msolineWideArrow = 0x00000002 - }; - - enum MSOLINEENDLENGTH - { - msolineShortArrow = 0x00000000, - msolineMediumLenArrow = 0x00000001, - msolineLongArrow = 0x00000002 - }; - } - - namespace Enumerations - { - enum MSOWRAPMODE - { - msowrapSquare = 0x00000000, - msowrapByPoints = 0x00000001, - msowrapNone = 0x00000002, - msowrapTopBottom = 0x00000003, - msowrapThrough = 0x00000004 - }; - - enum MSOANCHOR - { - msoanchorTop = 0x00000000, - msoanchorMiddle = 0x00000001, - msoanchorBottom = 0x00000002, - msoanchorTopCentered = 0x00000003, - msoanchorMiddleCentered = 0x00000004, - msoanchorBottomCentered = 0x00000005, - msoanchorTopBaseline = 0x00000006, - msoanchorBottomBaseline = 0x00000007, - msoanchorTopCenteredBaseline = 0x00000008, - msoanchorBottomCenteredBaseline = 0x00000009 - }; - - enum POSH - { - msophAbs = 0x00000000, - msophLeft = 0x00000001, - msophCenter = 0x00000002, - msophRight = 0x00000003, - msophInside = 0x00000004, - msophOutside = 0x00000005 - }; - - enum POSRELH // ! Значения не соотвествуют спецификации - { - msoprhMargin = 0x00000001, - msoprhPage = 0x00000002, - msoprhText = 0x00000003, - msoprhChar = 0x00000004 - }; - - enum POSV - { - msopvAbs = 0x00000000, - msopvTop = 0x00000001, - msopvCenter = 0x00000002, - msopvBottom = 0x00000003, - msopvInside = 0x00000004, - msopvOutside = 0x00000005 - }; - - enum POSRELV // ! Значения не соотвествуют спецификации - { - msoprvMargin = 0x00000001, - msoprvPage = 0x00000002, - msoprvText = 0x00000003, - msoprvLine = 0x00000004 - }; - - enum MSOSHADOWTYPE - { - msoshadowOffset = 0x00000000, - msoshadowDouble = 0x00000001, - msoshadowRich = 0x00000002, - msoshadowShape = 0x00000003, - msoshadowDrawing = 0x00000004, - msoshadowEmbossOrEngrave = 0x00000005 - }; - - enum MSOCX - { - msocxkNone = 0x00000000, - msocxkSegments = 0x00000001, - msocxkCustom = 0x00000002, - msocxkRect = 0x00000003 - }; - } - - namespace Enumerations - { - enum GroupShape - { - dxWrapDistLeft = 0x0384, - dyWrapDistTop = 0x0385, - dxWrapDistRight = 0x0386, - dyWrapDistBottom = 0x0387, - lidRegroup = 0x0388, - - posh = 0x038F, - posrelh = 0x0390, - posv = 0x0391, - posrelv = 0x0392, - - groupShapeBooleanProperties = 0x03BF - }; - - enum GroupShape2 - { - pctHoriz = 0x07C0, - pctVert = 0x07C1, - pctHorizPos = 0x07C2, - pctVertPos = 0x07C3, - sizerelh = 0x07C4, - sizerelv = 0x07C5 - }; - - enum Geometry - { - geoLeft = 0x0140, - geoTop = 0x0141, - geoRight = 0x0142, - geoBottom = 0x0143, - - shapePath = 0x0144, - pVertices = 0x0145, - pSegmentInfo = 0x0146, - - pConnectionSites = 0x0151, - pConnectionSitesDir = 0x0152, - - adjustValue = 0x0147, - adjust2Value = 0x0148, - adjust3Value = 0x0149, - adjust4Value = 0x014A, - adjust5Value = 0x014B, - adjust6Value = 0x014C, - adjust7Value = 0x014D, - adjust8Value = 0x014E, - - pAdjustHandles = 0x0155, - pGuides = 0x0156, - pInscribe = 0x0157, - cxk = 0x0158, - geometryBooleanProperties = 0x017F - }; - - enum FillStyle - { - fillType = 0x0180, - fillColor = 0x0181, - fillOpacity = 0x0182, - fillBackColor = 0x0183, - fillBackOpacity = 0x0184, - fillCrMod = 0x0185, - fillBlip = 0x0186, - - fillStyleBooleanProperties = 0x01BF - }; - - enum LineStyle - { - lineColor = 0x01C0, - lineOpacity = 0x01C1, - lineBackColor = 0x01C2, - lineCrMod = 0x01C3, - lineType = 0x01C4, - - lineFillBlip = 0x01C5, - lineWidth = 0x01CB, - - lineStyle = 0x01CD, - lineDashing = 0x01CE, - - lineStartArrowhead = 0x01D0, - lineEndArrowhead = 0x01D1, - lineStartArrowWidth = 0x01D2, - lineStartArrowLength = 0x01D3, - lineEndArrowWidth = 0x01D4, - lineEndArrowLength = 0x01D5, - lineJoinStyle = 0x01D6, - lineEndCapStyle = 0x01D7, - - lineStyleBooleanProperties = 0x01FF - }; - - enum ShadowStyle - { - shadowType = 0x0200, - shadowColor = 0x0201, - shadowOpacity = 0x0204, - shadowOffsetX = 0x0205, - shadowOffsetY = 0x0206, - - shadowOriginX = 0x0210, - shadowOriginY = 0x0211, // ошибка в спецификации (id-кривой) - - shadowScaleXToX = 0x209, - shadowScaleYToX = 0x20A, - shadowScaleXToY = 0x20B, - shadowScaleYToY = 0x20C, - shadowPerspectiveX = 0x20D, - shadowPerspectiveY = 0x20E, - - shadowSoftness = 0x021C, - shadowStyleBooleanProperties = 0x023F - }; - - enum Diagram - { - - diagramBooleans = 0x053F - }; - - enum Transform - { - - rotation = 0x0004 - - }; - - enum Protection - { - protectionBooleans = 0x007F - }; - - enum Text - { - lTxid = 0x0080, - dxTextLeft = 0x0081, - dyTextTop = 0x0082, - dxTextRight = 0x0083, - dyTextBottom = 0x0084, - wrapText = 0x0085, - anchorText = 0x0087, - txflTextFlow = 0x0088, - cdirFont = 0x0089, - hspNext = 0x008A, - txdir = 0x008B, - textBooleanProperties = 0x00BF - }; - - enum Blip - { - cropFromTop = 0x0100, - cropFromBottom = 0x0101, - cropFromLeft = 0x0102, - cropFromRight = 0x0103, - - pib = 0x0104, - - blipBooleanProperties = 0x013F - }; - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtAbstractContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtAbstractContainer.h deleted file mode 100644 index 47297690d5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtAbstractContainer.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - template struct IOfficeArtAbstractContainer: public IOfficeArtRecord - { - //!!!TODO: Add or remove methods!!! - virtual void PushBack( const T& element ) = 0; - virtual unsigned int Count() const = 0; - virtual void Clear() = 0; - virtual ~IOfficeArtAbstractContainer() {} - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtRecord.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtRecord.h deleted file mode 100644 index 881343b57d..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/IOfficeArtRecord.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../../../Common/DocxFormat/Source/Base/SmartPtr.h" - -namespace OfficeArt -{ - struct IOfficeArtRecord - { - virtual operator const unsigned char* () const = 0; - virtual operator unsigned char* () const = 0; - virtual unsigned int Size() const = 0; - virtual IOfficeArtRecord* New() const = 0; - virtual IOfficeArtRecord* Clone() const = 0; - virtual ~IOfficeArtRecord() {} - }; - - typedef NSCommon::smart_ptr OfficeArtRecordPtr; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/MSOArray.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/MSOArray.h deleted file mode 100644 index a714aa9c86..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/MSOArray.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include -#include - -namespace OfficeArt -{ - class CPoint16 - { - public: - CPoint16 () : X(0), Y(0) - { - - } - - CPoint16 (short nX, short nY) : X(nX), Y(nY) - { - - } - - inline short GetX() - { - return X; - } - - inline short GetY() - { - return Y; - } - - public: - - short X; - short Y; - }; - - class CPoint32 - { - public: - CPoint32 () : X(0), Y(0) - { - - } - - CPoint32 (int nX, int nY) : X(nX), Y(nY) - { - - } - - inline int GetX() - { - return X; - } - - inline int GetY() - { - return Y; - } - - public: - - int X; - int Y; - }; -} - -namespace OfficeArt -{ - template class CMSOArray - { - public: - CMSOArray(bool cb_FFF0 = false) : m_data (NULL), m_cb_FFF0 (cb_FFF0) - { - - } - - virtual ~CMSOArray() - { - RELEASEARRAYOBJECTS(m_data); - } - - - // - inline void Add(const T& elem) - { - m_arr.push_back(elem); - } - - inline void Add(const std::vector& arr) - { - m_arr.clear(); - - for (size_t i = 0; i < arr.size(); ++i) - m_arr.push_back(arr[i]); - } - - inline const unsigned char* Get() - { - if (m_data) - return m_data; - - unsigned short count = (unsigned short)m_arr.size(); - unsigned short cbSize = sizeof(T); - - if (m_cb_FFF0) - cbSize = 0xFFF0; - - unsigned int offset = sizeof(unsigned short) * 3 + m_arr.size() * sizeof(T); - m_data = new unsigned char [offset]; - - if (m_data) - { - offset = 0; - - memcpy ( (m_data + offset), &count, sizeof(unsigned short)); - offset += sizeof(unsigned short); - - unsigned short nElemsAlloc = count; - - memcpy ( (m_data + offset), &nElemsAlloc, sizeof(unsigned short)); - offset += sizeof(unsigned short); - - memcpy ( (m_data + offset), &cbSize, sizeof(unsigned short)); - offset += sizeof(unsigned short); - - for (size_t i = 0; i < m_arr.size(); ++i) - { - memcpy ( (m_data + offset), &m_arr[i], sizeof(T)); - offset += sizeof(T); - } - - return m_data; - } - - return NULL; - } - - inline unsigned int GetSize() - { - if (m_cb_FFF0) - return 4 * m_arr.size(); - - return m_arr.size() * sizeof(T); - } - - inline void Clear() - { - m_arr.clear(); - } - - // - inline static std::vector GetPoints(const std::string& strPoints) - { - std::vector values; - if (strPoints.empty()) - return values; - - std::string str = strPoints; - while(str.length()) - { - size_t separator = str.find (';'); - if (string::npos != separator) - { - std::string point = str.substr (0,separator); - size_t pt = point.find(','); - if (string::npos == pt) - break; - - unsigned int x = atoi (point.substr(0,pt).c_str()); - unsigned int y = atoi (point.substr(pt+1,point.length() - pt - 1).c_str()); - - values.push_back (CPoint32(x,y)); - - str = str.substr(separator + 1,str.length() - separator - 1); - - continue; - } - - size_t from = str.find(','); - if (0 != from) - { - size_t pt = str.find(','); - if (string::npos == pt) - break; - - unsigned int x = atoi (str.substr(0,pt).c_str()); - unsigned int y = atoi (str.substr(pt+1,str.length() - pt - 1).c_str()); - - values.push_back (CPoint32(x,y)); - break; - } - } - - return values; - } - - inline static std::vector GetArrInt32(const std::string& strValues, std::string sep) - { - std::vector values; - if (strValues.empty()) - return values; - - std::string str = strValues; - while(str.length()) - { - size_t separator = str.find(sep); - if (string::npos != separator) - { - int number = atoi(str.substr(0,separator).c_str()); - values.push_back (number); - - str = str.substr(separator + 1, str.length()-separator-1); - } - else - { - int number = atoi(str.c_str()); - values.push_back (number); - - break; - } - } - - return values; - } - - - inline static std::vector GetValues(const std::string& strValues) - { - std::vector values; - if (strValues.empty()) - return values; - - std::string str = strValues; - while(str.length()) - { - size_t separator = str.find (','); - if (string::npos != separator) - { - unsigned int number = ToFixed(atof(str.substr(0,separator).c_str())); - values.push_back (number); - - str = str.substr(separator + 1, str.length()-separator-1); - } - else - { - unsigned int number = ToFixed(atof (str.c_str())); - values.push_back (number); - - break; - } - } - - return values; - } - - - inline static std::vector GetRectangles(const std::string& strValues) - { - std::vector rectangles; - - std::vector values = CMSOArray::GetArrInt32(strValues, ","); - if (values.size()) - { - int count = values.size() / 4; - - for(int i = 0; i < count; ++i) - { - rectangles.push_back(OfficeArt::RECT(values[0 + i * 4], values[1 + i*4], values[2 + i*4], values[3 + i*4])); - } - } - - return rectangles; - } - - private: - - static unsigned int ToFixed(double dNumber) - { - if (dNumber < 0.0) - { - return (unsigned int)(((long)dNumber - dNumber) * 65536.0) | (0xffff << 16); - } - - if (dNumber > 0.0) - { - return (unsigned int)((dNumber - (long)dNumber) * 65536.0); - } - - return 0; - } - - private: - - std::vector m_arr; - unsigned char* m_data; - bool m_cb_FFF0; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainer.h deleted file mode 100644 index 405958ce5c..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainer.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" -#include "Enumerations.h" - -#include "IOfficeArtRecord.h" -#include "IOfficeArtAbstractContainer.h" - -#include "OfficeArtRecordHeader.h" -#include "OfficeArtBStoreContainerFileBlock.h" - -namespace OfficeArt -{ - class OfficeArtBStoreContainer: public IOfficeArtAbstractContainer - { - public: - - OfficeArtBStoreContainer () : rh(0xF, 0x0, 0xF001, 0x0), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) - { - Initialize(); - } - - OfficeArtBStoreContainer (const OfficeArtBStoreContainer& office) : rh(office.rh), rgfb(office.rgfb), bytes(NULL), size(office.size) - { - if (size) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, office.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBStoreContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBStoreContainer( *this ); - } - - virtual void PushBack(const OfficeArtBStoreContainerFileBlock& fileBlock) - { - rgfb.push_back( OfficeArtBStoreContainerFileBlockPtr(static_cast(fileBlock.Clone()))); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)rgfb.size(); - } - - virtual void Clear() - { - rgfb.clear(); - Initialize(); - } - - virtual ~OfficeArtBStoreContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (std::list::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) - { - size += (*iter)->Size(); - } - - rh = OfficeArtRecordHeader (0xF, rgfb.size(), 0xF001, size); - size += sizeof(rh); - - RELEASEARRAYOBJECTS (bytes); - - if (size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - for (std::list::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) - { - const OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->operator->(); - if (officeArtBStoreContainerFileBlock) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size()); - offset += officeArtBStoreContainerFileBlock->Size(); - } - } - } - } - } - - private: - - OfficeArtRecordHeader rh; - list rgfb; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainerFileBlock.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainerFileBlock.h deleted file mode 100644 index 1b885d24e9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBStoreContainerFileBlock.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtBStoreContainerFileBlock: public IOfficeArtRecord - { - public: - - explicit OfficeArtBStoreContainerFileBlock( OfficeArtRecordHeader _rh ): rh(_rh) {} - virtual ~OfficeArtBStoreContainerFileBlock() {} - - protected: - - OfficeArtRecordHeader rh; - }; - - typedef NSCommon::smart_ptr OfficeArtBStoreContainerFileBlockPtr; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlip.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlip.h deleted file mode 100644 index 66632f9efc..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlip.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBStoreContainerFileBlock.h" - -#include -#include - -namespace OfficeArt -{ - class OfficeArtBlip : public OfficeArtBStoreContainerFileBlock - { - public: - explicit OfficeArtBlip (OfficeArtRecordHeader oHeader) : OfficeArtBStoreContainerFileBlock (oHeader) { } - virtual ~OfficeArtBlip () {} - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipEMF.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipEMF.h deleted file mode 100644 index 6e0e51a56b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipEMF.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBlip.h" -#include "OfficeArtMetafileHeader.h" - -namespace OfficeArt -{ - class OfficeArtBlipEMF: public OfficeArtBlip - { - private: - static const unsigned char rgbUidsSize = 16; - unsigned char rgbUid1[rgbUidsSize]; - unsigned char rgbUid2[rgbUidsSize]; - OfficeArtMetafileHeader metafileHeader; - unsigned char* BLIPFileData; - unsigned int blipFileDataSize; - - unsigned char* bytes; - unsigned int size; - - public: - OfficeArtBlipEMF(): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x3D4, 0xF01A, ( sizeof(metafileHeader) + sizeof(rgbUid1) ) )), - metafileHeader(), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - - this->Initialize(); - } - - explicit OfficeArtBlipEMF( const OfficeArtMetafileHeader& _metafileHeader, - unsigned char* _blipFileData, - const std::vector& _rgbUid1 = std::vector(), - const std::vector& _rgbUid2 = std::vector() ): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x3D4, 0xF01A, ( sizeof(metafileHeader) + sizeof(rgbUid1) ) )), - metafileHeader(_metafileHeader), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - - this->blipFileDataSize = this->metafileHeader.GetCompressedSize(); - this->size = this->blipFileDataSize; - - if ( _rgbUid2.size() != rgbUidsSize ) - { - this->size += ( sizeof(this->metafileHeader) + sizeof(this->rgbUid1) ); - - this->rh = OfficeArtRecordHeader( 0x0, 0x3D4, 0xF01A, this->size ); - } - else - { - this->size += ( sizeof(this->metafileHeader) + sizeof(this->rgbUid1) + sizeof(this->rgbUid2) ); - - this->rh = OfficeArtRecordHeader( 0x0, 0x3D5, 0xF01A, this->size ); - } - - if ( _rgbUid1.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid1.size(); i++ ) - { - this->rgbUid1[i] = _rgbUid1[i]; - } - } - - if ( _rgbUid2.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid2.size(); i++ ) - { - this->rgbUid2[i] = _rgbUid2[i]; - } - } - - if ( ( _blipFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( this->BLIPFileData != NULL ) - { - memset( this->BLIPFileData, 0, this->blipFileDataSize ); - memcpy( this->BLIPFileData, _blipFileData, this->blipFileDataSize ); - } - } - - this->Initialize(); - } - - OfficeArtBlipEMF( const OfficeArtBlipEMF& _officeArtBlipEMF ): - OfficeArtBlip(OfficeArtRecordHeader( _officeArtBlipEMF.rh )), metafileHeader(_officeArtBlipEMF.metafileHeader), - BLIPFileData(NULL), blipFileDataSize(_officeArtBlipEMF.blipFileDataSize), bytes(NULL), size(_officeArtBlipEMF.size) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - memcpy( this->rgbUid1, _officeArtBlipEMF.rgbUid1, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - memcpy( this->rgbUid2, _officeArtBlipEMF.rgbUid2, rgbUidsSize ); - - if ( this->blipFileDataSize != 0 ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( this->BLIPFileData != NULL ) - { - memset( this->BLIPFileData, 0, this->blipFileDataSize ); - - memcpy( this->BLIPFileData, _officeArtBlipEMF.BLIPFileData, this->blipFileDataSize ); - } - } - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - memcpy( this->bytes, _officeArtBlipEMF.bytes, this->size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBlipEMF; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBlipEMF( *this ); - } - - virtual ~OfficeArtBlipEMF() - { - RELEASEARRAYOBJECTS (BLIPFileData); - RELEASEARRAYOBJECTS (bytes); - } - - private: - - void Initialize() - { - this->size = ( sizeof(this->rh) + this->rh.GetLength() ); - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid1), sizeof(this->rgbUid1) ); - offset += sizeof(this->rgbUid1); - - if ( this->rh.GetInstance() == 0x3D5 ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid2), sizeof(this->rgbUid2) ); - offset += sizeof(this->rgbUid2); - } - - memcpy( ( this->bytes + offset ), &(this->metafileHeader), sizeof(this->metafileHeader) ); - offset += sizeof(this->metafileHeader); - - if ( ( this->BLIPFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - memcpy( ( this->bytes + offset ), this->BLIPFileData, this->blipFileDataSize ); - offset += this->blipFileDataSize; - } - } - } - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipJPEG.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipJPEG.h deleted file mode 100644 index 36b77949a5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipJPEG.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBlip.h" - -namespace OfficeArt -{ - namespace Enumerations - { - enum BlipJPEGInstance - { - blipJPEGInstanceRGB1UID = 0x46A, //JPEG in RGB color space, number of unique identifiers == 1 - blipJPEGInstanceRGB2UID = 0x46B, //JPEG in RGB color space, number of unique identifiers == 2 - blipJPEGInstanceCMYK1UID = 0x6E2, //JPEG in CMYK color space, number of unique identifiers == 1 - blipJPEGInstanceCMYK2UID = 0x6E3, //JPEG in CMYK color space, number of unique identifiers == 2 - }; - } - - class OfficeArtBlipJPEG : public OfficeArtBlip - { - public: - OfficeArtBlipJPEG(): OfficeArtBlip(OfficeArtRecordHeader( 0x0, (unsigned short)Enumerations::blipJPEGInstanceRGB1UID, 0xF01D, 17 )), tag(0), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset(rgbUid1, 0, rgbUidsSize); - memset(rgbUid2, 0, rgbUidsSize); - - this->Initialize(); - } - - OfficeArtBlipJPEG( unsigned char* _blipFileData, unsigned int _blipFileDataSize, - const std::vector& _rgbUid1 = std::vector(), - const std::vector& _rgbUid2 = std::vector(), unsigned char _tag = 0xFF, - Enumerations::BlipJPEGInstance _recInstance = Enumerations::blipJPEGInstanceRGB1UID ): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, (unsigned short)_recInstance, 0xF01D, 17 )), - tag(_tag), - BLIPFileData(NULL), - blipFileDataSize(_blipFileDataSize), - bytes(NULL), - size(0) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - - if ( ( _recInstance == Enumerations::blipJPEGInstanceRGB1UID ) || - ( _recInstance == Enumerations::blipJPEGInstanceCMYK1UID ) ) - { - this->size = 17; - } - else if ( ( _recInstance == Enumerations::blipJPEGInstanceRGB2UID ) || - ( _recInstance == Enumerations::blipJPEGInstanceCMYK2UID ) ) - { - this->size = 33; - } - - this->size += _blipFileDataSize; - - this->rh = OfficeArtRecordHeader( 0x0, (unsigned short)_recInstance, 0xF01D, this->size ); - - if ( _rgbUid1.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid1.size(); i++ ) - { - this->rgbUid1[i] = _rgbUid1[i]; - } - } - - if ( _rgbUid2.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid2.size(); i++ ) - { - this->rgbUid2[i] = _rgbUid2[i]; - } - } - - if ( ( _blipFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( this->BLIPFileData != NULL ) - { - memset( this->BLIPFileData, 0, this->blipFileDataSize ); - - memcpy( this->BLIPFileData, _blipFileData, this->blipFileDataSize ); - } - } - - this->Initialize(); - } - - OfficeArtBlipJPEG (const OfficeArtBlipJPEG& _officeArtBlipJPEG) : OfficeArtBlip(OfficeArtRecordHeader( _officeArtBlipJPEG.rh )), tag(_officeArtBlipJPEG.tag), BLIPFileData(NULL), blipFileDataSize(_officeArtBlipJPEG.blipFileDataSize), bytes(NULL), size(_officeArtBlipJPEG.size) - { - memset(rgbUid1, 0, rgbUidsSize); - memcpy(rgbUid1, _officeArtBlipJPEG.rgbUid1, rgbUidsSize); - - memset(rgbUid2, 0, rgbUidsSize ); - memcpy(rgbUid2, _officeArtBlipJPEG.rgbUid2, rgbUidsSize); - - if (blipFileDataSize != 0) - { - BLIPFileData = new unsigned char[blipFileDataSize]; - - if (BLIPFileData) - { - memset(BLIPFileData, 0, blipFileDataSize); - memcpy(BLIPFileData, _officeArtBlipJPEG.BLIPFileData, blipFileDataSize); - } - } - - if (size != 0) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _officeArtBlipJPEG.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBlipJPEG; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBlipJPEG( *this ); - } - - virtual ~OfficeArtBlipJPEG() - { - RELEASEARRAYOBJECTS (BLIPFileData); - RELEASEARRAYOBJECTS (bytes); - } - - private: - - void Initialize() - { - this->size = ( sizeof(this->rh) + this->rh.GetLength() ); - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid1), sizeof(this->rgbUid1) ); - offset += sizeof(this->rgbUid1); - - if ( ( this->rh.GetInstance() == Enumerations::blipJPEGInstanceRGB2UID ) || - ( this->rh.GetInstance() == Enumerations::blipJPEGInstanceCMYK2UID ) ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid2), sizeof(this->rgbUid2) ); - offset += sizeof(this->rgbUid2); - } - - memcpy( ( this->bytes + offset ), &(this->tag), sizeof(this->tag) ); - offset += sizeof(this->tag); - - if ( ( this->BLIPFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - memcpy( ( this->bytes + offset ), this->BLIPFileData, this->blipFileDataSize ); - offset += this->blipFileDataSize; - } - } - } - } - - private: - - static const unsigned char rgbUidsSize = 16; - - unsigned char rgbUid1[rgbUidsSize]; - unsigned char rgbUid2[rgbUidsSize]; - unsigned char tag; - unsigned char* BLIPFileData; - unsigned int blipFileDataSize; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipPNG.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipPNG.h deleted file mode 100644 index 2540d55188..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipPNG.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBlip.h" - -namespace OfficeArt -{ - class OfficeArtBlipPNG: public OfficeArtBlip - { - public: - - OfficeArtBlipPNG () : OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x6E0, 0xF01E, 17 )), tag(0), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset ( rgbUid1, 0, rgbUidsSize ); - memset ( rgbUid2, 0, rgbUidsSize ); - - Initialize(); - } - - OfficeArtBlipPNG (unsigned char* _blipFileData, unsigned int _blipFileDataSize, - const std::vector& _rgbUid1 = std::vector(), - const std::vector& _rgbUid2 = std::vector(), - unsigned char _tag = 0xFF ): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x6E0, 0xF01E, 17 )), tag(_tag), BLIPFileData(NULL), blipFileDataSize(_blipFileDataSize), bytes(NULL), size(0) - { - memset( rgbUid1, 0, rgbUidsSize ); - - memset( rgbUid2, 0, rgbUidsSize ); - - size = _blipFileDataSize; - - if ( _rgbUid2.size() != rgbUidsSize ) - { - size += 17; - - rh = OfficeArtRecordHeader( 0x0, 0x6E0, 0xF01E, size ); - } - else - { - size += 33; - - rh = OfficeArtRecordHeader( 0x0, 0x6E1, 0xF01E, size ); - } - - if ( _rgbUid1.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid1.size(); i++ ) - { - rgbUid1[i] = _rgbUid1[i]; - } - } - - if ( _rgbUid2.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid2.size(); i++ ) - { - rgbUid2[i] = _rgbUid2[i]; - } - } - - if ( ( _blipFileData != NULL ) && ( blipFileDataSize != 0 ) ) - { - BLIPFileData = new unsigned char[blipFileDataSize]; - - if ( BLIPFileData != NULL ) - { - memset( BLIPFileData, 0, blipFileDataSize ); - - memcpy( BLIPFileData, _blipFileData, blipFileDataSize ); - } - } - - this->Initialize(); - } - - OfficeArtBlipPNG (const OfficeArtBlipPNG& _officeArtBlipPNG) : OfficeArtBlip(OfficeArtRecordHeader( _officeArtBlipPNG.rh )), tag(_officeArtBlipPNG.tag), BLIPFileData(NULL), blipFileDataSize(_officeArtBlipPNG.blipFileDataSize), bytes(NULL), size(_officeArtBlipPNG.size) - { - memset( rgbUid1, 0, rgbUidsSize ); - memcpy( rgbUid1, _officeArtBlipPNG.rgbUid1, rgbUidsSize ); - - memset( rgbUid2, 0, rgbUidsSize ); - memcpy( rgbUid2, _officeArtBlipPNG.rgbUid2, rgbUidsSize ); - - if ( this->blipFileDataSize != 0 ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( NULL != BLIPFileData ) - { - memset( BLIPFileData, 0, blipFileDataSize ); - - memcpy( BLIPFileData, _officeArtBlipPNG.BLIPFileData, blipFileDataSize ); - } - } - - if ( 0 != size ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - memcpy( this->bytes, _officeArtBlipPNG.bytes, this->size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBlipPNG; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBlipPNG(*this); - } - - virtual ~OfficeArtBlipPNG() - { - RELEASEARRAYOBJECTS(BLIPFileData); - RELEASEARRAYOBJECTS(bytes); - } - - private: - inline void Initialize() - { - size = ( sizeof(rh) + rh.GetLength() ); - - if ( size != 0 ) - { - bytes = new unsigned char[size]; - - if ( NULL != bytes ) - { - memset( this->bytes, 0, this->size ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid1), sizeof(this->rgbUid1) ); - offset += sizeof(this->rgbUid1); - - if ( this->rh.GetInstance() == 0x6E1 ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid2), sizeof(this->rgbUid2) ); - offset += sizeof(this->rgbUid2); - } - - memcpy( ( this->bytes + offset ), &(this->tag), sizeof(this->tag) ); - offset += sizeof(this->tag); - - if ( ( this->BLIPFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - memcpy( ( this->bytes + offset ), this->BLIPFileData, this->blipFileDataSize ); - offset += this->blipFileDataSize; - } - } - } - } - - private: - static const unsigned char rgbUidsSize = 16; - unsigned char rgbUid1[rgbUidsSize]; - unsigned char rgbUid2[rgbUidsSize]; - unsigned char tag; - unsigned char* BLIPFileData; - unsigned int blipFileDataSize; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipTIFF.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipTIFF.h deleted file mode 100644 index 729cc11596..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipTIFF.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBlip.h" - -// не используется, ms word сохраняет только в png tiff файлы - -namespace OfficeArt -{ - class OfficeArtBlipTIFF : public OfficeArtBlip - { - public: - - OfficeArtBlipTIFF () : OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x6E4, 0xF020, 17 )), tag(0), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset ( rgbUid1, 0, rgbUidsSize ); - memset ( rgbUid2, 0, rgbUidsSize ); - - Initialize(); - } - - OfficeArtBlipTIFF (unsigned char* _blipFileData, unsigned int _blipFileDataSize, - const std::vector& _rgbUid1 = std::vector(), - const std::vector& _rgbUid2 = std::vector(), unsigned char _tag = 0xFF ): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x6E4, 0xF020, 17 )), tag(_tag), BLIPFileData(NULL), blipFileDataSize(_blipFileDataSize), bytes(NULL), size(0) - { - memset ( rgbUid1, 0, rgbUidsSize ); - memset ( rgbUid2, 0, rgbUidsSize ); - - size = _blipFileDataSize; - - if ( _rgbUid2.size() != rgbUidsSize ) - { - size += 17; - - rh = OfficeArtRecordHeader( 0x0, 0x6E4, 0xF020, size ); - } - else - { - size += 33; - - rh = OfficeArtRecordHeader( 0x0, 0x6E5, 0xF020, size ); - } - - if ( _rgbUid1.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid1.size(); i++ ) - { - rgbUid1[i] = _rgbUid1[i]; - } - } - - if ( _rgbUid2.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid2.size(); i++ ) - { - rgbUid2[i] = _rgbUid2[i]; - } - } - - if ( ( _blipFileData != NULL ) && ( blipFileDataSize != 0 ) ) - { - BLIPFileData = new unsigned char[blipFileDataSize]; - - if ( NULL != BLIPFileData ) - { - memset (BLIPFileData, 0, blipFileDataSize); - memcpy (BLIPFileData, _blipFileData, blipFileDataSize); - } - } - - Initialize(); - } - - OfficeArtBlipTIFF (const OfficeArtBlipTIFF& oBlipTiff) : OfficeArtBlip(OfficeArtRecordHeader(oBlipTiff.rh)), tag(oBlipTiff.tag), BLIPFileData(NULL), blipFileDataSize(oBlipTiff.blipFileDataSize), bytes(NULL), size(oBlipTiff.size) - { - memset( rgbUid1, 0, rgbUidsSize ); - memcpy( rgbUid1, oBlipTiff.rgbUid1, rgbUidsSize ); - - memset( rgbUid2, 0, rgbUidsSize ); - memcpy( rgbUid2, oBlipTiff.rgbUid2, rgbUidsSize ); - - if ( blipFileDataSize != 0 ) - { - BLIPFileData = new unsigned char[blipFileDataSize]; - - if ( NULL != BLIPFileData ) - { - memset( BLIPFileData, 0, blipFileDataSize ); - memcpy( BLIPFileData, oBlipTiff.BLIPFileData, blipFileDataSize ); - } - } - - if ( 0 != size ) - { - bytes = new unsigned char[size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, size ); - memcpy( bytes, oBlipTiff.bytes, size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBlipTIFF; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBlipTIFF(*this); - } - - virtual ~OfficeArtBlipTIFF() - { - RELEASEARRAYOBJECTS(BLIPFileData); - RELEASEARRAYOBJECTS(bytes); - } - - private: - - inline void Initialize() - { - size = ( sizeof(rh) + rh.GetLength() ); - - if ( size != 0 ) - { - bytes = new unsigned char[size]; - - if ( NULL != bytes ) - { - memset( this->bytes, 0, this->size ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid1), sizeof(this->rgbUid1) ); - offset += sizeof(this->rgbUid1); - - if ( this->rh.GetInstance() == 0x6E5 ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid2), sizeof(this->rgbUid2) ); - offset += sizeof(this->rgbUid2); - } - - memcpy( ( this->bytes + offset ), &(this->tag), sizeof(this->tag) ); - offset += sizeof(this->tag); - - if ( ( this->BLIPFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - memcpy( ( this->bytes + offset ), this->BLIPFileData, this->blipFileDataSize ); - offset += this->blipFileDataSize; - } - } - } - } - - private: - - static const unsigned char rgbUidsSize = 16; - - unsigned char rgbUid1[rgbUidsSize]; - unsigned char rgbUid2[rgbUidsSize]; - unsigned char tag; - unsigned char* BLIPFileData; - unsigned int blipFileDataSize; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipWMF.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipWMF.h deleted file mode 100644 index 198f265623..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtBlipWMF.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBlip.h" -#include "OfficeArtMetafileHeader.h" - -namespace OfficeArt -{ - class OfficeArtBlipWMF: public OfficeArtBlip - { - private: - static const unsigned char rgbUidsSize = 16; - unsigned char rgbUid1[rgbUidsSize]; - unsigned char rgbUid2[rgbUidsSize]; - OfficeArtMetafileHeader metafileHeader; - unsigned char* BLIPFileData; - unsigned int blipFileDataSize; - - unsigned char* bytes; - unsigned int size; - - public: - OfficeArtBlipWMF(): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x216, 0xF01B, ( sizeof(metafileHeader) + sizeof(rgbUid1) ) )), - metafileHeader(), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - - this->Initialize(); - } - - explicit OfficeArtBlipWMF( const OfficeArtMetafileHeader& _metafileHeader, - unsigned char* _blipFileData, - const std::vector& _rgbUid1 = std::vector(), - const std::vector& _rgbUid2 = std::vector() ): - OfficeArtBlip(OfficeArtRecordHeader( 0x0, 0x216, 0xF01B, ( sizeof(metafileHeader) + sizeof(rgbUid1) ) )), - metafileHeader(_metafileHeader), BLIPFileData(NULL), blipFileDataSize(0), bytes(NULL), size(0) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - - this->blipFileDataSize = this->metafileHeader.GetCompressedSize(); - this->size = this->blipFileDataSize; - - if ( _rgbUid2.size() != rgbUidsSize ) - { - this->size += ( sizeof(this->metafileHeader) + sizeof(this->rgbUid1) ); - - this->rh = OfficeArtRecordHeader( 0x0, 0x216, 0xF01B, this->size ); - } - else - { - this->size += ( sizeof(this->metafileHeader) + sizeof(this->rgbUid1) + sizeof(this->rgbUid2) ); - - this->rh = OfficeArtRecordHeader( 0x0, 0x217, 0xF01B, this->size ); - } - - if ( _rgbUid1.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid1.size(); i++ ) - { - this->rgbUid1[i] = _rgbUid1[i]; - } - } - - if ( _rgbUid2.size() == rgbUidsSize ) - { - for ( unsigned int i = 0; i < _rgbUid2.size(); i++ ) - { - this->rgbUid2[i] = _rgbUid2[i]; - } - } - - if ( ( _blipFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( this->BLIPFileData != NULL ) - { - memset( this->BLIPFileData, 0, this->blipFileDataSize ); - - memcpy( this->BLIPFileData, _blipFileData, this->blipFileDataSize ); - } - } - - this->Initialize(); - } - - OfficeArtBlipWMF( const OfficeArtBlipWMF& _officeArtBlipWMF ): - OfficeArtBlip(OfficeArtRecordHeader( _officeArtBlipWMF.rh )), metafileHeader(_officeArtBlipWMF.metafileHeader), - BLIPFileData(NULL), blipFileDataSize(_officeArtBlipWMF.blipFileDataSize), bytes(NULL), size(_officeArtBlipWMF.size) - { - memset( this->rgbUid1, 0, rgbUidsSize ); - memcpy( this->rgbUid1, _officeArtBlipWMF.rgbUid1, rgbUidsSize ); - - memset( this->rgbUid2, 0, rgbUidsSize ); - memcpy( this->rgbUid2, _officeArtBlipWMF.rgbUid2, rgbUidsSize ); - - if ( this->blipFileDataSize != 0 ) - { - this->BLIPFileData = new unsigned char[this->blipFileDataSize]; - - if ( this->BLIPFileData != NULL ) - { - memset( this->BLIPFileData, 0, this->blipFileDataSize ); - - memcpy( this->BLIPFileData, _officeArtBlipWMF.BLIPFileData, this->blipFileDataSize ); - } - } - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - memcpy( this->bytes, _officeArtBlipWMF.bytes, this->size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtBlipWMF; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtBlipWMF( *this ); - } - - virtual ~OfficeArtBlipWMF() - { - RELEASEARRAYOBJECTS (BLIPFileData); - RELEASEARRAYOBJECTS (bytes); - } - - private: - - void Initialize() - { - this->size = ( sizeof(this->rh) + this->rh.GetLength() ); - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid1), sizeof(this->rgbUid1) ); - offset += sizeof(this->rgbUid1); - - if ( this->rh.GetInstance() == 0x3D5 ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rgbUid2), sizeof(this->rgbUid2) ); - offset += sizeof(this->rgbUid2); - } - - memcpy( ( this->bytes + offset ), &(this->metafileHeader), sizeof(this->metafileHeader) ); - offset += sizeof(this->metafileHeader); - - if ( ( this->BLIPFileData != NULL ) && ( this->blipFileDataSize != 0 ) ) - { - memcpy( ( this->bytes + offset ), this->BLIPFileData, this->blipFileDataSize ); - offset += this->blipFileDataSize; - } - } - } - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtCOLORREF.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtCOLORREF.h deleted file mode 100644 index b275ea97c2..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtCOLORREF.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../../Common/FormatUtils.h" - -namespace OfficeArt -{ - class OfficeArtCOLORREF - { - public: - OfficeArtCOLORREF() - { - ASCDocFormatUtils::BitSet oShapeSettings (4); - - oShapeSettings.SetBit (0,0); - oShapeSettings.SetBit (0,1); - oShapeSettings.SetBit (0,2); - oShapeSettings.SetBit (0,3); - oShapeSettings.SetBit (0,4); - } - - inline unsigned long Get() - { - return 0x00FFFFFF; - } - - private: - - unsigned char red; - unsigned char green; - unsigned char blue; - - bool fPaletteIndex; - bool fPaletteRGB; - bool fSystemRGB; - bool fSchemeIndex; - bool fSysIndex; - - unsigned char Index; // if SchemeIndex==0x01 A value of 0x1 specifies that red will be treated as an index into the current color scheme table. If this value is 0x1, green and blue MUST be 0x00 - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtChildAnchor.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtChildAnchor.h deleted file mode 100644 index 90d841e180..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtChildAnchor.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtChildAnchor : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 24; - public: - OfficeArtChildAnchor(): rh(0x0, 0x000, 0xF00F, 0x00000010), Left(0), Top(0), Right(0), Bottom(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtChildAnchor(int left, int right, int top, int bottom) : rh(0x0, 0x000, 0xF00F, 0x00000010), Left(left), Top(top), Right(right), Bottom(bottom) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), &(Left), sizeof(Left) ); - offset += sizeof(Left); - memcpy( ( bytes + offset ), &(Top), sizeof(Top) ); - offset += sizeof(Top); - memcpy( ( bytes + offset ), &(Right), sizeof(Right) ); - offset += sizeof(Right); - memcpy( ( bytes + offset ), &(Bottom), sizeof(Bottom) ); - offset += sizeof(Bottom); - } - - OfficeArtChildAnchor(const OfficeArtChildAnchor& _fdg ): rh( _fdg.rh ), Left(_fdg.Left), Top(_fdg.Top), Right(_fdg.Right), Bottom(_fdg.Bottom) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, _fdg.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtChildAnchor; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtChildAnchor(*this); - } - - - protected: - - OfficeArtRecordHeader rh; - - int Left; - int Top; - int Right; - int Bottom; - - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientAnchor.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientAnchor.h deleted file mode 100644 index ffeeec95d6..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientAnchor.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtClientAnchor : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 12; - public: - OfficeArtClientAnchor (): rh(0x0, 0x0, 0xF010, 0x00000004), clientanchor(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtClientAnchor (int anchor) : rh(0x0, 0x000, 0xF010, 0x00000004), clientanchor(anchor) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), &(clientanchor), sizeof(clientanchor) ); - } - - OfficeArtClientAnchor (const OfficeArtClientAnchor& anchor): rh (anchor.rh), clientanchor(anchor.clientanchor) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, anchor.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtClientAnchor; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtClientAnchor(*this); - } - - - protected: - - OfficeArtRecordHeader rh; - - int clientanchor; - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientData.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientData.h deleted file mode 100644 index 37c2706053..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientData.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtClientData : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 12; - public: - OfficeArtClientData (): rh(0x0, 0x0, 0xF011, 0x00000004), clientdata(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtClientData (int anchor) : rh(0x0, 0x000, 0xF011, 0x00000004), clientdata(anchor) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), &(clientdata), sizeof(clientdata) ); - } - - OfficeArtClientData (const OfficeArtClientData& data): rh (data.rh), clientdata (data.clientdata) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, data.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtClientData; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtClientData(*this); - } - - - protected: - - OfficeArtRecordHeader rh; - - int clientdata; // Word 2000 and Word 97 use this value to store a reference count of the - // shape. Word 2002, Office Word 2003, Office Word 2007, and Word 2010 ignore this value. - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientTextbox.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientTextbox.h deleted file mode 100644 index c62c1e8ed9..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtClientTextbox.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtClientTextbox : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 12; - public: - - OfficeArtClientTextbox (): rh(0x0, 0x0, 0xF00D, 0x00000004), clienttextbox(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtClientTextbox (unsigned short textbox) : rh(0x0, 0x0, 0xF00D, 0x00000004), clienttextbox(textbox) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - unsigned short nNum = 0; - - memcpy( ( bytes + offset ), &(nNum), sizeof(unsigned short)); - offset += sizeof(unsigned short ); - - memcpy( ( bytes + offset ), &(clienttextbox), sizeof(unsigned short)); - } - - OfficeArtClientTextbox (const OfficeArtClientTextbox& data) : rh (data.rh), clienttextbox (data.clienttextbox) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, data.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtClientTextbox; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtClientTextbox(*this); - } - - protected: - - OfficeArtRecordHeader rh; - - unsigned short clienttextbox; // text identifier of the shape - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtContent.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtContent.h deleted file mode 100644 index 3279505190..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtContent.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace OfficeArt -{ - class OfficeArtContent: public IOfficeArtAbstractContainer - { - public: - - OfficeArtContent() : bytes(NULL), size (0) - { - Initialize(); - } - - OfficeArtContent(const OfficeArtContent& _office): officeArtRecords(_office.officeArtRecords), size(_office.size), bytes(NULL) - { - if (size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _office.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtContent; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtContent(*this); - } - - virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) - { - officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)officeArtRecords.size(); - } - - virtual void Clear() - { - officeArtRecords.clear(); - Initialize(); - } - - virtual ~OfficeArtContent() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - size += (*iter)->Size(); - - RELEASEARRAYOBJECTS (bytes); - - if (size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - for (list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtRecord), officeArtRecord->Size()); - offset += officeArtRecord->Size(); - } - } - } - } - } - - protected: - - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDgContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDgContainer.h deleted file mode 100644 index 877d3f7124..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDgContainer.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IOfficeArtAbstractContainer.h" - -namespace OfficeArt -{ - class OfficeArtDgContainer: public IOfficeArtAbstractContainer - { - public: - OfficeArtDgContainer () : rh( 0xF, 0x000, 0xF002, 0 ), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) - { - Initialize(); - } - - OfficeArtDgContainer (const OfficeArtDgContainer& _officeArtDgContainer): rh(_officeArtDgContainer.rh),officeArtRecords(_officeArtDgContainer.officeArtRecords), size(_officeArtDgContainer.size), bytes(NULL) - { - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _officeArtDgContainer.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtDgContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtDgContainer(*this); - } - - virtual void PushBack(const IOfficeArtRecord& _officeArtRecord) - { - officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone())); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)officeArtRecords.size(); - } - - virtual void Clear() - { - officeArtRecords.clear(); - Initialize(); - } - - virtual ~OfficeArtDgContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - size += (*iter)->Size(); - } - - rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF002, size); - - size += sizeof(rh); - - RELEASEARRAYOBJECTS (bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtRecord), officeArtRecord->Size()); - offset += officeArtRecord->Size(); - } - } - } - } - } - - protected: - - OfficeArtRecordHeader rh; - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDggContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDggContainer.h deleted file mode 100644 index d8f88d78e0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtDggContainer.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#include "IOfficeArtAbstractContainer.h" - -namespace OfficeArt -{ - class OfficeArtDggContainer: public IOfficeArtAbstractContainer - { - protected: - OfficeArtRecordHeader rh; - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - - public: - OfficeArtDggContainer() : rh( 0xF, 0x000, 0xF000, 0 ), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) - { - Initialize(); - } - - OfficeArtDggContainer( const OfficeArtDggContainer& _officeArtDgContainer ): rh( _officeArtDgContainer.rh ), - officeArtRecords(_officeArtDgContainer.officeArtRecords), size(_officeArtDgContainer.size), bytes(NULL) - { - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - memcpy( this->bytes, _officeArtDgContainer.bytes, this->size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtDgContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtDggContainer( *this ); - } - - virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) - { - this->officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); - - this->Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)this->officeArtRecords.size(); - } - - virtual void Clear() - { - this->officeArtRecords.clear(); - - this->Initialize(); - } - - virtual ~OfficeArtDggContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - void Initialize() - { - size = 0; - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - size += (*iter)->Size(); - } - - rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF000, size); - size += sizeof(rh); - - RELEASEARRAYOBJECTS(bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(*officeArtRecord), officeArtRecord->Size() ); - offset += officeArtRecord->Size(); - } - } - } - } - } - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFBSE.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFBSE.h deleted file mode 100644 index 8024d28acb..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFBSE.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtBStoreContainerFileBlock.h" -#include "OfficeArtBlip.h" - -#include -#include - -namespace OfficeArt -{ - namespace Enumerations - { - enum MSOBLIPTYPE - { - msoblipERROR = 0x00, // There was an error reading the file. - msoblipUNKNOWN = 0x01, // Unknown BLIP type. - msoblipEMF = 0x02, // EMF format. - msoblipWMF = 0x03, // WMF format. - msoblipPICT = 0x04, // Macintosh PICT format. - msoblipJPEG = 0x05, // JPEG format. - msoblipPNG = 0x06, // PNG format. - msoblipDIB = 0x07, // DIB format. - msoblipTIFF = 0x11, // TIFF format. - msoblipCMYKJPEG = 0x12 // JPEG format in YCCK or CMYK color space. - }; - } - - typedef unsigned int MSOFO; - - class OfficeArtFBSE : public OfficeArtBStoreContainerFileBlock - { - public: - - OfficeArtFBSE () : OfficeArtBStoreContainerFileBlock(OfficeArtRecordHeader( 0x2, (unsigned short)Enumerations::msoblipUNKNOWN, 0xF007, 36 )), btWin32(Enumerations::msoblipUNKNOWN), btMacOS(Enumerations::msoblipUNKNOWN), tag(0), size(0), cRef(0), foDelay(0xFFFFFFFF), cbName(0), bytes(NULL), totalSize(0) - { - m_bHaveEmbeddedBlip = FALSE; - m_pBlip = NULL; - - memset (rgbUid, 0, sizeof(rgbUid)); - - Initialize(); - } - - OfficeArtFBSE (bool bEmBlip, Enumerations::MSOBLIPTYPE _btWin32, - Enumerations::MSOBLIPTYPE _btMacOS, - unsigned int _size, - const std::vector& _rgbUid = std::vector( 0, 16 ), - unsigned int _cRef = 1, - unsigned short _tag = 0xFF, - OfficeArt::MSOFO _foDelay = 0, - const wchar_t* _nameData = NULL ): - OfficeArtBStoreContainerFileBlock(OfficeArtRecordHeader( 0x2, (unsigned short)_btWin32, 0xF007, 36 )), - btWin32(_btWin32), - btMacOS(_btMacOS), - tag(_tag), - size(_size), - cRef(_cRef), - foDelay(_foDelay), - cbName(0), - bytes(NULL), - totalSize(0) - { - m_bHaveEmbeddedBlip = bEmBlip; - - //m_bHaveEmbeddedBlip = FALSE; - //m_pBlip = NULL; - - memset( this->rgbUid, 0, sizeof(this->rgbUid) ); - - if (_nameData) - { - nameData = std::wstring( _nameData ); - - cbName = ( sizeof(wchar_t) * ( this->nameData.length() + 1 ) ); - - if (cbName > 0xFE) - { - cbName = 0; - nameData = std::wstring(); - } - } - - if ( _rgbUid.size() == rgbUidSize ) - { - for ( unsigned int i = 0; i < _rgbUid.size(); i++ ) - { - rgbUid[i] = _rgbUid[i]; - } - } - - if (m_bHaveEmbeddedBlip) - { - rh = OfficeArtRecordHeader (0x2, (unsigned short)_btWin32, 0xF007, (cbName + 36 + size)); - } - else - { - rh = OfficeArtRecordHeader (0x2, (unsigned short)_btWin32, 0xF007, (cbName + 36)); - } - - Initialize(); - } - - - OfficeArtFBSE(const OfficeArtFBSE& _officeArtFBSE ): - OfficeArtBStoreContainerFileBlock(OfficeArtRecordHeader( _officeArtFBSE.rh )), - btWin32(_officeArtFBSE.btWin32), btMacOS(_officeArtFBSE.btMacOS), tag(_officeArtFBSE.tag), - size(_officeArtFBSE.size), cRef(_officeArtFBSE.cRef), foDelay(_officeArtFBSE.foDelay), - cbName(_officeArtFBSE.cbName), bytes(NULL), totalSize(_officeArtFBSE.totalSize), nameData(_officeArtFBSE.nameData), m_bHaveEmbeddedBlip (_officeArtFBSE.m_bHaveEmbeddedBlip), m_pBlip (NULL) - { - - //if (_officeArtFBSE.m_pBlip) - //{ - // m_bHaveEmbeddedBlip = TRUE; - // m_pBlip = (OfficeArtBlip*)_officeArtFBSE.m_pBlip->Clone(); - //} - - memset (rgbUid, 0, sizeof(rgbUid) ); - memcpy (rgbUid, _officeArtFBSE.rgbUid, sizeof(rgbUid) ); - - if (totalSize != 0 ) - { - bytes = new unsigned char[totalSize]; - - if (bytes) - { - memset (bytes, 0, totalSize); - memcpy (bytes, _officeArtFBSE.bytes, totalSize); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->totalSize; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFBSE; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFBSE( *this ); - } - - virtual ~OfficeArtFBSE() - { - RELEASEARRAYOBJECTS(bytes); - //RELEASEOBJECT (m_pBlip); - } - - // - inline void SetFoDelay (int nFoDelay) - { - foDelay = nFoDelay; - - Initialize(); - } - - - //inline void SetEmbeddedBlip (OfficeArtBlip* pBlip) - //{ - // m_bHaveEmbeddedBlip = TRUE; - // m_pBlip = (OfficeArtBlip*)pBlip->Clone(); - - // Initialize(); - //} - - private: - - void Initialize() - { - this->totalSize = ( sizeof(this->rh) + sizeof(unsigned char) + sizeof(unsigned char) + sizeof(this->rgbUid) + - sizeof(this->tag) + sizeof(this->size) + sizeof(this->cRef) + - sizeof(this->foDelay) + sizeof(unsigned char) + sizeof(this->cbName) + - sizeof(unsigned char) + sizeof(unsigned char) + this->cbName ); - - //if (m_pBlip) - //{ - // totalSize += m_pBlip->Size(); - //} - - bytes = new unsigned char[totalSize]; - - if (bytes) - { - memset( this->bytes, 0, this->totalSize ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - this->bytes[offset] = (unsigned char)(this->btWin32); - offset += sizeof(unsigned char); - - this->bytes[offset] = (unsigned char)(this->btMacOS); - offset += sizeof(unsigned char); - - memcpy( ( this->bytes + offset ), this->rgbUid, sizeof(this->rgbUid) ); - offset += sizeof(this->rgbUid); - - memcpy( ( this->bytes + offset ), &(this->tag), sizeof(this->tag) ); - offset += sizeof(this->tag); - - memcpy( ( this->bytes + offset ), &(this->size), sizeof(this->size) ); - offset += sizeof(this->size); - - memcpy( ( this->bytes + offset ), &(this->cRef), sizeof(this->cRef) ); - offset += sizeof(this->cRef); - - memcpy( ( this->bytes + offset ), &(this->foDelay), sizeof(this->foDelay) ); - offset += ( sizeof(this->foDelay) + sizeof(unsigned char) ); - - this->bytes[offset] = this->cbName; - offset += ( sizeof(this->cbName) + sizeof(unsigned char) + sizeof(unsigned char) ); - - if ( (cbName != 0) && (nameData.length() != 0) ) - { - memcpy ((bytes + offset), nameData.c_str(), ( sizeof(wchar_t) * (nameData.length() + 1) )); - offset += ( sizeof(wchar_t) * ( nameData.length() + 1)); - } - - //if (m_pBlip) - //{ - // totalSize += m_pBlip->Size(); - // memcpy ((bytes + offset), (*m_pBlip), m_pBlip->Size()); - //} - } - } - - private: - - Enumerations::MSOBLIPTYPE btWin32; - Enumerations::MSOBLIPTYPE btMacOS; - static const unsigned char rgbUidSize = 16; - unsigned char rgbUid[rgbUidSize]; - - unsigned short tag; - unsigned int size; - unsigned int cRef; - OfficeArt::MSOFO foDelay; - unsigned char cbName; - std::wstring nameData; - - unsigned char* bytes; - unsigned int totalSize; - - bool m_bHaveEmbeddedBlip; - OfficeArtBlip* m_pBlip; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDG.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDG.h deleted file mode 100644 index e9cf2eb4f5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDG.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtFDG : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 16; - public: - OfficeArtFDG(): rh(0x0, 0xFFE, 0xF008, 0x00000008), spidCur(0), csp(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtFDG(MSOSPID _spid, unsigned int _csp) : rh(0x0, 0xFFE, 0xF008, 0x00000008), spidCur(_spid), csp(_csp) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), &(csp), sizeof(csp) ); - offset += sizeof(csp); - - memcpy( ( bytes + offset ), &(spidCur), sizeof(spidCur) ); - offset += sizeof(spidCur); - } - - OfficeArtFDG(const OfficeArtFDG& _fdg ): rh( _fdg.rh ), spidCur(_fdg.spidCur), csp(_fdg.csp) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, _fdg.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFDG; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFDG(*this); - } - - - protected: - - OfficeArtRecordHeader rh; - MSOSPID spidCur; - unsigned int csp; - - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDGGBlock.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDGGBlock.h deleted file mode 100644 index 640368bd90..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFDGGBlock.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - struct OfficeArtIDCL // Record specifies a file identifier cluster, which is used to group shape identifiers within a drawing - { - OfficeArtIDCL () : dgid (0), cspidCur(0) - { - - } - - OfficeArtIDCL (unsigned int idgid, unsigned int icspidCur) : dgid (idgid), cspidCur(icspidCur) - { - - } - - unsigned int dgid; - unsigned int cspidCur; - }; - - struct OfficeArtFDGG - { - OfficeArtFDGG () : spidMax (0), cidcl(0), cspSaved (0), cdgSaved(0) - { - - } - - OfficeArtFDGG (MSOSPID id, unsigned int cid, unsigned int csp, unsigned int cdg) : spidMax (id), cidcl(cid), cspSaved (csp), cdgSaved(cdg) - { - - } - - MSOSPID spidMax; // Maximum shape ID - unsigned int cidcl; // Number of FileIdClusters - unsigned int cspSaved; // Total number of shapes saved - unsigned int cdgSaved; // Total number of drawings saved - }; - - class OfficeArtFDGGBlock : public IOfficeArtRecord - { - public: - OfficeArtFDGGBlock (): rh(0x0, 0x000, 0xF006, 0x00000010), bytes (NULL), size(0) - { - - } - - OfficeArtFDGGBlock (const OfficeArtFDGGBlock& office): rh (office.rh), head (office.head), bytes (NULL), size(0) - { - for (size_t i = 0; i < office.Rgidcl.size(); ++i) - Rgidcl.push_back(office.Rgidcl[i]); - - Initialize(); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFDGGBlock; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFDGGBlock(*this); - } - - inline void SetHead (const OfficeArtFDGG& oHead) - { - head = oHead; - } - - virtual void PushBack (const OfficeArtIDCL& record) - { - Rgidcl.push_back(record); - Initialize(); - } - - - virtual ~OfficeArtFDGGBlock() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - void Initialize() - { - rh = OfficeArtRecordHeader (0x0, 0x000, 0xF006, 0x00000010 + (int)Rgidcl.size() * 0x00000008); - - size = sizeof(rh); - size += sizeof(OfficeArtFDGG); - size += sizeof(OfficeArtIDCL) * (int)Rgidcl.size(); - - RELEASEARRAYOBJECTS (bytes); - - if (size) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy ( (bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - memcpy ( (bytes + offset), &head, sizeof(OfficeArtFDGG)); - offset += sizeof(OfficeArtFDGG); - - for (size_t i = 0; i < Rgidcl.size(); ++i) - { - memcpy ( (bytes + offset), &Rgidcl[i], sizeof(OfficeArtIDCL)); - offset += sizeof(OfficeArtIDCL); - } - } - } - } - - - protected: - - OfficeArtRecordHeader rh; - OfficeArtFDGG head; - vector Rgidcl; // An array of OfficeArtIDCL elements - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPT.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPT.h deleted file mode 100644 index e4229a92ab..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPT.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" -#include "OfficeArtRGFOPTE.h" - -namespace OfficeArt -{ - class OfficeArtFOPT: public IOfficeArtRecord - { - public: - OfficeArtFOPT() : rh( 0x3, 0, 0xF00B, 0 ), fopt(), bytes(NULL), size(0) - { - size = sizeof(rh); - - if (size) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset( bytes, 0, size ); - memcpy( bytes, (unsigned char*)rh, sizeof(rh) ); - } - } - } - - explicit OfficeArtFOPT (const OfficeArtRGFOPTE& _fopt ) : rh( 0x3, _fopt.Count(), 0xF00B, _fopt.Size() ), fopt(_fopt), bytes(NULL), size(0) - { - this->size = ( sizeof(this->rh) + this->fopt.Size() ); - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - memcpy( this->bytes, (unsigned char*)this->rh, sizeof(this->rh) ); - memcpy( ( this->bytes + sizeof(this->rh) ), (unsigned char*)this->fopt, this->fopt.Size() ); - } - } - } - - OfficeArtFOPT (const OfficeArtFOPT& _officeArtFOPT) : rh(_officeArtFOPT.rh), fopt(_officeArtFOPT.fopt), bytes(NULL), size(_officeArtFOPT.size) - { - if (size) - { - bytes = new unsigned char[size]; - - if ( this->bytes != NULL ) - { - memset( bytes, 0, size ); - memcpy( bytes, _officeArtFOPT.bytes, size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return bytes; - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFOPT (); - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFOPT( *this ); - } - - virtual ~OfficeArtFOPT() - { - RELEASEARRAYOBJECTS (bytes); - } - - protected: - - OfficeArtRecordHeader rh; - OfficeArtRGFOPTE fopt; - - unsigned char* bytes; - unsigned int size; - }; - class OfficeArtSecondaryFOPT: public IOfficeArtRecord - { - public: - OfficeArtSecondaryFOPT() : rh( 0x3, 0, 0xF122, 0 ), fopt(), bytes(NULL), size(0) - { - size = sizeof(rh); - - if (size) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset( bytes, 0, size ); - memcpy( bytes, (unsigned char*)rh, sizeof(rh) ); - } - } - } - - explicit OfficeArtSecondaryFOPT (const OfficeArtRGFOPTE& _fopt ) : rh( 0x3, _fopt.Count(), 0xF122, _fopt.Size() ), fopt(_fopt), bytes(NULL), size(0) - { - this->size = ( sizeof(this->rh) + this->fopt.Size() ); - - if ( this->size != 0 ) - { - this->bytes = new unsigned char[this->size]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->size ); - - memcpy( this->bytes, (unsigned char*)this->rh, sizeof(this->rh) ); - memcpy( ( this->bytes + sizeof(this->rh) ), (unsigned char*)this->fopt, this->fopt.Size() ); - } - } - } - - OfficeArtSecondaryFOPT (const OfficeArtSecondaryFOPT& _officeArtFOPT) : rh(_officeArtFOPT.rh), fopt(_officeArtFOPT.fopt), bytes(NULL), size(_officeArtFOPT.size) - { - if (size) - { - bytes = new unsigned char[size]; - - if ( this->bytes != NULL ) - { - memset( bytes, 0, size ); - memcpy( bytes, _officeArtFOPT.bytes, size ); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return bytes; - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtSecondaryFOPT (); - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtSecondaryFOPT( *this ); - } - - virtual ~OfficeArtSecondaryFOPT() - { - RELEASEARRAYOBJECTS (bytes); - } - - protected: - - OfficeArtRecordHeader rh; - OfficeArtRGFOPTE fopt; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTE.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTE.h deleted file mode 100644 index f25b22080e..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTE.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtFOPTEOPID.h" - -namespace OfficeArt -{ - class OfficeArtFOPTE - { - public: - OfficeArtFOPTE () : opid( 0, false, false ), op(0) - { - memset( this->bytes, 0, sizeof(this->bytes) ); - } - - explicit OfficeArtFOPTE( OfficeArtFOPTEOPID _opid, int _op ) : opid(_opid), op(_op) - { - memset( this->bytes, 0, sizeof(this->bytes) ); - - unsigned short opidValue = this->opid.GetValue(); - - memcpy( this->bytes, &opidValue, sizeof(opidValue) ); - memcpy( ( this->bytes + sizeof(opidValue) ), &(this->op), sizeof(this->op) ); - } - - OfficeArtFOPTE (const OfficeArtFOPTE& _officeArtFOPTE) : opid(_officeArtFOPTE.opid), op(_officeArtFOPTE.op) - { - memset( this->bytes, 0, sizeof(this->bytes) ); - memcpy( this->bytes, _officeArtFOPTE.bytes, sizeof(_officeArtFOPTE.bytes) ); - } - - OfficeArtFOPTEOPID GetOpid() const - { - return this->opid; - } - - int GetValue() const - { - return this->op; - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return (unsigned int)sizeof(this->bytes); - } - - virtual ~OfficeArtFOPTE() - { - } - - protected: - - OfficeArtFOPTEOPID opid; - int op; - - static const unsigned char SIZE_IN_BYTES = ( sizeof(OfficeArtFOPTEOPID) + sizeof(int) ); - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTEOPID.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTEOPID.h deleted file mode 100644 index 3cb86b1585..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFOPTEOPID.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace OfficeArt -{ - union OfficeArtFOPTEOPID - { - private: - struct - { - unsigned short opid:14; - unsigned short fBid:1; - unsigned short fComplex:1; - } OfficeArtFOPTEOPIDStruct; - unsigned short OfficeArtFOPTEOPIDUnsignedShort; - - public: - - OfficeArtFOPTEOPID() : OfficeArtFOPTEOPIDUnsignedShort(0) - { - } - - explicit OfficeArtFOPTEOPID (unsigned short _opid, bool _fBid, bool _fComplex) : OfficeArtFOPTEOPIDUnsignedShort(0) - { - this->OfficeArtFOPTEOPIDStruct.opid = _opid; - ( _fBid ) ? ( this->OfficeArtFOPTEOPIDStruct.fBid = 1 ) : ( this->OfficeArtFOPTEOPIDStruct.fBid = 0 ); - ( _fComplex ) ? ( this->OfficeArtFOPTEOPIDStruct.fComplex = 1 ) : ( this->OfficeArtFOPTEOPIDStruct.fComplex = 0 ); - } - - inline unsigned short GetOpid() const - { - return this->OfficeArtFOPTEOPIDStruct.opid; - } - - inline bool GetFBid() const - { - return ( ( this->OfficeArtFOPTEOPIDStruct.fBid == 1 ) ? ( true ) : ( false ) ); - } - - inline bool GetFComplex() const - { - return ( ( this->OfficeArtFOPTEOPIDStruct.fComplex == 1 ) ? ( true ) : ( false ) ); - } - - inline unsigned int GetValue() const - { - return this->OfficeArtFOPTEOPIDUnsignedShort; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSP.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSP.h deleted file mode 100644 index 590d896605..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSP.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" -#include "Enumerations.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -#define OFFICE_ART_FSP_GROUP (0x00000001) -#define OFFICE_ART_FSP_CHILD (0x00000002) -#define OFFICE_ART_FSP_PATRIARCH (0x00000004) -#define OFFICE_ART_FSP_DELETED (0x00000008) -#define OFFICE_ART_FSP_OLESHAPE (0x00000010) -#define OFFICE_ART_FSP_HAVEMASTER (0x00000020) -#define OFFICE_ART_FSP_FLIPH (0x00000040) -#define OFFICE_ART_FSP_FLIPV (0x00000080) -#define OFFICE_ART_FSP_CONNECTOR (0x00000100) -#define OFFICE_ART_FSP_HAVEANCHOR (0x00000200) -#define OFFICE_ART_FSP_BACKGROUND (0x00000400) -#define OFFICE_ART_FSP_HAVESPT (0x00000800) - -namespace OfficeArt -{ - class OfficeArtFSP : public IOfficeArtRecord - { - public: - OfficeArtFSP() : rh( 0x2, (unsigned short)Enumerations::msosptNotPrimitive, 0xF00A, 0x00000008 ), spid(0), flags(0) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit OfficeArtFSP (Enumerations::MSOSPT _shapeType, MSOSPID _spid = 0, unsigned int _flags = 0) : rh( 0x2, (unsigned short)_shapeType, 0xF00A, 0x00000008 ), spid(_spid), flags(_flags) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->rh), sizeof(this->rh) ); - offset += sizeof(this->rh); - - memcpy( ( this->bytes + offset ), &(this->spid), sizeof(this->spid) ); - offset += sizeof(this->spid); - - memcpy( ( this->bytes + offset ), &(this->flags), sizeof(this->flags) ); - offset += sizeof(this->flags); - } - - OfficeArtFSP (const OfficeArtFSP& _officeArtFSP) : rh(_officeArtFSP.rh), spid(_officeArtFSP.spid), flags(_officeArtFSP.flags) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, _officeArtFSP.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&this->bytes); - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFSP; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFSP( *this ); - } - - virtual ~OfficeArtFSP() - { - } - - protected: - - OfficeArtRecordHeader rh; - MSOSPID spid; - unsigned int flags; - static const unsigned char SIZE_IN_BYTES = 16; - unsigned char bytes[SIZE_IN_BYTES]; - }; - - typedef OfficeArtFSP FSP; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSPGR.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSPGR.h deleted file mode 100644 index 03bc05b6a3..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtFSPGR.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtFSPGR : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 24; - public: - - OfficeArtFSPGR() : rh (0x1, 0x000, 0xF009, 0x00000010), xLeft(0), yTop(0), xRight(0), yBottom(0) - { - memset(bytes, 0, SIZE_IN_BYTES); - } - - OfficeArtFSPGR (int Left, int Top, int Right, int Bottom) : rh (0x1, 0x000, 0xF009, 0x00000010), xLeft(Left), yTop(Top), xRight(Right), yBottom(Bottom) - { - memset (bytes, 0, SIZE_IN_BYTES); - - unsigned int offset = 0; - - memcpy ((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - memcpy ((bytes + offset), &xLeft, sizeof(xLeft)); - offset += sizeof(xLeft); - - memcpy ((bytes + offset), &yTop, sizeof(yTop)); - offset += sizeof(yTop); - - memcpy ((bytes + offset), &xRight, sizeof(xRight)); - offset += sizeof(xRight); - - memcpy ((bytes + offset), &yBottom, sizeof(yBottom)); - offset += sizeof(yBottom); - } - - OfficeArtFSPGR (const OfficeArtFSPGR& _office): rh(_office.rh), xLeft(_office.xLeft), yTop(_office.yTop), xRight(_office.xRight), yBottom(_office.yBottom) - { - memset (bytes, 0, SIZE_IN_BYTES); - memcpy (bytes, _office.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&this->bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&this->bytes); - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtFSPGR; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtFSPGR (*this); - } - - protected: - - OfficeArtRecordHeader rh; - - int xLeft; - int yTop; - int xRight; - int yBottom; - - unsigned char bytes[SIZE_IN_BYTES]; - }; - - typedef OfficeArtFSPGR FSPGR; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtInlineSpContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtInlineSpContainer.h deleted file mode 100644 index 4d7f5542c1..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtInlineSpContainer.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "OfficeArtSpContainer.h" -#include "OfficeArtBStoreContainerFileBlock.h" - -namespace OfficeArt -{ - class OfficeArtInlineSpContainer: public IOfficeArtAbstractContainer - { - public: - OfficeArtInlineSpContainer() : shape(), bytes(NULL), size(0) - { - Initialize(); - } - - explicit OfficeArtInlineSpContainer (const OfficeArtSpContainer& oShape) : shape(oShape), bytes(NULL), size(0) - { - Initialize(); - } - - OfficeArtInlineSpContainer (const OfficeArtInlineSpContainer& _officeArtInlineSpContainer) : shape(_officeArtInlineSpContainer.shape), rgfb(_officeArtInlineSpContainer.rgfb), bytes(NULL), size(_officeArtInlineSpContainer.size) - { - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _officeArtInlineSpContainer.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtInlineSpContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtInlineSpContainer(*this); - } - - virtual void PushBack (const OfficeArtBStoreContainerFileBlock& _officeArtBStoreContainerFileBlock ) - { - rgfb.push_back(OfficeArtBStoreContainerFileBlockPtr(static_cast(_officeArtBStoreContainerFileBlock.Clone()))); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)rgfb.size(); - } - - virtual void Clear() - { - rgfb.clear(); - Initialize(); - } - - virtual ~OfficeArtInlineSpContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = shape.Size(); - - for (std::list::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) - { - size += (*iter)->Size(); - } - - RELEASEARRAYOBJECTS(bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy(bytes, (unsigned char*)(shape), shape.Size()); - offset += shape.Size(); - - for (std::list::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) - { - const OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->operator->(); - if ( officeArtBStoreContainerFileBlock != NULL ) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size()); - offset += officeArtBStoreContainerFileBlock->Size(); - } - } - } - } - } - - private: - - OfficeArtSpContainer shape; - std::list rgfb; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtMetafileHeader.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtMetafileHeader.h deleted file mode 100644 index af0fe9345d..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtMetafileHeader.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -namespace OfficeArt -{ -#pragma pack(push, 1) - - class OfficeArtMetafileHeader - { - private: - unsigned int cbSize; - RECT rcBounds; - POINT ptSize; - unsigned int cbSave; - unsigned char compression; - const unsigned char filter; - - public: - OfficeArtMetafileHeader(): - cbSize(0), rcBounds(), ptSize(), cbSave(0), compression((unsigned char)COMPRESSION_METHOD_DEFLATE), filter(0xFE) - { - } - - explicit OfficeArtMetafileHeader( unsigned int _cbSize, RECT _rcBounds, POINT _ptSize, unsigned int _cbSave, COMPRESSION_METHOD _compression ): - cbSize(_cbSize), rcBounds(_rcBounds), ptSize(_ptSize), cbSave(_cbSave), compression((unsigned char)_compression), filter(0xFE) - { - } - - unsigned int GetUncompressedSize() const - { - return this->cbSize; - } - - RECT GetClippingRegion() const - { - return this->rcBounds; - } - - POINT GetSizeToRender() const - { - return this->ptSize; - } - - unsigned int GetCompressedSize() const - { - return this->cbSave; - } - - COMPRESSION_METHOD GetCompressionMethod() const - { - return (COMPRESSION_METHOD)(this->compression); - } - }; - -#pragma pack(pop) -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRGFOPTE.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRGFOPTE.h deleted file mode 100644 index 15c79042c5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRGFOPTE.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ComplexOfficeArtProperty.h" - -namespace OfficeArt -{ - class OfficeArtRGFOPTE - { - public: - - OfficeArtRGFOPTE () : bytes(NULL), size(0) - { - - } - - OfficeArtRGFOPTE (const OfficeArtRGFOPTE& prop) : complexOfficeArtProperties(prop.complexOfficeArtProperties), bytes(NULL), size(prop.size) - { - Initialize(); - } - - inline unsigned int PushComplexProperty (const ComplexOfficeArtProperty& complex) - { - complexOfficeArtProperties.push_back(complex); - - Initialize(); - - return (unsigned int)complexOfficeArtProperties.size(); - } - - inline unsigned int Clear() - { - complexOfficeArtProperties.clear(); - - Initialize(); - - return (unsigned int)complexOfficeArtProperties.size(); - } - - inline unsigned int Count() const - { - return (unsigned int)this->complexOfficeArtProperties.size(); - } - - operator unsigned char*() const - { - return this->bytes; - } - - operator const unsigned char*() const - { - return (const unsigned char*)(bytes); - } - - inline unsigned int Size() const - { - return size; - } - - ~OfficeArtRGFOPTE() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - void Initialize() - { - RELEASEARRAYOBJECTS (bytes); - - size = 0; - - for ( std::list::const_iterator iter = complexOfficeArtProperties.begin(); iter != complexOfficeArtProperties.end(); ++iter) - { - size += iter->officeArtProperty.Size(); - - if ( iter->officeArtProperty.GetOpid().GetFComplex() && (NULL != iter->m_pComplexData)) - { - size += iter->officeArtProperty.GetValue() + sizeof(unsigned short) * 3; - } - } - - if ( size != 0 ) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset (bytes, 0, size); - - unsigned int offset = 0; - - for ( std::list::const_iterator iter = complexOfficeArtProperties.begin(); iter != complexOfficeArtProperties.end(); ++iter) - { - memcpy( ( bytes + offset ), (unsigned char*)iter->officeArtProperty, iter->officeArtProperty.Size() ); - offset += iter->officeArtProperty.Size(); - } - - for ( std::list::const_iterator iter = complexOfficeArtProperties.begin(); iter != complexOfficeArtProperties.end(); ++iter) - { - if ( iter->officeArtProperty.GetOpid().GetFComplex() && (NULL != iter->m_pComplexData)) - { - unsigned int buffSize = iter->officeArtProperty.GetValue() + sizeof(unsigned short) * 3; - - memcpy ((bytes + offset), iter->m_pComplexData, buffSize); - - offset += buffSize; - } - } - } - } - } - - private: - - std::list complexOfficeArtProperties; - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRecordHeader.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRecordHeader.h deleted file mode 100644 index a50b51f713..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtRecordHeader.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace OfficeArt -{ - class OfficeArtRecordHeader - { - private: - - struct - { - unsigned int recVer:4; - unsigned int recInstance:12; - unsigned int recType:16; - unsigned int recLen:32; - } OfficeArtRecordHeaderStruct; - - public: - - OfficeArtRecordHeader() - { - OfficeArtRecordHeaderStruct.recVer = 0; - OfficeArtRecordHeaderStruct.recInstance = 0; - OfficeArtRecordHeaderStruct.recType = 0xF000; - OfficeArtRecordHeaderStruct.recLen = 0; - } - - explicit OfficeArtRecordHeader (unsigned char _recVer, unsigned short _recInstance, unsigned short _recType, unsigned int _recLen) - { - OfficeArtRecordHeaderStruct.recVer = _recVer; - OfficeArtRecordHeaderStruct.recInstance = _recInstance; - - if ( ( _recType >= 0xF000 ) && ( _recType <= 0xFFFF ) ) - { - OfficeArtRecordHeaderStruct.recType = _recType; - } - else - { - OfficeArtRecordHeaderStruct.recType = 0xF000; - } - - OfficeArtRecordHeaderStruct.recLen = _recLen; - } - - inline unsigned char GetVersion() const - { - return OfficeArtRecordHeaderStruct.recVer; - } - - inline unsigned short GetInstance() const - { - return OfficeArtRecordHeaderStruct.recInstance; - } - - inline unsigned short GetType() const - { - return OfficeArtRecordHeaderStruct.recType; - } - - inline unsigned int GetLength() const - { - return OfficeArtRecordHeaderStruct.recLen; - } - - inline operator const unsigned char* () const - { - return (const unsigned char*)(&OfficeArtRecordHeaderStruct); - } - - inline operator unsigned char* () const - { - return (unsigned char*)(&OfficeArtRecordHeaderStruct); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpContainer.h deleted file mode 100644 index 3fcac268bb..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpContainer.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IOfficeArtAbstractContainer.h" -#include "OfficeArtFSP.h" - -namespace OfficeArt -{ - class OfficeArtSpContainer: public IOfficeArtAbstractContainer - { - public: - OfficeArtSpContainer() : rh(0xF, 0x000, 0xF004, 0), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) - { - Initialize(); - } - - OfficeArtSpContainer(const OfficeArtSpContainer& _officeArtSpContainer) : rh(_officeArtSpContainer.rh),officeArtRecords(_officeArtSpContainer.officeArtRecords), size(_officeArtSpContainer.size), bytes(NULL) - { - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _officeArtSpContainer.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtSpContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtSpContainer(*this); - } - - virtual void PushBack(const IOfficeArtRecord& _officeArtRecord) - { - officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone())); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)officeArtRecords.size(); - } - - virtual void Clear() - { - officeArtRecords.clear(); - Initialize(); - } - - virtual ~OfficeArtSpContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - size += (*iter)->Size(); - - rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF004, size ); - - size += sizeof(rh); - - RELEASEARRAYOBJECTS (bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtRecord), officeArtRecord->Size()); - offset += officeArtRecord->Size(); - } - } - } - } - } - protected: - OfficeArtRecordHeader rh; - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - }; - - typedef OfficeArtSpContainer SpContainer; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpgrContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpgrContainer.h deleted file mode 100644 index 7a36f0d924..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSpgrContainer.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IOfficeArtAbstractContainer.h" - -namespace OfficeArt -{ - class OfficeArtSpgrContainer: public IOfficeArtAbstractContainer - { - public: - - OfficeArtSpgrContainer() : rh(0xF, 0x000, 0xF003, 0), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) - { - Initialize(); - } - - OfficeArtSpgrContainer(const OfficeArtSpgrContainer& _officeContainer): rh(_officeContainer.rh), officeArtRecords(_officeContainer.officeArtRecords), size(_officeContainer.size), bytes(NULL) - { - if ( size != 0 ) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - memcpy(bytes, _officeContainer.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtSpgrContainer; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtSpgrContainer(*this); - } - - virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) - { - officeArtRecords.push_back( OfficeArtRecordPtr(_officeArtRecord.Clone())); - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int)officeArtRecords.size(); - } - - virtual void Clear() - { - officeArtRecords.clear(); - Initialize(); - } - - virtual ~OfficeArtSpgrContainer() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - size += (*iter)->Size(); - } - - rh = OfficeArtRecordHeader(0xF, 0x000, 0xF003, size); - size += sizeof(rh); - - RELEASEARRAYOBJECTS (bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset(bytes, 0, size); - - unsigned int offset = 0; - - memcpy((bytes + offset), (unsigned char*)(rh), sizeof(rh)); - offset += sizeof(rh); - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy((bytes + offset), (unsigned char*)(*officeArtRecord), officeArtRecord->Size()); - offset += officeArtRecord->Size(); - } - } - } - } - } - - protected: - OfficeArtRecordHeader rh; - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSplitMenuColorContainer.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSplitMenuColorContainer.h deleted file mode 100644 index 12598d7bc3..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtSplitMenuColorContainer.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Common.h" - -#include "OfficeArtRecordHeader.h" -#include "IOfficeArtRecord.h" - -namespace OfficeArt -{ - class OfficeArtSplitMenuColorContainer : public IOfficeArtRecord - { - private: - static const unsigned char SIZE_IN_BYTES = 24; - public: - - OfficeArtSplitMenuColorContainer () : rh(0x0, 0x004, 0xF11E, 0x00000010), fillColor(0), lineColor(0), shadowColor(0), color3D(0) - { - memset( bytes, 0, SIZE_IN_BYTES ); - } - - OfficeArtSplitMenuColorContainer (unsigned int fill, unsigned int line, unsigned int shadow, unsigned int n3D) : rh(0x0, 0x004, 0xF11E, 0x00000010), fillColor(fill), lineColor(line), shadowColor(shadow), color3D(n3D) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - memcpy( ( bytes + offset ), (unsigned char*)(rh), sizeof(rh) ); - offset += sizeof(rh); - - memcpy( ( bytes + offset ), &(fillColor), sizeof(unsigned int) ); - offset += sizeof(unsigned int); - memcpy( ( bytes + offset ), &(lineColor), sizeof(unsigned int) ); - offset += sizeof(unsigned int); - memcpy( ( bytes + offset ), &(shadowColor), sizeof(unsigned int) ); - offset += sizeof(unsigned int); - memcpy( ( bytes + offset ), &(color3D), sizeof(unsigned int) ); - offset += sizeof(unsigned int); - } - - OfficeArtSplitMenuColorContainer(const OfficeArtSplitMenuColorContainer& color): rh(color.rh), fillColor(color.fillColor), lineColor(color.lineColor), shadowColor(color.shadowColor), color3D(color.color3D) - { - memset(bytes, 0, SIZE_IN_BYTES); - memcpy(bytes, color.bytes, SIZE_IN_BYTES); - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(&bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(&bytes); - } - - virtual unsigned int Size() const - { - return sizeof(bytes); - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtSplitMenuColorContainer(); - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtSplitMenuColorContainer(*this); - } - - - protected: - - OfficeArtRecordHeader rh; - - unsigned int fillColor; // fill color - unsigned int lineColor; // line color - unsigned int shadowColor; // shadow color - unsigned int color3D; // 3D color - - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtWordDrawing.h b/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtWordDrawing.h deleted file mode 100644 index 62d76154af..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/OfficeArt/OfficeArtWordDrawing.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace OfficeArt -{ - class OfficeArtWordDrawing : public IOfficeArtAbstractContainer - { - public: - - OfficeArtWordDrawing(unsigned char type = 0) : dgglbl(type), bytes(NULL), size(sizeof(dgglbl)) - { - Initialize(); - } - - OfficeArtWordDrawing(const OfficeArtWordDrawing& _container) : dgglbl(_container.dgglbl), officeArtRecords(_container.officeArtRecords), size(_container.size), bytes(NULL) - { - if ( size != 0 ) - { - bytes = new unsigned char[size]; - - if (bytes) - { - memset (bytes, 0, size); - memcpy (bytes, _container.bytes, size); - } - } - } - - virtual operator const unsigned char* () const - { - return (const unsigned char*)(bytes); - } - - virtual operator unsigned char* () const - { - return (unsigned char*)(bytes); - } - - virtual unsigned int Size() const - { - return this->size; - } - - virtual IOfficeArtRecord* New() const - { - return new OfficeArtWordDrawing; - } - - virtual IOfficeArtRecord* Clone() const - { - return new OfficeArtWordDrawing (*this); - } - - virtual void PushBack(const IOfficeArtRecord& _officeArtRecord) - { - officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone())); - - Initialize(); - } - - virtual unsigned int Count() const - { - return (unsigned int) officeArtRecords.size(); - } - - virtual void Clear() - { - officeArtRecords.clear(); - - Initialize(); - } - - virtual ~OfficeArtWordDrawing() - { - RELEASEARRAYOBJECTS (bytes); - } - - private: - - inline void Initialize() - { - size = 0; - - for (std::list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - size += (*iter)->Size(); - } - - size += sizeof(dgglbl); - - RELEASEARRAYOBJECTS (bytes); - - if (0 != size) - { - bytes = new unsigned char[size]; - if (bytes) - { - memset (bytes, 0, size); - - unsigned int offset = 0; - - memcpy( (bytes + offset ), &dgglbl, sizeof(dgglbl) ); - offset += sizeof(dgglbl); - - for (list::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) - { - const IOfficeArtRecord* officeArtRecord = iter->operator->(); - if (officeArtRecord) - { - memcpy( (bytes + offset), (unsigned char*)(*officeArtRecord), officeArtRecord->Size()); - offset += officeArtRecord->Size(); - } - } - } - } - } - - protected: - - unsigned char dgglbl; - list officeArtRecords; - - unsigned char* bytes; - unsigned int size; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PChgTabs.h b/ASCOfficeDocFile_old/DocxDocConverter/PChgTabs.h deleted file mode 100644 index 4a8ef53b9b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PChgTabs.h +++ /dev/null @@ -1,505 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "TBD.h" -#include "XAS.h" - -namespace ASCDocFileFormat -{ - class PChgTabsAdd : public IOperand - { - public: - - PChgTabsAdd() : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = sizeof(unsigned char); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - - explicit PChgTabsAdd( const vector& _rgdxaAdd, const vector& _rgtbdAdd ) : bytes(NULL), sizeInBytes(0) - { - unsigned int cTabs = min( _rgdxaAdd.size(), _rgtbdAdd.size() ); - - if ( cTabs > MAX_RECORDS_NUMBER ) - { - cTabs = MAX_RECORDS_NUMBER; - } - - this->sizeInBytes = ( ( sizeof(XAS) * cTabs ) + ( sizeof(TBD) * cTabs ) + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned int offset = 0; - - this->bytes[offset] = (unsigned char)cTabs; - offset += sizeof(unsigned char); - - for ( unsigned int i = 0; i < cTabs; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (short)_rgdxaAdd[i] ); - offset += sizeof(XAS); - } - - for ( unsigned int i = 0; i < cTabs; i++ ) - { - this->bytes[offset] = (unsigned char)_rgtbdAdd[i]; - offset += sizeof(TBD); - } - } - } - - PChgTabsAdd( const PChgTabsAdd& _pChgTabsAdd ) : bytes(NULL), sizeInBytes(0) - { - if ( ( _pChgTabsAdd.bytes != NULL ) && ( _pChgTabsAdd.sizeInBytes != 0 ) ) - { - this->sizeInBytes = _pChgTabsAdd.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _pChgTabsAdd.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PChgTabsAdd() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - - static const unsigned char MAX_RECORDS_NUMBER = 64; - }; - - class PChgTabsDel : public IOperand - { - public: - - PChgTabsDel() : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = sizeof(unsigned char); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - - explicit PChgTabsDel( const vector& _rgdxaDel ) : bytes(NULL), sizeInBytes(0) - { - unsigned int cTabs = _rgdxaDel.size(); - - if ( cTabs > MAX_RECORDS_NUMBER ) - { - cTabs = MAX_RECORDS_NUMBER; - } - - this->sizeInBytes = ( ( sizeof(XAS) * cTabs ) + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned int offset = 0; - - this->bytes[offset] = (unsigned char)cTabs; - offset += sizeof(unsigned char); - - for ( unsigned int i = 0; i < cTabs; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (short)_rgdxaDel[i] ); - offset += sizeof(XAS); - } - } - } - - PChgTabsDel( const PChgTabsDel& _pChgTabsDel ) : bytes(NULL), sizeInBytes(0) - { - if ( ( _pChgTabsDel.bytes != NULL ) && ( _pChgTabsDel.sizeInBytes != 0 ) ) - { - this->sizeInBytes = _pChgTabsDel.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _pChgTabsDel.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PChgTabsDel() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - static const unsigned char MAX_RECORDS_NUMBER = 64; - }; - - class PChgTabsDelClose : public IOperand - { - public: - - PChgTabsDelClose() : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = sizeof(unsigned char); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - - explicit PChgTabsDelClose( const vector& _rgdxaDel, const vector& _rgdxaClose ) : bytes(NULL), sizeInBytes(0) - { - unsigned int cTabs = min( _rgdxaDel.size(), _rgdxaClose.size() ); - - if ( cTabs > MAX_RECORDS_NUMBER ) - { - cTabs = MAX_RECORDS_NUMBER; - } - - this->sizeInBytes = ( ( sizeof(short) * cTabs ) + ( sizeof(XAS_plusOne) * cTabs ) + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned int offset = 0; - - this->bytes[offset] = (unsigned char)cTabs; - offset += sizeof(unsigned char); - - for ( unsigned int i = 0; i < cTabs; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), _rgdxaDel[i] ); - offset += sizeof(short); - } - - for ( unsigned int i = 0; i < cTabs; i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (short)_rgdxaClose[i] ); - offset += sizeof(XAS_plusOne); - } - } - } - - PChgTabsDelClose( const PChgTabsDelClose& _pChgTabsDelClose ) : bytes(NULL), sizeInBytes(0) - { - if ( ( _pChgTabsDelClose.bytes != NULL ) && ( _pChgTabsDelClose.sizeInBytes != 0 ) ) - { - this->sizeInBytes = _pChgTabsDelClose.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _pChgTabsDelClose.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PChgTabsDelClose() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - static const unsigned char MAX_RECORDS_NUMBER = 64; - }; - - class PChgTabsOperand : public IOperand - { - public: - - PChgTabsOperand() : bytes(NULL), sizeInBytes(0) - { - this->DefaultInit(); - } - - explicit PChgTabsOperand( const PChgTabsDelClose& _pChgTabsDelClose, const PChgTabsAdd& _pChgTabsAdd ) : bytes(NULL), sizeInBytes(0) - { - unsigned int cb = ( _pChgTabsDelClose.Size() + _pChgTabsAdd.Size() ); - - if ( ( cb >= MIN_SIZE_IN_BYTES ) && ( cb <= MAX_SIZE_IN_BYTES ) ) - { - this->sizeInBytes = ( cb + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - this->bytes[0] = (unsigned char)cb; - - memcpy( ( this->bytes + sizeof(unsigned char) ), (unsigned char*)_pChgTabsDelClose, _pChgTabsDelClose.Size() ); - memcpy( ( this->bytes + sizeof(unsigned char) + _pChgTabsDelClose.Size() ), (unsigned char*)_pChgTabsAdd, _pChgTabsAdd.Size() ); - } - } - else - { - this->DefaultInit(); - } - } - - PChgTabsOperand( const PChgTabsOperand& _pChgTabsOperand ) : bytes(NULL), sizeInBytes(0) - { - if ( ( _pChgTabsOperand.bytes != NULL ) && ( _pChgTabsOperand.sizeInBytes != 0 ) ) - { - this->sizeInBytes = _pChgTabsOperand.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _pChgTabsOperand.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PChgTabsOperand() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - void DefaultInit() - { - this->sizeInBytes = ( MIN_SIZE_IN_BYTES + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - this->bytes[0] = MIN_SIZE_IN_BYTES; - } - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - - static const unsigned char MIN_SIZE_IN_BYTES = 2; - static const unsigned char MAX_SIZE_IN_BYTES = 255; - }; - - class PChgTabsPapxOperand : public IOperand - { - public: - - PChgTabsPapxOperand() : bytes(NULL), sizeInBytes(0) - { - this->DefaultInit(); - } - - explicit PChgTabsPapxOperand( const PChgTabsDel& _pChgTabsDel, const PChgTabsAdd& _pChgTabsAdd ) : bytes(NULL), sizeInBytes(0) - { - unsigned int cb = ( _pChgTabsDel.Size() + _pChgTabsAdd.Size() ); - - if ( ( cb >= MIN_SIZE_IN_BYTES ) && ( cb <= MAX_SIZE_IN_BYTES ) ) - { - this->sizeInBytes = ( cb + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - this->bytes[0] = (unsigned char)cb; - - memcpy( ( this->bytes + sizeof(unsigned char) ), (unsigned char*)_pChgTabsDel, _pChgTabsDel.Size() ); - memcpy( ( this->bytes + sizeof(unsigned char) + _pChgTabsDel.Size() ), (unsigned char*)_pChgTabsAdd, _pChgTabsAdd.Size() ); - } - } - else - { - this->DefaultInit(); - } - } - - PChgTabsPapxOperand( const PChgTabsPapxOperand& _pChgTabsPapxOperand ) : bytes(NULL), sizeInBytes(0) - { - if ( ( _pChgTabsPapxOperand.bytes != NULL ) && ( _pChgTabsPapxOperand.sizeInBytes != 0 ) ) - { - this->sizeInBytes = _pChgTabsPapxOperand.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _pChgTabsPapxOperand.bytes, this->sizeInBytes ); - } - } - } - - virtual ~PChgTabsPapxOperand() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(this->bytes); - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - void DefaultInit() - { - this->sizeInBytes = ( MIN_SIZE_IN_BYTES + sizeof(unsigned char) ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - this->bytes[0] = MIN_SIZE_IN_BYTES; - } - } - - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - static const unsigned char MIN_SIZE_IN_BYTES = 2; - static const unsigned char MAX_SIZE_IN_BYTES = 255; - - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PICF.h b/ASCOfficeDocFile_old/DocxDocConverter/PICF.h deleted file mode 100644 index c3420d6664..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PICF.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "MFPF.h" -#include "PICF_Shape.h" -#include "PICMID.h" - -namespace ASCDocFileFormat -{ - class PICF: public IOperand - { - private: - MFPF mfpf; - - static const unsigned char SIZE_IN_BYTES = 68; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - PICF(): - mfpf(Constants::MM_SHAPE) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = ( sizeof(int) + sizeof(unsigned short) ); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->mfpf), this->mfpf.Size() ); - offset += this->mfpf.Size(); - } - - explicit PICF( int dataSize /*( lcb - cbHeader )*/, const PICMID& _picmid, const MFPF& _mfpf = MFPF(), const PICF_Shape& _innerHeader = PICF_Shape() ): - mfpf(_mfpf) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - unsigned int offset = 0; - - FormatUtils::SetBytes( ( this->bytes + offset ), (int)( SIZE_IN_BYTES + dataSize ) ); - offset += sizeof(dataSize); - - FormatUtils::SetBytes( ( this->bytes + offset ), (unsigned short)(SIZE_IN_BYTES) ); - offset += sizeof(unsigned short); - - memcpy( ( this->bytes + offset ), (unsigned char*)(this->mfpf), this->mfpf.Size() ); - offset += this->mfpf.Size(); - - memcpy( ( this->bytes + offset ), (unsigned char*)_innerHeader, _innerHeader.Size() ); - offset += _innerHeader.Size(); - - memcpy( ( this->bytes + offset ), (unsigned char*)_picmid, _picmid.Size() ); - offset += _picmid.Size(); - } - - PICF( const PICF& _pICF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _pICF.bytes, SIZE_IN_BYTES ); - } - - virtual ~PICF() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - Constants::PictureDataFormat GetPictureDataFormat() const - { - return (Constants::PictureDataFormat)(this->mfpf); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PICFAndOfficeArtData.h b/ASCOfficeDocFile_old/DocxDocConverter/PICFAndOfficeArtData.h deleted file mode 100644 index 0b41203686..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PICFAndOfficeArtData.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PICF.h" -#include "OfficeArt/OfficeArtInlineSpContainer.h" - -namespace ASCDocFileFormat -{ - class PICFAndOfficeArtData : public IOperand - { - public: - - PICFAndOfficeArtData () : bytes(NULL), sizeInBytes(0) - { - } - - explicit PICFAndOfficeArtData (const PICF& _picf, const OfficeArt::OfficeArtInlineSpContainer& _picture, const char* _stPicName = NULL ) : bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = _picf.Size(); - - if ( ( _picf.GetPictureDataFormat() == Constants::MM_SHAPEFILE ) && ( _stPicName != NULL ) ) - { - this->sizeInBytes += ( sizeof(unsigned char) + ( sizeof(char) * strlen( _stPicName ) ) ); - } - - this->sizeInBytes += _picture.Size(); - - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned int offset = 0; - - memcpy( ( this->bytes + offset ), (unsigned char*)_picf, _picf.Size() ); - offset += _picf.Size(); - - if ( ( _picf.GetPictureDataFormat() == Constants::MM_SHAPEFILE ) && ( _stPicName != NULL ) ) - { - unsigned char cchPicName = ( sizeof(char) * strlen( _stPicName ) ); - - this->bytes[offset] = cchPicName; - offset += sizeof(cchPicName); - - memcpy( ( this->bytes + offset ), _stPicName, cchPicName ); - offset += cchPicName; - } - - memcpy( ( this->bytes + offset ), (unsigned char*)_picture, _picture.Size() ); - offset += _picture.Size(); - } - } - } - - PICFAndOfficeArtData( const PICFAndOfficeArtData& _pICFAndOfficeArtData ) : bytes(NULL), sizeInBytes(_pICFAndOfficeArtData.sizeInBytes) - { - if ( this->sizeInBytes != 0 ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _pICFAndOfficeArtData.bytes, this->sizeInBytes ); - } - } - } - - bool operator == ( const PICFAndOfficeArtData& _pICFAndOfficeArtData ) - { - return ( ( this->sizeInBytes == _pICFAndOfficeArtData.sizeInBytes ) && - ( memcmp( this->bytes, _pICFAndOfficeArtData.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const PICFAndOfficeArtData& _pICFAndOfficeArtData ) - { - return !( this->operator == ( _pICFAndOfficeArtData ) ); - } - - PICFAndOfficeArtData& operator = ( const PICFAndOfficeArtData& _pICFAndOfficeArtData ) - { - if ( *this != _pICFAndOfficeArtData ) - { - RELEASEARRAYOBJECTS (bytes); - - this->sizeInBytes = _pICFAndOfficeArtData.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _pICFAndOfficeArtData.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~PICFAndOfficeArtData() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PICF_Shape.h b/ASCOfficeDocFile_old/DocxDocConverter/PICF_Shape.h deleted file mode 100644 index 49d6ceb941..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PICF_Shape.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Common/IOperand.h" - -namespace ASCDocFileFormat -{ - class PICF_Shape: public IOperand - { - private: - static const unsigned char SIZE_IN_BYTES = 14; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - PICF_Shape() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - PICF_Shape( const PICF_Shape& _pICF_Shape ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _pICF_Shape.bytes, SIZE_IN_BYTES ); - } - - virtual ~PICF_Shape() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PICMID.h b/ASCOfficeDocFile_old/DocxDocConverter/PICMID.h deleted file mode 100644 index cf768401bf..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PICMID.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Brc80MayBeNil.h" - -namespace ASCDocFileFormat -{ - class PICMID: public IOperand - { - public: - PICMID() - { - memset(bytes, 0, SIZE_IN_BYTES); - } - - explicit PICMID(short _dxaGoal, short _dyaGoal, unsigned short _mx, unsigned short _my, Brc80 _brcTop80, Brc80 _brcLeft80, Brc80 _brcBottom80, Brc80 _brcRight80 ) - { - memset(bytes, 0, SIZE_IN_BYTES); - - unsigned int offset = 0; - - FormatUtils::SetBytes( ( this->bytes + offset ), _dxaGoal ); - offset += sizeof(_dxaGoal); - - FormatUtils::SetBytes( ( this->bytes + offset ), _dyaGoal ); - offset += sizeof(_dyaGoal); - - FormatUtils::SetBytes( ( this->bytes + offset ), _mx ); - offset += sizeof(_mx); - - FormatUtils::SetBytes( ( this->bytes + offset ), _my ); - offset += ( sizeof(_my) + 10 ); - - unsigned int brc80Value = _brcTop80; - - FormatUtils::SetBytes( ( this->bytes + offset ), brc80Value ); - offset += sizeof(brc80Value); - - brc80Value = _brcLeft80; - - FormatUtils::SetBytes( ( this->bytes + offset ), brc80Value ); - offset += sizeof(brc80Value); - - brc80Value = _brcBottom80; - - FormatUtils::SetBytes( ( this->bytes + offset ), brc80Value ); - offset += sizeof(brc80Value); - - brc80Value = _brcRight80; - - FormatUtils::SetBytes( ( this->bytes + offset ), brc80Value ); - offset += sizeof(brc80Value); - } - - PICMID (const PICMID& oICMID) - { - memset(bytes, 0, SIZE_IN_BYTES ); - memcpy(bytes, oICMID.bytes, SIZE_IN_BYTES ); - } - - virtual ~PICMID() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(this->bytes); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - - private: - static const unsigned char SIZE_IN_BYTES = 38; - unsigned char bytes[SIZE_IN_BYTES]; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PLC.h b/ASCOfficeDocFile_old/DocxDocConverter/PLC.h deleted file mode 100644 index a75ae17e37..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PLC.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "CP.h" - -namespace ASCDocFileFormat -{ - class EmptyPLCData {}; - - template class PLC : public IOperand - { - public: - - PLC() : m_pBuffer(NULL), m_nSizeInBytes(0) - { - - } - - PLC(const vector& _aCP, const vector& _aData = vector()) : m_pBuffer(NULL), m_nSizeInBytes(0) - { - if ( ( typeid(D) == typeid(EmptyPLCData) ) || ( ( typeid(D) != typeid(EmptyPLCData) ) && ( _aCP.size() == ( _aData.size() + 1 ) ) ) ) - { - m_nSizeInBytes = ( _aCP.size() * sizeof(CP) ); - - for (vector::const_iterator iter = _aData.begin(); iter != _aData.end(); ++iter) - { - m_nSizeInBytes += sizeof(D); - } - - if (m_nSizeInBytes != 0) - { - m_pBuffer = new unsigned char[m_nSizeInBytes]; - - if (NULL != m_pBuffer) - { - unsigned int offset = 0; - - memset(m_pBuffer, 0, m_nSizeInBytes); - - for (vector::const_iterator iter = _aCP.begin(); iter != _aCP.end(); ++iter) - { - unsigned int cp = *iter; - memcpy((m_pBuffer + offset), &cp, sizeof(cp)); - offset += sizeof(cp); - } - - for (vector::const_iterator iter = _aData.begin(); iter != _aData.end(); ++iter) - { - memcpy( ( m_pBuffer + offset ), &(*iter), sizeof(D) ); - offset += sizeof(D); - } - } - } - } - } - - PLC(const PLC& oPLC) : m_pBuffer(NULL), m_nSizeInBytes(oPLC.m_nSizeInBytes) - { - m_pBuffer = new unsigned char[m_nSizeInBytes]; - - if (NULL != m_pBuffer) - { - memset(m_pBuffer, 0, m_nSizeInBytes); - memcpy(m_pBuffer, oPLC.m_pBuffer, m_nSizeInBytes); - } - } - - virtual ~PLC() - { - RELEASEARRAYOBJECTS (m_pBuffer); - } - - // - bool operator == (const PLC& oPLC) - { - return ((m_nSizeInBytes == oPLC.m_nSizeInBytes) && (memcmp(m_pBuffer, oPLC.m_pBuffer, m_nSizeInBytes) == 0)); - } - - bool operator != (const PLC& oPLC) - { - return !(this->operator == (oPLC)); - } - - PLC& operator = (const PLC& oPLC) - { - if (*this != oPLC) - { - RELEASEARRAYOBJECTS (m_pBuffer); - - m_nSizeInBytes = oPLC.m_nSizeInBytes; - m_pBuffer = new unsigned char[m_nSizeInBytes]; - - if (NULL != m_pBuffer) - { - memcpy(m_pBuffer, oPLC.m_pBuffer, m_nSizeInBytes ); - } - } - - return *this; - } - - // - virtual operator unsigned char*() const - { - return m_pBuffer; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)m_pBuffer; - } - - virtual unsigned int Size() const - { - return m_nSizeInBytes; - } - private: - - unsigned char* m_pBuffer; - unsigned int m_nSizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PapxFkp.h b/ASCOfficeDocFile_old/DocxDocConverter/PapxFkp.h deleted file mode 100644 index 0294d19e40..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PapxFkp.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PapxInFkp.h" -#include "BxPap.h" -#include "Clx.h" -#include "BinaryStorage.h" - -namespace ASCDocFileFormat -{ - class PapxFkp: public IStreamWriter - { - public: - static const unsigned short PAPX_FKP_SIZE = 512; - static const unsigned char PAPX_FKP_MAX_CPARA = 0x1D; - - PapxFkp (const vector& _rgfc, const vector& _papxInFkps) : cpara(0) - { - this->cpara = _papxInFkps.size(); - this->rgfc = _rgfc; - - unsigned long papxSizeInBytes = 0; - - this->papxInFkps.push_back( _papxInFkps[0] ); - papxSizeInBytes = this->papxInFkps[0].Size(); - this->rgbx.push_back( BxPap( (unsigned char)( ( PAPX_FKP_SIZE - 1 - papxSizeInBytes ) / 2 ) ) ); - - for ( int i = 1; i < this->cpara; i++ ) - { - this->papxInFkps.push_back( _papxInFkps[i] ); - papxSizeInBytes = this->papxInFkps[i].Size(); - this->rgbx.push_back( BxPap( (unsigned char)( this->rgbx[i-1].GetOffset() - 1 - ( papxSizeInBytes / 2 ) ) ) ); - } - } - - virtual ~PapxFkp() - { - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = 512; - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - int i = 0; - - for ( ; i < ( this->cpara + 1); i++ ) - { - FormatUtils::SetBytes( ( bytes + ( i * sizeof(this->rgfc[i]) ) ), (int)this->rgfc[i] ); - } - - i = ( this->cpara + 1) * sizeof(this->rgfc[i]); - - unsigned char *papxsbytes = NULL; - unsigned long papxssize = 0; - - for ( int j = 0; j < this->cpara; j++, i += ( BxPap::RESERVED_SIZE + 1 ) ) - { - bytes[i] = this->rgbx[j].GetOffset(); - unsigned char *papxsbytes = this->papxInFkps[j].GetBytes( &papxssize ); - - if ( papxsbytes != NULL ) - { - memcpy( ( bytes + ( bytes[i] * 2 ) ), papxsbytes, papxssize ); - RELEASEARRAYOBJECTS (papxsbytes); - } - } - - bytes[511] = this->cpara; - } - } - - return bytes; - } - - unsigned int GetEndOffset() const - { - return ( *(this->rgfc.end() - 1 ) ); - } - - static vector GetAllPapxFkps( const vector& _rgfc, const vector& _papxInFkps ) - { - vector allPapxFkps; - vector rgfc; - vector papxInFkps; - - rgfc.push_back( _rgfc[0] ); - unsigned int allPapxInFkpsSize = 0; - unsigned int rgfcCount = 2; - - for ( unsigned int i = 0; i < _papxInFkps.size(); i++ ) - { - unsigned int papxInFkpSize = _papxInFkps[i].Size(); - allPapxInFkpsSize += papxInFkpSize; - - //Check if all rgfcs and rgbxs + PapxInFkps less then 512 bytes - if ( ( ( rgfcCount * sizeof(unsigned int) ) + ( ( rgfcCount - 1 ) * ( BxPap::RESERVED_SIZE + 1 ) ) ) >= ( PAPX_FKP_SIZE / 2 ) || - ( allPapxInFkpsSize ) >= ( PAPX_FKP_SIZE / 2 ) ) - { - PapxFkp papxFkp( rgfc, papxInFkps ); - allPapxFkps.push_back( papxFkp ); - rgfc.clear(); - papxInFkps.clear(); - rgfc.push_back( _rgfc[i] ); - allPapxInFkpsSize = papxInFkpSize; - rgfcCount = 2; - } - - rgfc.push_back( _rgfc[i+1] ); - - if ( ( ( rgfcCount * sizeof(unsigned int) ) + ( ( rgfcCount - 1 ) * ( BxPap::RESERVED_SIZE + 1 ) ) ) >= ( PAPX_FKP_SIZE / 2 ) || - ( papxInFkpSize ) >= ( PAPX_FKP_SIZE / 2 ) ) - { - PrcData prcData( _papxInFkps[i].GetPrls() ); - - BinaryStorageSingleton* binaryStorage = BinaryStorageSingleton::Instance(); - - if ( binaryStorage != NULL ) - { - unsigned int prcDataOffset = binaryStorage->PushData( (const unsigned char*)prcData, prcData.Size() ); - - vector prls; - prls.push_back( Prl( (short)0x6646, (unsigned char*)(&prcDataOffset) ) ); - PapxInFkp papxInFkp( GrpPrlAndIstd( 0, prls ) ); - - papxInFkps.push_back( papxInFkp ); - } - } - else - { - papxInFkps.push_back( _papxInFkps[i] ); - } - - rgfcCount++; - } - - if ( !rgfc.empty() && !papxInFkps.empty() ) - { - PapxFkp papxFkp( rgfc, papxInFkps ); - allPapxFkps.push_back( papxFkp ); - rgfc.clear(); - papxInFkps.clear(); - } - - return allPapxFkps; - } - - private: - - vector rgfc; - vector rgbx; - vector papxInFkps; - unsigned char cpara; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PapxInFkp.h b/ASCOfficeDocFile_old/DocxDocConverter/PapxInFkp.h deleted file mode 100644 index bba0b1b569..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PapxInFkp.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "GrpPrlAndIstd.h" - -namespace ASCDocFileFormat -{ - class PapxInFkp : public IStreamWriter - { - public: - PapxInFkp() : grpprlInPapx() - { - - } - - PapxInFkp(const GrpPrlAndIstd& _grpprlInPapx) : grpprlInPapx(_grpprlInPapx) - { - - } - - PapxInFkp(const PapxInFkp& pifkp) : grpprlInPapx(pifkp.grpprlInPapx) - { - - } - - virtual ~PapxInFkp() - { - } - - // - inline bool operator == (const PapxInFkp& pifkp) - { - return ( grpprlInPapx == pifkp.grpprlInPapx ); - } - - inline bool operator != (const PapxInFkp& pifkp) - { - return !( *this == pifkp ); - } - - inline PapxInFkp& operator = (const PapxInFkp& pifkp) - { - if ( *this != pifkp ) - { - grpprlInPapx = pifkp.grpprlInPapx; - } - - return *this; - } - - inline unsigned long Size() const - { - unsigned long sizeInBytes = 0; - unsigned char cb = 0; - unsigned char cb_ = 0; - - sizeInBytes = this->grpprlInPapx.Size(); - - if ( sizeInBytes % 2 != 0 ) - { - cb = (unsigned char)( ( sizeInBytes + 1 ) / 2 ); - sizeInBytes += sizeof(cb); - } - else - { - cb = 0; - cb_ = (unsigned char)( sizeInBytes / 2 ); - sizeInBytes += ( sizeof(cb) + sizeof(cb_) ); - } - - return sizeInBytes; - } - - inline Prl operator[] (unsigned int index) const - { - return grpprlInPapx[index]; - } - - inline unsigned int GetPrlCount() const - { - return this->grpprlInPapx.GetPrlCount(); - } - - inline vector GetPrls() const - { - return this->grpprlInPapx.GetPrls(); - } - - inline short GetIstd() const - { - return grpprlInPapx.GetIstd(); - } - - // IStreamWriter - virtual unsigned char* GetBytes(unsigned long* size) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - unsigned char cb = 0; - unsigned char cb_ = 0; - - *size = this->grpprlInPapx.Size(); - - if ( *size % 2 != 0 ) - { - cb = (unsigned char)( ( *size + 1 ) / 2 ); - *size += sizeof(cb); - } - else - { - cb = 0; - cb_ = (unsigned char)( *size / 2 ); - *size += ( sizeof(cb) + sizeof(cb_) ); - } - - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - bytes[0] = cb; - - unsigned char cb_offset = 0; - - if ( cb_ != 0 ) - { - bytes[1] = cb_; - cb_offset = sizeof(cb_); - } - - unsigned char* grpPrlAndIstdBytes = NULL; - unsigned long grpPrlAndIstdSize = 0; - - grpPrlAndIstdBytes = this->grpprlInPapx.GetBytes( &grpPrlAndIstdSize ); - - if ( grpPrlAndIstdBytes != NULL ) - { - memcpy( ( bytes + sizeof(cb) + cb_offset ), grpPrlAndIstdBytes, grpPrlAndIstdSize ); - - RELEASEARRAYOBJECTS (grpPrlAndIstdBytes); - } - } - } - - return bytes; - } - - private: - - GrpPrlAndIstd grpprlInPapx; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.cpp deleted file mode 100644 index e047575536..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Paragraph.h" - -#include "../Common/TextMark.h" - -namespace ASCDocFileFormat -{ - Paragraph::Paragraph (short _style) - { - runsOffset = 0; - style = _style; - depth = 0; - } - - Paragraph::~Paragraph() - { - } - - IVirtualConstructor* Paragraph::New() const - { - return new Paragraph(); - } - - IVirtualConstructor* Paragraph::Clone() const - { - return new Paragraph( *this ); - } -} - -namespace ASCDocFileFormat -{ - void Paragraph::AddParagraphItem(const IParagraphItem& oItem) - { - paragraphItems.push_back(ParagraphItem(oItem, runsOffset)); - runsOffset += sizeof(wchar_t) * oItem.GetTextSize(); - } - - unsigned long Paragraph::GetTextSize() const - { - unsigned long paragraphTextSize = 0; - - for (list::const_iterator iter = paragraphItems.begin(); iter != paragraphItems.end(); ++iter) - { - paragraphTextSize += (*iter)->GetTextSize(); - } - - return ( paragraphTextSize + 1 ); - } - - std::wstring Paragraph::GetAllText() const - { - std::wstring paragraphText; - - for (list::const_iterator iter = paragraphItems.begin(); iter != paragraphItems.end(); ++iter) - paragraphText += (*iter)->GetAllText(); - - return paragraphText + TextMark::ParagraphEnd; - } - - std::vector Paragraph::GetAllRunProperties(vector* allRunsOffsets) const - { - std::vector AllChpx; - - if (NULL != allRunsOffsets) - { - unsigned int paragraphItemOffset = 0; - - long nInd = 0; - for (std::list::const_iterator oIter = paragraphItems.begin(); oIter != paragraphItems.end(); ++oIter) - { - vector runOffsets; - vector paragraphItemChpxs = (*oIter)->GetRunProperties(&runOffsets); - - if (1 == paragraphItemChpxs.size() && paragraphItems.size() > 1) // пустых данных не должно быть в конце списка (todo: потестить на документах) - { - if ((0 == paragraphItemChpxs[0].GetPrlSize()) && (nInd == paragraphItems.size() - 1)) - break; - } - - for (size_t i = 0; i < paragraphItemChpxs.size(); ++i) - { - AllChpx.push_back(paragraphItemChpxs[i]); - allRunsOffsets->push_back(paragraphItemOffset + runOffsets[i]); - } - - paragraphItemOffset += (sizeof(wchar_t) * (*oIter)->GetTextSize()); - - ++nInd; - } - } - - return AllChpx; - } - - void Paragraph::AddProperty (short sprm, void* operand) - { - Prl prl( sprm, reinterpret_cast( operand ) ); - properties.push_back( prl ); - } - - void Paragraph::AddProperty (const Prl& prl) - { - properties.push_back (prl); - } - - void Paragraph::AddProperties(const vector& prls) - { - for ( vector::const_iterator iter = prls.begin(); iter != prls.end(); iter++ ) - properties.push_back( *iter ); - } - - void Paragraph::AddOrReplaceProperties (const vector& arr) - { - for (vector::const_iterator iter = arr.begin(); iter != arr.end(); ++iter) - { - RemovePropertyByCode (iter->GetSprmCode()); - AddProperty (*iter); - } - } - - void Paragraph::RemoveProperty(short sprm, void* operand) - { - Prl prl( sprm, reinterpret_cast( operand ) ); - properties.remove( prl ); - } - - void Paragraph::RemovePropertyByCode(unsigned short sprm) - { - for (list::iterator iter = properties.begin(); iter != properties.end(); ++iter) - { - if (iter->GetSprmCode() == sprm) - { - properties.erase(iter); - RemovePropertyByCode(sprm); - - break; - } - } - } - - void Paragraph::RemoveAllProperties() - { - properties.clear(); - } - - void Paragraph::SetStyle (short _style) - { - style = _style; - } - - short Paragraph::GetStyle() const - { - return style; - } - - PapxInFkp Paragraph::GetProperties() const - { - vector prls(properties.begin(), properties.end()); - GrpPrlAndIstd gpai(style, prls); - return PapxInFkp( gpai ); - } - - unsigned int Paragraph::GetParagraphPropertiesCount() const - { - return (unsigned int)properties.size(); - } - - Paragraph::operator std::wstring() const - { - std::wstring paragraphText; - - for (list::const_iterator iter = paragraphItems.begin(); iter != paragraphItems.end(); ++iter) - { - paragraphText += (*iter)->GetAllText(); - } - - return paragraphText; - } - - void Paragraph::SetDepth(unsigned int _depth) - { - unsigned char PFInTable = 1; - int PItap = GetDepth(); - unsigned char PFInnerTableCell = 1; - - RemoveProperty ((short)0x2416, &PFInTable); - RemoveProperty ((short)0x6649, &PItap); - - depth = _depth; - - PItap = GetDepth(); - - AddProperty ((short)0x2416, &PFInTable); - AddProperty ((short)0x6649, &PItap); - } - - unsigned int Paragraph::GetDepth() const - { - return depth; - } - - std::vector Paragraph::GetAllParagraphsProperties(std::vector* allParagraphsOffsets) const - { - vector allParagraphsProperties; - - if ( allParagraphsOffsets != NULL ) - { - allParagraphsProperties.push_back(GetProperties() ); - allParagraphsOffsets->push_back( 0 ); - } - - return allParagraphsProperties; - } - - std::vector Paragraph::GetAllParagraphsCopy() const - { - vector thisParagraph; - - thisParagraph.push_back(TextItemPtr(static_cast(Clone()))); - - return thisParagraph; - } - - std::vector Paragraph::GetAllParagraphs() - { - vector thisParagraph; - - thisParagraph.push_back(this); - - return thisParagraph; - } - - std::vector Paragraph::GetAllRunsCopy(std::vector* allRunsOffsets) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - unsigned int paragraphItemOffset = 0; - - for (list::const_iterator iter = this->paragraphItems.begin(); iter != this->paragraphItems.end(); ++iter) - { - vector paragraphItemOffsets; - vector paragraphItemRuns = (*iter)->GetAllRunsCopy( ¶graphItemOffsets ); - - for (unsigned int i = 0; i < paragraphItemRuns.size(); ++i) - { - allRuns.push_back( IParagraphItemPtr( static_cast(paragraphItemRuns[i]->Clone()) ) ); - allRunsOffsets->push_back( paragraphItemOffset + paragraphItemOffsets[i] ); - } - - paragraphItemOffset += ( sizeof(wchar_t) * (*iter)->GetTextSize() ); - } - } - - return allRuns; - } - - std::vector Paragraph::GetAllParagraphItemsCopy(std::vector* allParagraphItemsOffsets) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - unsigned int paragraphItemOffset = 0; - - for ( list::const_iterator iter = this->paragraphItems.begin(); iter != this->paragraphItems.end(); iter++ ) - { - allParagraphItems.push_back( IParagraphItemPtr( static_cast((*iter)->Clone()) ) ); - allParagraphItemsOffsets->push_back( paragraphItemOffset ); - paragraphItemOffset += ( sizeof(wchar_t) * (*iter)->GetTextSize() ); - } - } - - return allParagraphItems; - } - -} - -namespace ASCDocFileFormat -{ - Paragraph::const_iterator Paragraph::begin() const - { - return this->paragraphItems.begin(); - } - - Paragraph::const_iterator Paragraph::end() const - { - return this->paragraphItems.end(); - } - - Paragraph::iterator Paragraph::begin() - { - return this->paragraphItems.begin(); - } - - Paragraph::iterator Paragraph::end() - { - return this->paragraphItems.end(); - } - - Paragraph::const_reverse_iterator Paragraph::rbegin() const - { - return this->paragraphItems.rbegin(); - } - - Paragraph::const_reverse_iterator Paragraph::rend() const - { - return this->paragraphItems.rend(); - } - - Paragraph::reverse_iterator Paragraph::rbegin() - { - return this->paragraphItems.rbegin(); - } - - Paragraph::reverse_iterator Paragraph::rend() - { - return this->paragraphItems.rend(); - } - - Paragraph::const_reference Paragraph::front() const - { - return *this->begin(); - } - - Paragraph::const_reference Paragraph::back() const - { - return *(--this->end()); - } - - Paragraph::reference Paragraph::front() - { - return *this->begin(); - } - - Paragraph::reference Paragraph::back() - { - return *(--this->end()); - } -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.h b/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.h deleted file mode 100644 index aee9358bcb..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Paragraph.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ParagraphItem.h" -#include "TextItem.h" - -namespace ASCDocFileFormat -{ - class Paragraph : public ITextItem - { - friend class TableCell; - - private: - list paragraphItems; - unsigned long runsOffset; - short style; - list properties; - - unsigned int depth; - - protected: - void SetDepth( unsigned int _depth ); - unsigned int GetDepth() const; - - public: - typedef list::const_iterator const_iterator; - typedef list::iterator iterator; - typedef list::const_reverse_iterator const_reverse_iterator; - typedef list::reverse_iterator reverse_iterator; - typedef list::const_reference const_reference; - typedef list::reference reference; - - const_iterator begin() const; - const_iterator end() const; - iterator begin(); - iterator end(); - const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; - reverse_iterator rbegin(); - reverse_iterator rend(); - const_reference front() const; - const_reference back() const; - reference front(); - reference back(); - - public: - Paragraph( short _style = 0 ); - void AddParagraphItem( const IParagraphItem& _paragraphItem ); - unsigned long GetTextSize() const; - virtual ~Paragraph(); - virtual wstring GetAllText() const; - virtual operator wstring() const; - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const; - virtual vector GetAllParagraphsCopy() const; - virtual vector GetAllParagraphs(); - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const; - virtual vector GetAllParagraphItemsCopy( vector* allParagraphItemsOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - void AddProperty( short sprm, void* operand ); - void AddProperty( const Prl& prl ); - void AddProperties( const vector& prls ); - void AddOrReplaceProperties( const vector& prls ); - void RemoveProperty( short sprm, void* operand ); - void RemovePropertyByCode( unsigned short sprm ); - void RemoveAllProperties(); - void SetStyle( short _style ); - short GetStyle() const; - PapxInFkp GetProperties() const; - unsigned int GetParagraphPropertiesCount() const; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/ParagraphItem.h b/ASCOfficeDocFile_old/DocxDocConverter/ParagraphItem.h deleted file mode 100644 index e5c74b0786..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/ParagraphItem.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IParagraphItem.h" -#include "../Common/Aggregat.h" - -namespace ASCDocFileFormat -{ - class ParagraphItem : public Aggregat - { - public: - ParagraphItem () : Aggregat(), m_nItemOffset(0) - { - } - - explicit ParagraphItem (const IParagraphItem& oItem) : Aggregat(static_cast(oItem.Clone())), m_nItemOffset(0) - { - } - - explicit ParagraphItem (const IParagraphItem& oItem, unsigned int nItemOffset) : Aggregat(static_cast(oItem.Clone())), m_nItemOffset(nItemOffset) - { - } - - ParagraphItem (const ParagraphItem& oItem) : m_nItemOffset(oItem.m_nItemOffset) - { - if (oItem.m_item.operator->()) - { - m_item.reset(static_cast(oItem.m_item->Clone())); - } - } - - ParagraphItem& operator = (const ParagraphItem& oItem) - { - if (m_item.operator->() != oItem.m_item.operator->()) - { - m_item.reset(static_cast(oItem.m_item->Clone())); - m_nItemOffset = oItem.m_nItemOffset; - } - - return *this; - } - - inline unsigned int GetOffset() const - { - return m_nItemOffset; - } - - private: - - unsigned int m_nItemOffset; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Picture.h b/ASCOfficeDocFile_old/DocxDocConverter/Picture.h deleted file mode 100644 index 9ccf4dc5ea..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Picture.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include - -#include "IRunItem.h" -#include "PICFAndOfficeArtData.h" -#include "BinaryStorage.h" -#include "OfficeArt/BlipFactory.h" -#include "OfficeArt/OfficeArtFOPT.h" -#include "OfficeArt/OfficeArtClientAnchor.h" - -#define RATIO 1000 // TODO : recalculate - -#include "../Common/TextMark.h" - -namespace ASCDocFileFormat -{ - class Picture : public IRunItem, public IOperand - { - public: - - Picture () : m_oBinPictureInfo(), m_sTextType (std::wstring (&TextMark::Picture)), m_bOK(FALSE) - { - - } - - Picture (std::wstring strFileName, - short iWidth, - short iHeight, - unsigned short iRatioX = RATIO, - unsigned short iRatioY = RATIO, - Brc80 brcTop80 = Brc80(2, 0x00, 0x00, 0, false, false), - Brc80 brcLeft80 = Brc80(2, 0x00, 0x00, 0, false, false), - Brc80 brcBottom80 = Brc80(2, 0x00, 0x00, 0, false, false), - Brc80 brcRight80 = Brc80(2, 0x00, 0x00, 0, false, false)) : m_oBinPictureInfo(), m_sTextType (std::wstring (&TextMark::Picture)), m_bOK(FALSE) - { - OfficeArt::BlipFactory oBlipFactory (strFileName); - - OfficeArt::OfficeArtBlip* blip = oBlipFactory.GetOfficeArtBlip(); - if (blip) - { - OfficeArt::OfficeArtSpContainer shape; - OfficeArt::OfficeArtFSP shapeProp (OfficeArt::Enumerations::msosptPictureFrame); - shape.PushBack (shapeProp); - - OfficeArt::OfficeArtRGFOPTE oTable; - OfficeArt::OfficeArtFOPTE oEntry (OfficeArt::OfficeArtFOPTEOPID (OfficeArt::Enumerations::pib, true, false), 1); - oTable.PushComplexProperty (OfficeArt::ComplexOfficeArtProperty (oEntry, NULL)); - - OfficeArt::OfficeArtFOPT fopt (oTable); - shape.PushBack (fopt); - - OfficeArt::OfficeArtInlineSpContainer oPicture (shape); - OfficeArt::OfficeArtFBSE oBlipStoreEntry (TRUE, oBlipFactory.GetBlipType(), oBlipFactory.GetBlipType(), blip->Size() ); - oPicture.PushBack(oBlipStoreEntry); - oPicture.PushBack(*blip); - - PICMID oBorders (iWidth, iHeight, iRatioX, iRatioY, brcTop80, brcLeft80, brcBottom80, brcRight80); - PICF oPictureInfo (oPicture.Size(), oBorders); - - m_oBinPictureInfo = PICFAndOfficeArtData (oPictureInfo, oPicture); - - if (BinaryStorageSingleton::Instance()) - { - int dataStreamOffset = BinaryStorageSingleton::Instance()->PushData( (const unsigned char*)m_oBinPictureInfo, m_oBinPictureInfo.Size()); - - m_arProperties.push_back (Prl((short)DocFileFormat::sprmCPicLocation, (unsigned char*)(&dataStreamOffset))); - m_arProperties.push_back (Prl((short)DocFileFormat::sprmCFSpec, (unsigned char*)(&CFSpec))); - - m_bOK = TRUE; - } - - RELEASEOBJECT(blip); - } - } - - Picture (const Picture& oPicture) : m_oBinPictureInfo(oPicture.m_oBinPictureInfo), m_sTextType(oPicture.m_sTextType), m_arProperties(oPicture.m_arProperties), m_bOK(oPicture.m_bOK) - { - - } - - virtual ~Picture() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)(m_oBinPictureInfo); - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)(m_oBinPictureInfo); - } - - virtual unsigned int Size() const - { - return m_oBinPictureInfo.Size(); - } - - virtual IVirtualConstructor* New() const - { - return new Picture(); - } - - virtual IVirtualConstructor* Clone() const - { - return new Picture(*this); - } - - virtual unsigned long GetTextSize() const - { - return m_sTextType.size(); - } - - virtual std::wstring GetAllText() const - { - return m_sTextType; - } - - virtual std::vector GetRunProperties() const - { - std::vector prls; - - for (std::list::const_iterator iter = m_arProperties.begin(); iter != m_arProperties.end(); ++iter) - prls.push_back(*iter); - - return prls; - } - - virtual unsigned int PrlSize() const - { - return (unsigned int)m_arProperties.size(); - } - - inline bool IsValid() - { - return m_bOK; - } - - private: - - static const unsigned char CFSpec = 1; - - bool m_bOK; - - PICFAndOfficeArtData m_oBinPictureInfo; - - std::wstring m_sTextType; - std::list m_arProperties; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlcBteChpx.h b/ASCOfficeDocFile_old/DocxDocConverter/PlcBteChpx.h deleted file mode 100644 index 265634e349..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlcBteChpx.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class PlcBteChpx: public IStreamWriter - { - private: - vector aFC; - vector aPnBteChpx; - - public: - PlcBteChpx( const vector& _aFC, const vector& _aPnBteChpx ): - aFC(_aFC), aPnBteChpx(_aPnBteChpx) - { - } - - virtual ~PlcBteChpx() - { - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = ( ( sizeof(unsigned int) * this->aFC.size() ) + ( sizeof(unsigned int) * this->aPnBteChpx.size() ) ); - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - unsigned int i = 0; - - for ( i = 0; i < this->aFC.size(); i++ ) - { - FormatUtils::SetBytes( ( bytes + ( i * sizeof(unsigned int) ) ), (int)this->aFC[i] ); - } - - for ( i = 0; i < this->aPnBteChpx.size(); i++ ) - { - FormatUtils::SetBytes( ( bytes + ( sizeof(unsigned int) * this->aFC.size() ) + ( i * sizeof(unsigned int) ) ), (int)this->aPnBteChpx[i] ); - } - } - } - - return bytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlcBtePapx.h b/ASCOfficeDocFile_old/DocxDocConverter/PlcBtePapx.h deleted file mode 100644 index ca5ba2bd4d..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlcBtePapx.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - class PlcBtePapx: public IStreamWriter - { - private: - vector aFC; - vector aPnBtePapx; - - public: - PlcBtePapx( const vector& _aFC, const vector& _aPnBtePapx ): - aFC(_aFC), aPnBtePapx(_aPnBtePapx) - { - } - - virtual ~PlcBtePapx() - { - } - - virtual unsigned char* GetBytes( unsigned long* size ) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = ( ( sizeof(unsigned int) * this->aFC.size() ) + ( sizeof(unsigned int) * this->aPnBtePapx.size() ) ); - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - - unsigned int i = 0; - - for ( i = 0; i < this->aFC.size(); i++ ) - { - FormatUtils::SetBytes( ( bytes + ( i * sizeof(unsigned int) ) ), (int)this->aFC[i] ); - } - - for ( i = 0; i < this->aPnBtePapx.size(); i++ ) - { - FormatUtils::SetBytes( ( bytes + ( sizeof(unsigned int) * this->aFC.size() ) + ( i * sizeof(unsigned int) ) ), (int)this->aPnBtePapx[i] ); - } - } - } - - return bytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlcfSed.h b/ASCOfficeDocFile_old/DocxDocConverter/PlcfSed.h deleted file mode 100644 index cd7c8b0bda..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlcfSed.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PLC.h" - -namespace ASCDocFileFormat -{ - class Sed - { - private: - static const unsigned char SIZE_IN_BYTES = 12; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - Sed() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit Sed( int _fcSepx ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - FormatUtils::SetBytes( ( this->bytes + sizeof(short) ), _fcSepx ); - } - - Sed( const Sed& _sed ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _sed.bytes, SIZE_IN_BYTES ); - } - - int GetFcSepx() const - { - return FormatUtils::BytesToInt32( (unsigned char*)(this->bytes), sizeof(short), SIZE_IN_BYTES ); - } - }; - - typedef PLC PlcfSed; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlcfSpa.h b/ASCOfficeDocFile_old/DocxDocConverter/PlcfSpa.h deleted file mode 100644 index 3a6e4029d2..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlcfSpa.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Spa.h" - -namespace ASCDocFileFormat -{ - class PlcfSpa : public IOperand - { - public: - - PlcfSpa(): bytes(NULL), sizeInBytes(0) - { - bytes = new unsigned char [sizeInBytes]; - - if (bytes) - memset(bytes, 0, sizeInBytes); - } - - PlcfSpa (const vector& aCP, const vector& oSpa) : bytes(NULL), sizeInBytes(0) - { - sizeInBytes = ( (aCP.size() * sizeof(unsigned int) ) + ( oSpa.size() * Spa::SIZE_IN_BYTES ) ); - - bytes = new unsigned char[sizeInBytes]; - if (bytes) - { - memset (bytes, 0,sizeInBytes); - - unsigned int offset = 0; - for ( vector::const_iterator iter = aCP.begin(); iter != aCP.end(); ++iter) - { - FormatUtils::SetBytes( ( bytes + offset ), (int)(*iter) ); - offset += sizeof(unsigned int); - } - - if (bytes) - { - for (vector::const_iterator iter = oSpa.begin(); iter != oSpa.end(); ++iter) - { - memcpy ((bytes + offset), (unsigned char*)(*iter), iter->Size()); - offset += iter->Size(); - } - } - } - } - - PlcfSpa(const PlcfSpa& oSpa) : bytes(NULL), sizeInBytes(oSpa.sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - - if (bytes) - { - memset (bytes, 0, sizeInBytes); - memcpy (bytes, oSpa.bytes, sizeInBytes); - } - } - - inline bool operator == (const PlcfSpa& oSpa) - { - return ((sizeInBytes == oSpa.sizeInBytes) && (memcmp(bytes, oSpa.bytes, sizeInBytes ) == 0)); - } - - inline bool operator != (const PlcfSpa& oSpa) - { - return !( this->operator == (oSpa) ); - } - - inline PlcfSpa& operator = (const PlcfSpa& oSpa) - { - if (*this != oSpa) - { - RELEASEARRAYOBJECTS(bytes); - - sizeInBytes = oSpa.sizeInBytes; - bytes = new unsigned char[sizeInBytes]; - - if (bytes) - { - memcpy(bytes, oSpa.bytes, sizeInBytes); - } - } - - return *this; - } - - - // IOperand - - virtual ~PlcfSpa() - { - RELEASEARRAYOBJECTS(bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Plcfbkf.h b/ASCOfficeDocFile_old/DocxDocConverter/Plcfbkf.h deleted file mode 100644 index cb8f6fb790..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Plcfbkf.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PLC.h" - -namespace ASCDocFileFormat -{ - union BKC - { - private: - struct - { - unsigned short itcFirst:7; - unsigned short fPub:1; - unsigned short itcLim:6; - unsigned short fNative:1; - unsigned short fCol:1; - } BKCStruct; - unsigned short BKCUnsignedShort; - - public: - explicit BKC( unsigned short _bkc = 0 ): - BKCUnsignedShort(_bkc) - { - } - - explicit BKC( unsigned char _itcFirst, unsigned char _itcLim, bool _fNative, bool _fCol ): - BKCUnsignedShort(0) - { - this->BKCStruct.itcFirst = _itcFirst; - this->BKCStruct.itcLim = _itcLim; - - ( _fNative ) ? ( this->BKCStruct.fNative = 1 ) : ( this->BKCStruct.fNative = 0 ); - ( _fCol ) ? ( this->BKCStruct.fCol = 1 ) : ( this->BKCStruct.fCol = 0 ); - } - - operator unsigned short () const - { - return this->BKCUnsignedShort; - } - }; - - class FBKF - { - private: - static const unsigned char SIZE_IN_BYTES = 4; - unsigned char bytes[SIZE_IN_BYTES]; - - public: - FBKF() - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - } - - explicit FBKF( unsigned short _ibkl, BKC _bkc ) - { - FormatUtils::SetBytes( this->bytes, _ibkl ); - FormatUtils::SetBytes( ( this->bytes + sizeof(_ibkl) ), (unsigned short)_bkc ); - } - - FBKF( const FBKF& _fBKF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _fBKF.bytes, SIZE_IN_BYTES ); - } - - FBKF& operator = ( const FBKF& _fBKF ) - { - if ( this != &_fBKF ) - { - memset( this->bytes, 0, SIZE_IN_BYTES ); - - memcpy( this->bytes, _fBKF.bytes, SIZE_IN_BYTES ); - } - - return *this; - } - - unsigned short GetIndex() const - { - return FormatUtils::BytesToUInt16( (unsigned char*)(this->bytes), 0, SIZE_IN_BYTES ); - } - - BKC GetBKC() const - { - return BKC( FormatUtils::BytesToUInt16( (unsigned char*)(this->bytes), 2, SIZE_IN_BYTES ) ); - } - }; - - typedef PLC Plcfbkf; - typedef PLC<> Plcfbkl; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Plcfld.h b/ASCOfficeDocFile_old/DocxDocConverter/Plcfld.h deleted file mode 100644 index 3f67e3c512..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Plcfld.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "PLC.h" -#include "Constants.h" - -namespace ASCDocFileFormat -{ - union grffldEnd - { - private: - struct - { - unsigned char fDiffer:1; - unsigned char fZombieEmbed:1; - unsigned char fResultsDirty:1; - unsigned char fResultsEdited:1; - unsigned char fLocked:1; - unsigned char fPrivateResult:1; - unsigned char fNested:1; - unsigned char fHasSep:1; - } grffldEndStruct; - unsigned char grffldEndByte; - - public: - explicit grffldEnd( unsigned char _grffldEnd = 0 ):grffldEndByte(_grffldEnd) - { - } - - grffldEnd( bool _fDiffer, bool _fZombieEmbed, bool _fResultsDirty, bool _fResultsEdited, bool _fLocked, bool _fPrivateResult, bool _fNested, bool _fHasSep ) - { - ( _fDiffer ) ? ( this->grffldEndStruct.fDiffer = 1 ) : ( this->grffldEndStruct.fDiffer = 0 ); - ( _fZombieEmbed ) ? ( this->grffldEndStruct.fZombieEmbed = 1 ) : ( this->grffldEndStruct.fZombieEmbed = 0 ); - ( _fResultsDirty ) ? ( this->grffldEndStruct.fResultsDirty = 1 ) : ( this->grffldEndStruct.fResultsDirty = 0 ); - ( _fResultsEdited ) ? ( this->grffldEndStruct.fResultsEdited = 1 ) : ( this->grffldEndStruct.fResultsEdited = 0 ); - ( _fLocked ) ? ( this->grffldEndStruct.fLocked = 1 ) : ( this->grffldEndStruct.fLocked = 0 ); - ( _fPrivateResult ) ? ( this->grffldEndStruct.fPrivateResult = 1 ) : ( this->grffldEndStruct.fPrivateResult = 0 ); - ( _fNested ) ? ( this->grffldEndStruct.fNested = 1 ) : ( this->grffldEndStruct.fNested = 0 ); - ( _fHasSep ) ? ( this->grffldEndStruct.fHasSep = 1 ) : ( this->grffldEndStruct.fHasSep = 0 ); - } - - operator unsigned char () const - { - return this->grffldEndByte; - } - }; - - class Fld - { - public: - - Fld () - { - memset(bytes, 0, SIZE_IN_BYTES); - } - - Fld (unsigned char _fldch, unsigned char _grffld) - { - memset( bytes, 0, SIZE_IN_BYTES ); - - bytes[0] = _fldch; - bytes[1] = _grffld; - } - - Fld (const Fld& oFld) - { - memset ( bytes, 0, SIZE_IN_BYTES ); - memcpy ( bytes, oFld.bytes, SIZE_IN_BYTES ); - } - - Fld& operator = ( const Fld& _fld ) - { - if ( this != &_fld ) - { - memset( bytes, 0, SIZE_IN_BYTES ); - memcpy( bytes, _fld.bytes, SIZE_IN_BYTES ); - } - - return *this; - } - - inline unsigned char GetFieldCharacterType() const - { - return bytes[0]; - } - - inline unsigned char GetFieldCharacterProperties() const - { - return bytes[1]; - } - - inline void SetProperties (unsigned char grffld) - { - bytes [ 1 ] = grffld; - } - - private: - - static const unsigned char SIZE_IN_BYTES = 2; - unsigned char bytes[SIZE_IN_BYTES]; - }; - - typedef PLC Plcfld; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlfLfo.h b/ASCOfficeDocFile_old/DocxDocConverter/PlfLfo.h deleted file mode 100644 index 2c3764fce2..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlfLfo.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LFO.h" -#include "LFOData.h" - -namespace ASCDocFileFormat -{ - class PlfLfo: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - PlfLfo() : bytes(NULL), sizeInBytes(sizeof(unsigned int)) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - - explicit PlfLfo( const vector& _rgLfo, const vector& _rgLfoData ) : bytes(NULL), sizeInBytes(sizeof(unsigned int)) - { - if ( _rgLfo.size() != _rgLfoData.size() ) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - } - } - else - { - for ( vector::const_iterator iter = _rgLfo.begin(); iter != _rgLfo.end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - - for ( vector::const_iterator iter = _rgLfoData.begin(); iter != _rgLfoData.end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (unsigned int)_rgLfo.size() ); - - unsigned int offset = sizeof(unsigned int); - - if ( this->bytes != NULL ) - { - for ( vector::const_iterator iter = _rgLfo.begin(); iter != _rgLfo.end(); iter++ ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(*iter), iter->Size() ); - offset += iter->Size(); - } - - for ( vector::const_iterator iter = _rgLfoData.begin(); iter != _rgLfoData.end(); iter++ ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(*iter), iter->Size() ); - offset += iter->Size(); - } - } - } - } - } - - PlfLfo( const PlfLfo& _plfLfo ): - bytes(NULL), sizeInBytes(_plfLfo.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if (bytes) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _plfLfo.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const PlfLfo& _plfLfo ) - { - return ( ( this->sizeInBytes == _plfLfo.sizeInBytes ) && - ( memcmp( this->bytes, _plfLfo.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const PlfLfo& _plfLfo ) - { - return !( this->operator == ( _plfLfo ) ); - } - - PlfLfo& operator = ( const PlfLfo& _plfLfo ) - { - if ( *this != _plfLfo ) - { - RELEASEARRAYOBJECTS(bytes); - - this->sizeInBytes = _plfLfo.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _plfLfo.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~PlfLfo() - { - RELEASEARRAYOBJECTS(bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PlfLst.h b/ASCOfficeDocFile_old/DocxDocConverter/PlfLst.h deleted file mode 100644 index 364df41658..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PlfLst.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LSTF.h" - -namespace ASCDocFileFormat -{ - class PlfLst : public IOperand - { - public: - PlfLst() : bytes(NULL), sizeInBytes(2) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - memset( this->bytes, 0, this->sizeInBytes ); - } - - explicit PlfLst( const vector& _rgLstf ) : bytes(NULL), sizeInBytes(sizeof(short)) - { - if ( !_rgLstf.empty() ) - { - this->sizeInBytes += ( _rgLstf.size() * _rgLstf[0].Size() ); - } - - this->bytes = new unsigned char[this->sizeInBytes]; - - memset( this->bytes, 0, this->sizeInBytes ); - - FormatUtils::SetBytes( this->bytes, (short)_rgLstf.size() ); - - for ( unsigned int i = 0; i < _rgLstf.size(); i++ ) - { - memcpy( ( this->bytes + sizeof(short) + ( i * _rgLstf[i].Size() ) ), (unsigned char*)_rgLstf[i], _rgLstf[i].Size() ); - } - } - - PlfLst( const PlfLst& _plfLst ) : bytes(NULL), sizeInBytes(_plfLst.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _plfLst.bytes, this->sizeInBytes ); - } - - virtual ~PlfLst() - { - RELEASEARRAYOBJECTS (bytes); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PositionCodeOperand.h b/ASCOfficeDocFile_old/DocxDocConverter/PositionCodeOperand.h deleted file mode 100644 index ceca8a57a0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PositionCodeOperand.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -namespace ASCDocFileFormat -{ - union PositionCodeOperand - { - private: - struct - { - unsigned char padding:4; - unsigned char pcVert:2; - unsigned char pcHorz:2; - } PositionCodeOperandStruct; - - unsigned char PositionCodeOperandByte; - - public: - PositionCodeOperand(): - PositionCodeOperandByte(0) - { - } - - explicit PositionCodeOperand( unsigned char _pcVert, unsigned char _pcHorz ): - PositionCodeOperandByte(0) - { - this->PositionCodeOperandStruct.padding = 0; - this->PositionCodeOperandStruct.pcVert = _pcVert; - this->PositionCodeOperandStruct.pcHorz = _pcHorz; - } - - explicit PositionCodeOperand( unsigned char _positionCodeOperand ): - PositionCodeOperandByte(_positionCodeOperand) - { - } - - operator unsigned char() const - { - return this->PositionCodeOperandByte; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Prl.h b/ASCOfficeDocFile_old/DocxDocConverter/Prl.h deleted file mode 100644 index a85372b2b4..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Prl.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IStreamWriter.h" -#include "../Common/SPRMCodes.h" -#include "../Common/FormatUtils.h" - -namespace ASCDocFileFormat -{ - class Prl: public IStreamWriter - { - private: - union - { - struct - { - unsigned int ispmd:9; - unsigned int fSpec:1; - unsigned int sgc:3; - unsigned int spra:3; - } sprmstruct; - unsigned short sprmshort; - } sprm; - - DocFileFormat::OperationCode OpCode; - unsigned char* operand; - unsigned short operandSize; - - /// Get be used to get the size of the sprm's operand. - /// Returns 0 if the Operation failed and 255 if the size is variable - unsigned char GetOperandSize( unsigned char spra ) - { - switch ( spra ) - { - case 0: return 1; - case 1: return 1; - case 2: return 2; - case 3: return 4; - case 4: return 2; - case 5: return 2; - case 6: return 255; - case 7: return 3; - default: return 0; - } - } - - public: - - Prl () - { - operand = NULL; - operandSize = 0; - - sprm.sprmshort = 0; - OpCode = (DocFileFormat::OperationCode)0; - } - - Prl (short inSprm, unsigned char* operandBytes) - { - operand = NULL; - operandSize = 0; - - sprm.sprmshort = inSprm; - OpCode = (DocFileFormat::OperationCode)(sprm.sprmshort); - unsigned char opSize = GetOperandSize(sprm.sprmstruct.spra); - - if ( opSize == 255 ) - { - switch (sprm.sprmshort) - { - case 0xD608: //sprmTDefTable - case 0xD606: //sprmTDefTable10 - { - //!!!TODO!!! - this->operandSize = FormatUtils::BytesToUInt16( operandBytes, 0, 2 ) + 1; - this->operand = new unsigned char[this->operandSize]; - memset( this->operand, 0, this->operandSize ); - - if ( operandBytes != NULL ) - { - memcpy( this->operand, operandBytes, this->operandSize ); - } - } - break; - - case 0xC615: //sprmPChgTabs - { - //!!!TODO!!! - } - break; - - default: - { - //!!!TODO!!! - this->operandSize = ( operandBytes[0] + 1 ); - this->operand = new unsigned char[this->operandSize]; - memset( this->operand, 0, this->operandSize ); - - if ( operandBytes != NULL ) - { - memcpy( this->operand, operandBytes, this->operandSize ); - } - } - - break; - } - } - else if ( opSize != 0 ) - { - operandSize = opSize; - operand = new unsigned char[operandSize]; - - if (NULL != operand) - memset(operand, 0, operandSize); - - if (NULL != operandBytes) - memcpy(operand, operandBytes, operandSize); - } - } - - Prl (const Prl& oPrl) - { - sprm.sprmshort = oPrl.sprm.sprmshort; - OpCode = oPrl.OpCode; - operandSize = oPrl.operandSize; - - operand = new unsigned char[operandSize]; - if (operand) - { - memcpy(operand, oPrl.operand, operandSize); - } - } - - bool operator == (const Prl& oPrl) - { - unsigned short minOperandSize = (std::min)(operandSize, oPrl.operandSize); - return ((sprm.sprmshort == oPrl.sprm.sprmshort) && (0 == memcmp(operand, oPrl.operand, minOperandSize))); - } - - bool operator != (const Prl& oPrl) - { - return !( this->operator == (oPrl) ); - } - - Prl& operator = (const Prl& oPrl) - { - if (*this != oPrl) - { - sprm.sprmshort = oPrl.sprm.sprmshort; - OpCode = oPrl.OpCode; - operandSize = oPrl.operandSize; - - RELEASEARRAYOBJECTS (operand); - - operand = new unsigned char[operandSize]; - if(operand) - { - memcpy(operand, oPrl.operand, operandSize); - } - } - - return *this; - } - - virtual ~Prl() - { - RELEASEARRAYOBJECTS (operand); - } - - virtual unsigned char* GetBytes (unsigned long* size) const - { - unsigned char* bytes = NULL; - - if ( size != NULL ) - { - *size = ( sizeof(sprm.sprmshort) + operandSize ); - bytes = new unsigned char[*size]; - - if ( bytes != NULL ) - { - memset( bytes, 0, *size ); - FormatUtils::SetBytes( bytes, sprm.sprmshort ); - memcpy( ( bytes + 2 ), operand, operandSize ); - } - } - - return bytes; - } - - unsigned long Size() const - { - return ( sizeof(sprm.sprmshort) + operandSize ); - } - - unsigned short GetSprmCode() const - { - return sprm.sprmshort; - } - - // - inline unsigned short GetOpTwo () const // return two bytes value - { - return (unsigned short)(operand[0] | operand[1] << 8); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/PropertyReader.h b/ASCOfficeDocFile_old/DocxDocConverter/PropertyReader.h deleted file mode 100644 index 639dc56f0b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/PropertyReader.h +++ /dev/null @@ -1,485 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include -#include - -#include "DocFile.h" - -#include "DocxToDocUtils.h" -#include "../../Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h" -#include "../../Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h" -#include "../Common/SPRMCodes.h" - -typedef std::vector PrlList; - -class CXmlPropertyReader -{ -public: - - CXmlPropertyReader () - { - - } - - ~CXmlPropertyReader () - { - - } - - /* - inline PrlList GetRunProperties (const OOX::Logic::RunProperty& oXmlRunProperties) - { - PrlList docRunProperties; - - if ( oXmlRunProperties.Bold.is_init() ) - { - unsigned char bold = ( ( *oXmlRunProperties.Bold ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFBold, &bold ) ); - } - - if ( oXmlRunProperties.Italic.is_init() ) - { - unsigned char italic = ( ( *oXmlRunProperties.Italic ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFItalic, &italic ) ); - } - - if ( oXmlRunProperties.Under.is_init() && *oXmlRunProperties.Under && oXmlRunProperties.UnderType.is_init() ) - { - unsigned char under = this->kulMap[*oXmlRunProperties.UnderType]; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCKul, &under ) ); - } - - if ( oXmlRunProperties.Strike.is_init() ) - { - unsigned char strike = ( ( *oXmlRunProperties.Strike ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFStrike, &strike ) ); - } - - if ( oXmlRunProperties.DStrike.is_init() ) - { - unsigned char dStrike = ( ( *oXmlRunProperties.DStrike ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFDStrike, &dStrike ) ); - } - - if ( oXmlRunProperties.SmallCaps.is_init() ) - { - unsigned char smallCaps = ( ( *oXmlRunProperties.SmallCaps ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFSmallCaps, &smallCaps ) ); - } - - if ( oXmlRunProperties.Caps.is_init() ) - { - unsigned char caps = ( ( *oXmlRunProperties.Caps ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFCaps, &caps ) ); - } - - if ( oXmlRunProperties.Emboss.is_init() ) - { - unsigned char emboss = ( ( *oXmlRunProperties.Emboss ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFEmboss, &emboss ) ); - } - - if ( oXmlRunProperties.Imprint.is_init() ) - { - unsigned char imprint = ( ( *oXmlRunProperties.Imprint ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFImprint, &imprint ) ); - } - - if ( oXmlRunProperties.Outline.is_init() ) - { - unsigned char outline = ( ( *oXmlRunProperties.Outline ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFOutline, &outline ) ); - } - - if ( oXmlRunProperties.Shadow.is_init() ) - { - unsigned char shadow = ( ( *oXmlRunProperties.Shadow ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFShadow, &shadow ) ); - } - - if ( oXmlRunProperties.Vanish.is_init() ) - { - unsigned char vanish = ( ( *oXmlRunProperties.Vanish ) ? ( 1 ) : ( 0 ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCFVanish, &vanish ) ); - } - - if ( oXmlRunProperties.FontSize.is_init() ) - { - unsigned short fontSize = (unsigned short)oXmlRunProperties.FontSize; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHps, (unsigned char*)&fontSize ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsBi, (unsigned char*)&fontSize ) ); - } - - if (oXmlRunProperties.FontColor.is_init()) - { - int colorIntValue = ASCDocFileFormat::COLORREF::cvAuto; - if (false == oXmlRunProperties.FontColor->isAuto()) - colorIntValue = HexString2Int( oXmlRunProperties.FontColor->ToString() ); - - ASCDocFileFormat::COLORREF color (colorIntValue); - - docRunProperties.push_back (ASCDocFileFormat::Prl((short)DocFileFormat::sprmCCv, color)); - } - - if ( oXmlRunProperties.Highlight.is_init() ) - { - unsigned char ico = DOCXDOCUTILS::ColorToIco (*oXmlRunProperties.Highlight); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHighlight, &ico ) ); - } - - if ( oXmlRunProperties.Shading.is_init() && oXmlRunProperties.Shading->Fill.is_init() ) - { - int colorIntValue = 0; - int fillAuto = 0x00; - - if (oXmlRunProperties.Shading->Fill == "auto") - { - fillAuto = ASCDocFileFormat::COLORREF::cvAuto; - } - else - { - colorIntValue = HexString2Int( *oXmlRunProperties.Shading->Fill ); - } - - ASCDocFileFormat::SHDOperand shdOperand ( - ASCDocFileFormat::Shd( ASCDocFileFormat::COLORREF( (int)( 0 | fillAuto ) ), - ASCDocFileFormat::COLORREF( colorIntValue | fillAuto ), - 0 ) ); - - docRunProperties.push_back (ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCShd, shdOperand )); - } - - if ( oXmlRunProperties.rFonts.is_init() ) - { - short fontIndex = 0; - - if ( oXmlRunProperties.rFonts->Ascii.is_init() && !oXmlRunProperties.rFonts->AsciiTheme.is_init() ) - { - fontIndex = this->fontTableMap[oXmlRunProperties.rFonts->Ascii]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc0, (unsigned char*)&fontIndex ) ); - } - else if ( oXmlRunProperties.rFonts->AsciiTheme.is_init() ) - { - string fontNameByThemeName = this->GetFontNameByThemeName( oXmlRunProperties.rFonts->AsciiTheme ); - - if ( !fontNameByThemeName.empty() ) - { - map::const_iterator findResult = this->fontTableMap.find( fontNameByThemeName ); - - if ( findResult != this->fontTableMap.end() ) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc0, (unsigned char*)&fontIndex ) ); - } - } - - if ( oXmlRunProperties.rFonts->Cs.is_init() && !oXmlRunProperties.rFonts->Cstheme.is_init() ) - { - fontIndex = fontTableMap[oXmlRunProperties.rFonts->Cs]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc1, (unsigned char*)&fontIndex ) ); - } - else if ( oXmlRunProperties.rFonts->Cstheme.is_init() ) - { - string fontNameByThemeName = this->GetFontNameByThemeName( oXmlRunProperties.rFonts->Cstheme ); - - if ( !fontNameByThemeName.empty() ) - { - map::const_iterator findResult = fontTableMap.find( fontNameByThemeName ); - - if ( findResult != this->fontTableMap.end() ) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc1, (unsigned char*)&fontIndex ) ); - } - } - - if ( oXmlRunProperties.rFonts->HAnsi.is_init() && !oXmlRunProperties.rFonts->HAnsiTheme.is_init() ) - { - fontIndex = this->fontTableMap[oXmlRunProperties.rFonts->HAnsi]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc2, (unsigned char*)&fontIndex ) ); - } - else if ( oXmlRunProperties.rFonts->HAnsiTheme.is_init() ) - { - string fontNameByThemeName = this->GetFontNameByThemeName( oXmlRunProperties.rFonts->HAnsiTheme ); - - if ( !fontNameByThemeName.empty() ) - { - map::const_iterator findResult = fontTableMap.find( fontNameByThemeName ); - - if (findResult != fontTableMap.end()) - { - fontIndex = findResult->second; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgFtc2, (unsigned char*)&fontIndex ) ); - } - } - } - - if ( oXmlRunProperties.Lang.is_init() ) - { - if ( oXmlRunProperties.Lang->Value.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[oXmlRunProperties.Lang->Value]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid0_80, (unsigned char*)lid ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid0, (unsigned char*)lid ) ); - } - - if ( oXmlRunProperties.Lang->EastAsia.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[oXmlRunProperties.Lang->EastAsia]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid1_80, (unsigned char*)lid ) ); - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCRgLid1, (unsigned char*)lid ) ); - } - - if ( oXmlRunProperties.Lang->Bidi.is_init() ) - { - ASCDocFileFormat::LID lid = lidMap[oXmlRunProperties.Lang->Bidi]; - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCLidBi, (unsigned char*)lid ) ); - } - } - - if ( oXmlRunProperties.Spacing.is_init() ) - { - short CDxaSpace = ASCDocFileFormat::XAS( *oXmlRunProperties.Spacing ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCDxaSpace, (unsigned char*)&CDxaSpace ) ); - } - - if ( oXmlRunProperties.Index.is_init() ) - { - string index = oXmlRunProperties.Index->ToString(); - unsigned char CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptNormalText; - - if ( index == string( "superscript" ) ) - { - CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptSuperscript; - } - else if ( index == string( "subscript" ) ) - { - CIss = (unsigned char)ASCDocFileFormat::Constants::superSubScriptSubscript; - } - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCIss, (unsigned char*)&CIss ) ); - } - - if ( oXmlRunProperties.Kern.is_init() ) - { - int kern = *oXmlRunProperties.Kern; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsKern, (unsigned char*)&kern ) ); - } - - if ( oXmlRunProperties.Position.is_init() ) - { - int position = *oXmlRunProperties.Position; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCHpsPos, (unsigned char*)&position ) ); - } - - if ( oXmlRunProperties.Scale.is_init() ) - { - unsigned short scale = *oXmlRunProperties.Scale; - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCCharScale, (unsigned char*)&scale ) ); - } - - if ( oXmlRunProperties.Border.is_init() ) - { - unsigned int brc80 = (unsigned int)ASCDocFileFormat::Brc80( - oXmlRunProperties.Border->Bdr->Sz.get_value_or_default(), - m_brcTypeMap[*oXmlRunProperties.Border->Bdr->Value], - DOCXDOCUTILS::ColorToIco (oXmlRunProperties.Border->Bdr->Color.get_value_or_default()), - oXmlRunProperties.Border->Bdr->Space.get_value_or_default(), - false, - false ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCBrc80, (unsigned char*)(&brc80) ) ); - - ASCDocFileFormat::BrcOperand brcOperand( ASCDocFileFormat::Brc( - ASCDocFileFormat::COLORREF( HexString2Int( oXmlRunProperties.Border->Bdr->Color.get_value_or_default().ToString() ) ), - oXmlRunProperties.Border->Bdr->Sz.get_value_or_default(), - m_brcTypeMap[*oXmlRunProperties.Border->Bdr->Value], - oXmlRunProperties.Border->Bdr->Space.get_value_or_default(), - false, - false ) ); - - docRunProperties.push_back( ASCDocFileFormat::Prl( (short)DocFileFormat::sprmCBrc, (unsigned char*)brcOperand ) ); - } - - return docRunProperties; - } - - */ - - // - inline PrlList GetTableStyleProperties (const PrlList& arSource) - { - PrlList arFinal; - - for (size_t i = 0; i < arSource.size(); ++i) - { - unsigned short nCode = arSource[i].GetSprmCode(); - - if (DocFileFormat::sprmTDxaLeft == nCode || - DocFileFormat::sprmTDefTable == nCode || - DocFileFormat::sprmTDefTableShd80 == nCode || - DocFileFormat::sprmTDefTableShd3rd == nCode || - DocFileFormat::sprmTDefTableShd == nCode || - DocFileFormat::sprmTDefTableShd2nd == nCode || - DocFileFormat::sprmTWidthAfter == nCode || - DocFileFormat::sprmTFKeepFollow == nCode || - DocFileFormat::sprmTBrcTopCv == nCode || - DocFileFormat::sprmTBrcLeftCv == nCode || - DocFileFormat::sprmTBrcBottomCv == nCode || - DocFileFormat::sprmTBrcRightCv == nCode || - DocFileFormat::sprmTSetBrc80 == nCode || - DocFileFormat::sprmTInsert == nCode || - DocFileFormat::sprmTDelete == nCode || - DocFileFormat::sprmTDxaCol == nCode || - DocFileFormat::sprmTMerge == nCode || - DocFileFormat::sprmTSplit == nCode || - DocFileFormat::sprmTTextFlow == nCode || - DocFileFormat::sprmTVertMerge == nCode || - DocFileFormat::sprmTVertAlign == nCode || - DocFileFormat::sprmTSetBrc == nCode || - DocFileFormat::sprmTCellPadding == nCode || - DocFileFormat::sprmTCellWidth == nCode || - DocFileFormat::sprmTFitText == nCode || - DocFileFormat::sprmTFCellNoWrap == nCode || - 0xD642 == nCode || // sprmTCellFHideMark - DocFileFormat::sprmTSetShdTable == nCode || - DocFileFormat::sprmTCellBrcType == nCode || - DocFileFormat::sprmTFBiDi90 == nCode || - DocFileFormat::sprmTFNoAllowOverlap == nCode || - DocFileFormat::sprmTIpgp == nCode || - DocFileFormat::sprmTDefTableShdRaw == nCode || - DocFileFormat::sprmTDefTableShdRaw2nd == nCode || - DocFileFormat::sprmTDefTableShdRaw3rd == nCode || - - DocFileFormat::sprmTCnf == nCode ) - { - continue; - } - - arFinal.push_back (arSource[i]); - } - - return arFinal; - } - - inline PrlList GetRunStyleProperties (const PrlList& arSource) - { - PrlList arFinal; - - for (size_t i = 0; i < arSource.size(); ++i) - { - unsigned short nCode = arSource[i].GetSprmCode(); - - if (DocFileFormat::sprmCFSpecVanish == nCode || - DocFileFormat::sprmCIstd == nCode || - DocFileFormat::sprmCIstdPermute == nCode || - DocFileFormat::sprmCPlain == nCode || - DocFileFormat::sprmCMajority == nCode || - DocFileFormat::sprmCDispFldRMark == nCode || - DocFileFormat::sprmCIdslRMarkDel == nCode || - DocFileFormat::sprmCLbcCRJ == nCode || - DocFileFormat::sprmCPbiIBullet == nCode || - DocFileFormat::sprmCPbiGrf == nCode || - - DocFileFormat::sprmCCnf == nCode ) - { - continue; - } - - arFinal.push_back (arSource[i]); - } - - return arFinal; - } - - inline PrlList GetParagraphStyleProperties (const PrlList& arSource) - { - PrlList arFinal; - - for (size_t i = 0; i < arSource.size(); ++i) - { - unsigned short nCode = arSource[i].GetSprmCode(); - - if (DocFileFormat::sprmPIstd == nCode || - DocFileFormat::sprmPIstdPermute == nCode || - DocFileFormat::sprmPIncLvl == nCode || - DocFileFormat::sprmPNest80 == nCode || - DocFileFormat::sprmPChgTabs == nCode || - DocFileFormat::sprmPDcs == nCode || - DocFileFormat::sprmPHugePapx == nCode || - DocFileFormat::sprmPFInnerTtp == nCode || - 0x245A == nCode || // sprmPFOpenTch - DocFileFormat::sprmPNest == nCode || - DocFileFormat::sprmPFNoAllowOverlap == nCode || - DocFileFormat::sprmPIstdListPermute == nCode || - DocFileFormat::sprmPTableProps == nCode || - DocFileFormat::sprmPTIstdInfo == nCode || - - 0xC666 == nCode ) // sprmPCnf - { - continue; - } - - arFinal.push_back (arSource[i]); - } - - return arFinal; - } - - -private: - -}; diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Run.cpp b/ASCOfficeDocFile_old/DocxDocConverter/Run.cpp deleted file mode 100644 index 1751997dd4..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Run.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Run.h" - -namespace ASCDocFileFormat -{ - Run::Run() - { - } - - /*========================================================================================================*/ - - Run::Run( const IRunItem& _runItem ) - { - this->items.push_back( RunItem( _runItem ) ); - - vector prls = _runItem.GetRunProperties(); - - for ( vector::const_iterator iter = prls.begin(); iter != prls.end(); iter++ ) - { - this->properties.push_back( *iter ); - } - } - - /*========================================================================================================*/ - - Run::Run( const Run& _run ): - properties(_run.properties) - { - for ( list::const_iterator iter = _run.items.begin(); iter != _run.items.end(); iter++ ) - { - this->items.push_back( *iter ); - } - } - - /*========================================================================================================*/ - - Run& Run::operator = ( const Run& _run ) - { - if ( this != &_run ) - { - this->properties = _run.properties; - this->items.clear(); - - for ( list::const_iterator iter = _run.items.begin(); iter != _run.items.end(); iter++ ) - { - this->items.push_back( *iter ); - } - } - - return *this; - } - - /*========================================================================================================*/ - - void Run::AddRunItem( const IRunItem& _runItem ) - { - this->items.push_back( RunItem( _runItem ) ); - - vector prls = _runItem.GetRunProperties(); - - for ( vector::const_iterator iter = prls.begin(); iter != prls.end(); iter++ ) - { - this->properties.push_back( *iter ); - } - } - - /*========================================================================================================*/ - - Run::~Run() - { - } - - /*========================================================================================================*/ - - unsigned long Run::GetTextSize() const - { - unsigned long textSize = 0; - - for ( list::const_iterator iter = this->items.begin(); iter != this->items.end(); iter++ ) - { - textSize += (*iter)->GetTextSize(); - } - - return textSize; - } - - /*========================================================================================================*/ - - wstring Run::GetAllText() const - { - wstring allText; - - for ( list::const_iterator iter = this->items.begin(); iter != this->items.end(); iter++ ) - { - allText += (*iter)->GetAllText(); - } - - return allText; - } - - /*========================================================================================================*/ - - vector Run::GetRunProperties( vector* runOffsets ) const - { - vector chpxs; - - vector prls; - - if ( runOffsets != NULL ) - { - for ( list::const_iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - prls.push_back( *iter ); - } - - Chpx chpx( prls ); - - chpxs.push_back( chpx ); - - runOffsets->push_back( 0 ); - } - - return chpxs; - } - - /*========================================================================================================*/ - - unsigned int Run::PrlSize () const - { - return (unsigned int)properties.size(); - } - - /*========================================================================================================*/ - - vector Run::GetAllRunsCopy( vector* runOffsets ) const - { - vector paragraphItems; - - if ( runOffsets != NULL ) - { - paragraphItems.push_back( IParagraphItemPtr( static_cast(this->Clone()) ) ); - runOffsets->push_back( 0 ); - } - - return paragraphItems; - } - - /*========================================================================================================*/ - - void Run::AddProperty( short sprm, void* operand ) - { - Prl prl( sprm, reinterpret_cast( operand ) ); - this->properties.push_back( prl ); - } - - /*========================================================================================================*/ - - void Run::AddProperty( const Prl& prl ) - { - this->properties.push_back( prl ); - } - - /*========================================================================================================*/ - - void Run::AddProperties( const vector& prls ) - { - for ( vector::const_iterator iter = prls.begin(); iter != prls.end(); iter++ ) - { - this->properties.push_back( *iter ); - } - } - - /*========================================================================================================*/ - - void Run::AddOrReplaceProperties( const vector& prls ) - { - for ( vector::const_iterator iter = prls.begin(); iter != prls.end(); iter++ ) - { - this->RemovePropertyByCode( iter->GetSprmCode() ); - - this->AddProperty( *iter ); - } - } - - /*========================================================================================================*/ - - void Run::RemoveProperty( short sprm, void* operand ) - { - Prl prl( sprm, reinterpret_cast( operand ) ); - this->properties.remove( prl ); - } - - /*========================================================================================================*/ - - void Run::RemovePropertyByCode( unsigned short sprm ) - { - for ( list::iterator iter = this->properties.begin(); iter != this->properties.end(); iter++ ) - { - if ( iter->GetSprmCode() == sprm ) - { - this->properties.erase( iter ); - - this->RemovePropertyByCode( sprm ); - - break; - } - } - } - - /*========================================================================================================*/ - - void Run::RemoveAllProperties() - { - this->properties.clear(); - } - - /*========================================================================================================*/ - - IVirtualConstructor* Run::New() const - { - return new Run(); - } - - /*========================================================================================================*/ - - IVirtualConstructor* Run::Clone() const - { - return new Run( *this ); - } - - /*========================================================================================================*/ - - Run::const_iterator Run::begin() const - { - return this->items.begin(); - } - - /*========================================================================================================*/ - - Run::const_iterator Run::end() const - { - return this->items.end(); - } - - /*========================================================================================================*/ - - Run::iterator Run::begin() - { - return this->items.begin(); - } - - /*========================================================================================================*/ - - Run::iterator Run::end() - { - return this->items.end(); - } - - /*========================================================================================================*/ - - Run::const_reverse_iterator Run::rbegin() const - { - return this->items.rbegin(); - } - - /*========================================================================================================*/ - - Run::const_reverse_iterator Run::rend() const - { - return this->items.rend(); - } - - /*========================================================================================================*/ - - Run::reverse_iterator Run::rbegin() - { - return this->items.rbegin(); - } - - /*========================================================================================================*/ - - Run::reverse_iterator Run::rend() - { - return this->items.rend(); - } - - /*========================================================================================================*/ - - Run::const_reference Run::front() const - { - return *this->begin(); - } - - /*========================================================================================================*/ - - Run::const_reference Run::back() const - { - return *(--this->end()); - } - - /*========================================================================================================*/ - - Run::reference Run::front() - { - return *this->begin(); - } - - /*========================================================================================================*/ - - Run::reference Run::back() - { - return *(--this->end()); - } -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/Run.h b/ASCOfficeDocFile_old/DocxDocConverter/Run.h deleted file mode 100644 index 9d4c279ab3..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/Run.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IParagraphItem.h" -#include "RunItem.h" -#include "Text.h" -#include "Picture.h" -#include "EndnoteRef.h" -#include "EndnoteReference.h" -#include "FootnoteRef.h" -#include "FootnoteReference.h" -#include "FldChar.h" - -namespace ASCDocFileFormat -{ - class Run : public IParagraphItem - { - protected: - std::list items; - std::list properties; - - public: - typedef list::const_iterator const_iterator; - typedef list::iterator iterator; - typedef list::const_reverse_iterator const_reverse_iterator; - typedef list::reverse_iterator reverse_iterator; - typedef list::const_reference const_reference; - typedef list::reference reference; - - const_iterator begin() const; - const_iterator end() const; - iterator begin(); - iterator end(); - const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; - reverse_iterator rbegin(); - reverse_iterator rend(); - const_reference front() const; - const_reference back() const; - reference front(); - reference back(); - - public: - Run(); - Run( const IRunItem& _runItem ); - Run( const Run& _run ); - virtual ~Run(); - Run& operator = ( const Run& _run ); - void AddRunItem( const IRunItem& _runItem ); - virtual unsigned long GetTextSize() const; - virtual wstring GetAllText() const; - virtual vector GetRunProperties( vector* runOffsets ) const; - virtual unsigned int PrlSize() const; - virtual vector GetAllRunsCopy( vector* runOffsets ) const; - virtual IVirtualConstructor* New() const; - virtual IVirtualConstructor* Clone() const; - void AddProperty( short sprm, void* operand ); - void AddProperty( const Prl& prl ); - void AddProperties( const vector& prls ); - void AddOrReplaceProperties( const vector& prls ); - void RemoveProperty( short sprm, void* operand ); - void RemovePropertyByCode( unsigned short sprm ); - void RemoveAllProperties(); - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/RunItem.h b/ASCOfficeDocFile_old/DocxDocConverter/RunItem.h deleted file mode 100644 index 70014f7589..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/RunItem.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "IRunItem.h" -#include "../Common/Aggregat.h" - -namespace ASCDocFileFormat -{ - class RunItem : public Aggregat - { - public: - RunItem() : Aggregat() - { - } - - explicit RunItem(const IRunItem& oRunItem) : Aggregat(static_cast(oRunItem.Clone())) - { - - } - - RunItem(const RunItem& oRunItem) - { - if (NULL != oRunItem.m_item.operator->()) - { - m_item.reset( static_cast(oRunItem.m_item->Clone())); - } - } - - RunItem& operator = (const RunItem& oRunItem) - { - if (m_item.operator->() != oRunItem.m_item.operator->()) - { - m_item.reset(static_cast(oRunItem.m_item->Clone())); - } - - return *this; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/SHDOperand.h b/ASCOfficeDocFile_old/DocxDocConverter/SHDOperand.h deleted file mode 100644 index 5cde3ca7bd..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/SHDOperand.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "COLORREF.h" - -namespace ASCDocFileFormat -{ - class Shd: public IOperand - { - private: - COLORREF cvFore; - COLORREF cvBack; - //!!!TODO!!! - unsigned short ipat; - - static const unsigned char SIZE_IN_BYTES = 10; - - unsigned char bytes[SIZE_IN_BYTES]; - - public: - Shd(): - cvFore(), cvBack(), ipat(0) - { - memcpy( this->bytes, this->cvFore, this->cvFore.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() ), (unsigned char*)this->cvBack, this->cvBack.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() + this->cvBack.Size() ), (unsigned char*)(&this->ipat), sizeof(this->ipat) ); - } - - explicit Shd( const COLORREF& _cvFore, const COLORREF& _cvBack, unsigned short _ipat ): - cvFore(_cvFore), cvBack(_cvBack), ipat(_ipat) - { - memcpy( this->bytes, this->cvFore, this->cvFore.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() ), (unsigned char*)this->cvBack, this->cvBack.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() + this->cvBack.Size() ), (unsigned char*)(&this->ipat), sizeof(this->ipat) ); - } - - Shd( const Shd& _shd ): - cvFore(_shd.cvFore), cvBack(_shd.cvBack), ipat(_shd.ipat) - { - memcpy( this->bytes, this->cvFore, this->cvFore.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() ), (unsigned char*)this->cvBack, this->cvBack.Size() ); - memcpy( ( this->bytes + this->cvFore.Size() + this->cvBack.Size() ), (unsigned char*)(&this->ipat), sizeof(this->ipat) ); - } - - virtual ~Shd() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; - - class SHDOperand: public IOperand - { - private: - static const unsigned char cb = 10; - Shd shd; - - unsigned char bytes[SHDOperand::cb + 1]; - - public: - SHDOperand(): - shd() - { - this->bytes[0] = SHDOperand::cb; - memcpy( ( this->bytes + sizeof(SHDOperand::cb) ), (unsigned char*)this->shd, this->shd.Size() ); - } - - explicit SHDOperand( const Shd& _shd ): - shd(_shd) - { - this->bytes[0] = SHDOperand::cb; - memcpy( ( this->bytes + sizeof(SHDOperand::cb) ), (unsigned char*)this->shd, this->shd.Size() ); - } - - SHDOperand( const SHDOperand& _shdOperand ): - shd(_shdOperand.shd) - { - this->bytes[0] = SHDOperand::cb; - memcpy( ( this->bytes + sizeof(SHDOperand::cb) ), (unsigned char*)this->shd, this->shd.Size() ); - } - - virtual ~SHDOperand() - { - } - - virtual operator unsigned char*() const - { - return (unsigned char*)this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return sizeof(this->bytes); - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/STSH.h b/ASCOfficeDocFile_old/DocxDocConverter/STSH.h deleted file mode 100644 index 271aab45db..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/STSH.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LPStshi.h" -#include "LPStd.h" - -namespace ASCDocFileFormat -{ - static const char StyleIDs[159][20] = - { - "Normal", - "Heading1", - "Heading2", - "Heading3", - "Heading4", - "Heading5", - "Heading6", - "Heading7", - "Heading8", - "Heading9", - "Index1", - "Index2", - "Index3", - "Index4", - "Index5", - "Index6", - "Index7", - "Index8", - "Index9", - "TOC1", - "TOC2", - "TOC3", - "TOC4", - "TOC5", - "TOC6", - "TOC7", - "TOC8", - "TOC9", - "NormalIndent", - "FootnoteText", - "AnnotationText", - "Header", - "Footer", - "IndexHeading", - "Caption", - "ToCaption", - "EnvelopeAddress", - "EnvelopeReturn", - "FootnoteReference", - "AnnotationReference", - "LineNumber", - "PageNumber", - "EndnoteReference", - "EndnoteText", - "TableOfAuthoring", - "Macro", - "TOAHeading", - "List", - "ListBullet", - "ListNumber", - "List2", - "List3", - "List4", - "List5", - "ListBullet2", - "ListBullet3", - "ListBullet4", - "ListBullet5", - "ListNumber2", - "ListNumber3", - "ListNumber4", - "ListNumber5", - "Title", - "Closing", - "Signature", - "NormalCharacter", - "BodyText", - "BodyTextIndent", - "ListContinue", - "ListContinue2", - "ListContinue3", - "ListContinue4", - "ListContinue5", - "MessageHeader", - "Subtitle", - "Salutation", - "Date", - "BodyText1I", - "BodyText1I2", - "NoteHeading", - "BodyText2", - "BodyText3", - "BodyTextIndent2", - "BodyTextIndent3", - "BlockQuote", - "Hyperlink", - "FollowedHyperlink", - "Strong", - "Emphasis", - "NavPane", - "PlainText", - "AutoSignature", - "FormTop", - "FormBottom", - "HtmlNormal", - "HtmlAcronym", - "HtmlAddress", - "HtmlCite", - "HtmlCode", - "HtmlDfn", - "HtmlKbd", - "HtmlPre", - "htmlSamp", - "HtmlTt", - "HtmlVar", - "TableNormal", - "AnnotationSubject", - "NormalList", - "OutlineList1", - "OutlineList2", - "OutlineList3", - "TableSimple", - "TableSimple2", - "TableSimple3", - "TableClassic1", - "TableClassic2", - "TableClassic3", - "TableClassic4", - "TableColorful1", - "TableColorful2", - "TableColorful3", - "TableColumns1", - "TableColumns2", - "TableColumns3", - "TableColumns4", - "TableColumns5", - "TableGrid1", - "TableGrid2", - "TableGrid3", - "TableGrid4", - "TableGrid5", - "TableGrid6", - "TableGrid7", - "TableGrid8", - "TableList1", - "TableList2", - "TableList3", - "TableList4", - "TableList5", - "TableList6", - "TableList7", - "TableList8", - "Table3DFx1", - "Table3DFx2", - "Table3DFx3", - "TableContemporary", - "TableElegant", - "TableProfessional", - "TableSubtle1", - "tableSubtle2", - "TableWeb1", - "TableWeb2", - "TableWeb3", - "Acetate", - "TableGrid", - "TableTheme", - "Max", - "User", - "Null" - }; - - class StyleID - { - public: - StyleID() : styleID(0x0FFE) - { - - } - - StyleID (unsigned short _styleID) : styleID(_styleID) - { - - } - - operator unsigned short() const - { - return styleID; - } - - operator short() const - { - return (short)styleID; - } - - private: - - unsigned short styleID; - }; - - class STSH : public IOperand - { - public: - STSH () : bytes(NULL), sizeInBytes(0) - { - } - - STSH (const LPStshi& lpstshi, const vector& rglpstd) : rglpstd(rglpstd), bytes(NULL), sizeInBytes(0) - { - sizeInBytes = lpstshi.Size(); - - for (vector::const_iterator iter = rglpstd.begin(); iter != rglpstd.end(); ++iter) - sizeInBytes += iter->Size(); - - bytes = new unsigned char[sizeInBytes]; - - if ( NULL != bytes ) - { - memset(bytes, 0, sizeInBytes); - memcpy(bytes, (unsigned char*)lpstshi, lpstshi.Size()); - - unsigned int lPStdOffset = 0; - - for (vector::const_iterator iter = rglpstd.begin(); iter != rglpstd.end(); ++iter) - { - memcpy( (bytes + lpstshi.Size() + lPStdOffset ), (unsigned char*)(*iter), iter->Size() ); - lPStdOffset += iter->Size(); - } - } - } - - STSH (const STSH& oSTSH) : rglpstd(oSTSH.rglpstd), bytes(NULL), sizeInBytes(oSTSH.sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - - if ( NULL != bytes ) - { - memset ( bytes, 0, sizeInBytes ); - memcpy ( bytes, oSTSH.bytes, sizeInBytes ); - } - } - - bool operator == (const STSH& oSTSH) - { - return ( ( sizeInBytes == oSTSH.sizeInBytes ) && ( memcmp( bytes, oSTSH.bytes, sizeInBytes ) == 0 ) ); - } - - bool operator != (const STSH& oSTSH) - { - return !( this->operator == ( oSTSH ) ); - } - - STSH& operator = (const STSH& oSTSH) - { - if (*this != oSTSH) - { - RELEASEARRAYOBJECTS(bytes); - - sizeInBytes = oSTSH.sizeInBytes; - rglpstd = oSTSH.rglpstd; - - bytes = new unsigned char[sizeInBytes]; - if (bytes) - memcpy (bytes, oSTSH.bytes, sizeInBytes ); - } - - return *this; - } - - virtual ~STSH() - { - RELEASEARRAYOBJECTS(bytes); - } - - inline const LPStd& operator [] (short istd) const - { - return rglpstd[istd]; - } - - unsigned int Count() const - { - return rglpstd.size(); - } - - virtual operator unsigned char*() const - { - return bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)bytes; - } - - virtual unsigned int Size() const - { - return sizeInBytes; - } - - private: - - vector rglpstd; - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/STSHI.h b/ASCOfficeDocFile_old/DocxDocConverter/STSHI.h deleted file mode 100644 index 6e33ff0af0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/STSHI.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Stshif.h" -#include "StshiLsd.h" -//!!!A structure that has no effect and MUST be ignored.!!! -#include "STSHIB.h" - -namespace ASCDocFileFormat -{ - class STSHI : public IOperand - { - public: - STSHI () : bytes(NULL), sizeInBytes(0) - { - - } - - STSHI (const Stshif& _stshif, short _ftcBi, const StshiLsd& _stshiLsd, const STSHIB& _stshiB /*!!!MUST be ignored!!!*/ ) : bytes(NULL), sizeInBytes(0) - { - sizeInBytes = ( _stshif.Size() + sizeof(_ftcBi) + _stshiLsd.Size() + _stshiB.Size() ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, (unsigned char*)_stshif, _stshif.Size() ); - FormatUtils::SetBytes( ( this->bytes + _stshif.Size() ), _ftcBi ); - memcpy( ( this->bytes + _stshif.Size() + sizeof(_ftcBi) ), (unsigned char*)_stshiLsd, _stshiLsd.Size() ); - memcpy( ( this->bytes + _stshif.Size() + sizeof(_ftcBi) + _stshiLsd.Size() ), (unsigned char*)_stshiB, _stshiB.Size() ); - } - } - - STSHI (const STSHI& oSTSHI) : bytes(NULL), sizeInBytes(oSTSHI.sizeInBytes) - { - bytes = new unsigned char[sizeInBytes]; - - if ( NULL != bytes ) - { - memset ( bytes, 0, sizeInBytes ); - memcpy ( bytes, oSTSHI.bytes, sizeInBytes ); - } - } - - virtual ~STSHI() - { - RELEASEARRAYOBJECTS(bytes); - } - - virtual operator unsigned char*() const - { - return bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)bytes; - } - - virtual unsigned int Size() const - { - return sizeInBytes; - } - - private: - - unsigned char* bytes; - unsigned int sizeInBytes; - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/STSHIB.h b/ASCOfficeDocFile_old/DocxDocConverter/STSHIB.h deleted file mode 100644 index 9298e524c5..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/STSHIB.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "LPStshiGrpPrl.h" - -//!!!A structure that has no effect and MUST be ignored.!!! - -namespace ASCDocFileFormat -{ - class STSHIB: public IOperand - { - private: - LPStshiGrpPrl grpprlChpStandard; - LPStshiGrpPrl grpprlPapStandard; - - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - STSHIB(): - grpprlChpStandard(), grpprlPapStandard(), bytes(NULL), sizeInBytes(0) - { - } - - explicit STSHIB( const LPStshiGrpPrl& _grpprlChpStandard, const LPStshiGrpPrl& _grpprlPapStandard ): - grpprlChpStandard(_grpprlChpStandard), grpprlPapStandard(_grpprlPapStandard), bytes(NULL), sizeInBytes(0) - { - this->sizeInBytes = ( grpprlChpStandard.Size() + grpprlPapStandard.Size() ); - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, (unsigned char*)(this->grpprlChpStandard), this->grpprlChpStandard.Size() ); - memcpy( ( this->bytes + this->grpprlChpStandard.Size() ), (unsigned char*)(this->grpprlPapStandard), this->grpprlPapStandard.Size() ); - } - } - - STSHIB( const STSHIB& _stshib ): - grpprlChpStandard(_stshib.grpprlChpStandard), grpprlPapStandard(_stshib.grpprlPapStandard), bytes(NULL), sizeInBytes(_stshib.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - memcpy( this->bytes, _stshib.bytes, this->sizeInBytes ); - } - } - - virtual ~STSHIB() - { - RELEASEARRAYOBJECTS( bytes ); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/STTB.h b/ASCOfficeDocFile_old/DocxDocConverter/STTB.h deleted file mode 100644 index cd3c5c153b..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/STTB.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Constants.h" - -namespace ASCDocFileFormat -{ - class EmptyExtraData - { - public: - unsigned int Size() const - { - return 0; - } - - operator unsigned char*() const - { - return (unsigned char*)NULL; - } - }; - - template class STTB: public IOperand - { - private: - unsigned char* bytes; - unsigned int sizeInBytes; - - public: - STTB() : bytes(NULL), sizeInBytes(0) - { - } - - explicit STTB( bool fExtend, const vector* _data, const vector* _extraData = NULL ) : bytes(NULL), sizeInBytes(0) - { - //!!!TODO!!! - if ( ( _data == NULL ) || ( ( _data != NULL ) && ( _extraData != NULL ) && ( _data->size() != _extraData->size() ) ) ) - { - return; - } - - if ( fExtend ) - { - this->sizeInBytes += sizeof(wchar_t); //fExtend - this->sizeInBytes += ( 2 * _data->size() ); //cchData - } - else - { - this->sizeInBytes += ( 1 * _data->size() ); //cchData - } - - for ( vector::const_iterator iter = _data->begin(); iter != _data->end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - - if ( _data->size() < 0xFFFF ) - { - this->sizeInBytes += sizeof(unsigned short); //cData - } - else - { - this->sizeInBytes += sizeof(int); //cData - } - - this->sizeInBytes += 2; //cbExtra - - if ( _extraData != NULL ) - { - for ( vector::const_iterator iter = _extraData->begin(); iter != _extraData->end(); iter++ ) - { - this->sizeInBytes += iter->Size(); - } - } - - this->bytes = new unsigned char[this->sizeInBytes]; - memset( this->bytes, 0, this->sizeInBytes ); - - unsigned int offset = 0; - - if ( fExtend ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (short)(0xFFFF) ); - offset += sizeof(short); - } - - if ( _data->size() < 0xFFFF ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (short)(_data->size()) ); - offset += sizeof(unsigned short); - } - else - { - FormatUtils::SetBytes( ( this->bytes + offset ), (int)(_data->size()) ); - offset += sizeof(int); - } - - if ( _extraData != NULL ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (unsigned short)(_extraData->front().Size()) ); - } - else - { - FormatUtils::SetBytes( ( this->bytes + offset ), (unsigned short)0 ); - } - - offset += sizeof(unsigned short); - - if ( fExtend ) - { - for ( unsigned int i = 0; i < _data->size(); i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (unsigned short)( _data->at( i ).Size() / 2 ) ); - offset += sizeof(unsigned short); - memcpy( ( this->bytes + offset ), (unsigned char*)(_data->at( i )), _data->at( i ).Size() ); - offset += _data->at( i ).Size(); - - if ( _extraData != NULL ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(_extraData->at( i )), _extraData->at( i ).Size() ); - offset += _extraData->at( i ).Size(); - } - } - } - else - { - for ( unsigned int i = 0; i < _data->size(); i++ ) - { - FormatUtils::SetBytes( ( this->bytes + offset ), (unsigned char)( _data->at( i ).Size()) ); - offset += sizeof(unsigned char); - memcpy( ( this->bytes + offset ), (unsigned char*)(_data->at( i )), _data->at( i ).Size() ); - offset += _data->at( i ).Size(); - - if ( _extraData != NULL ) - { - memcpy( ( this->bytes + offset ), (unsigned char*)(_extraData->at( i )), _extraData->at( i ).Size() ); - offset += _extraData->at( i ).Size(); - } - } - } - } - - STTB( const STTB& _sttb ) : bytes(NULL), sizeInBytes(_sttb.sizeInBytes) - { - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memset( this->bytes, 0, this->sizeInBytes ); - - memcpy( this->bytes, _sttb.bytes, this->sizeInBytes ); - } - } - - bool operator == ( const STTB& _sttb ) - { - return ( ( this->sizeInBytes == _sttb.sizeInBytes ) && - ( memcmp( this->bytes, _sttb.bytes, this->sizeInBytes ) == 0 ) ); - } - - bool operator != ( const STTB& _sttb ) - { - return !( this->operator == ( _sttb ) ); - } - - STTB& operator = ( const STTB& _sttb ) - { - if ( *this != _sttb ) - { - RELEASEARRAYOBJECTS (bytes); - - this->sizeInBytes = _sttb.sizeInBytes; - - this->bytes = new unsigned char[this->sizeInBytes]; - - if ( this->bytes != NULL ) - { - memcpy( this->bytes, _sttb.bytes, this->sizeInBytes ); - } - } - - return *this; - } - - virtual ~STTB() - { - RELEASEARRAYOBJECTS( bytes ); - } - - virtual operator unsigned char*() const - { - return this->bytes; - } - - virtual operator const unsigned char*() const - { - return (const unsigned char*)this->bytes; - } - - virtual unsigned int Size() const - { - return this->sizeInBytes; - } - }; -} \ No newline at end of file diff --git a/ASCOfficeDocFile_old/DocxDocConverter/SectionBreak.h b/ASCOfficeDocFile_old/DocxDocConverter/SectionBreak.h deleted file mode 100644 index 38fc6c77f0..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/SectionBreak.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "ITextItem.h" -#include "../Common/TextMark.h" - -namespace ASCDocFileFormat -{ - class SectionBreak: public ITextItem - { - private: - static const wchar_t sectionBreakText = TextMark::PageBreakOrSectionMark; - - public: - SectionBreak() - { - } - - SectionBreak( const SectionBreak& _sectionBreak ) - { - } - - virtual ~SectionBreak() - { - } - - virtual wstring GetAllText() const - { - wstring allText; - - allText.push_back( sectionBreakText ); - - return allText; - } - - virtual operator wstring() const - { - wstring allText; - - allText.push_back( sectionBreakText ); - - return allText; - } - - virtual vector GetAllParagraphsCopy() const - { - vector allParagraphsCopy; - - allParagraphsCopy.push_back( TextItemPtr( reinterpret_cast( NULL ) ) ); - - return allParagraphsCopy; - } - - virtual vector GetAllParagraphs() - { - vector allParagraphs; - - allParagraphs.push_back( NULL ); - - return allParagraphs; - } - - virtual vector GetAllParagraphsProperties( vector* allParagraphsOffsets ) const - { - vector allParagraphsProperties; - - if ( allParagraphsOffsets != NULL ) - { - allParagraphsProperties.push_back( PapxInFkp() ); - allParagraphsOffsets->push_back( 0 ); - } - - return allParagraphsProperties; - } - - virtual vector GetAllRunProperties( vector* allRunsOffsets ) const - { - vector AllChpx; - - if ( allRunsOffsets != NULL ) - { - AllChpx.push_back( Chpx() ); - - allRunsOffsets->push_back( 0 ); - } - - return AllChpx; - } - - virtual vector GetAllRunsCopy( vector* allRunsOffsets ) const - { - vector allRuns; - - if ( allRunsOffsets != NULL ) - { - wstring text; - - text.push_back( sectionBreakText ); - - allRuns.push_back( IParagraphItemPtr( dynamic_cast(Run( Text( text.c_str() ) ).Clone()) ) ); - allRunsOffsets->push_back( 0 ); - } - - return allRuns; - } - - virtual vector GetAllParagraphItemsCopy (vector* allParagraphItemsOffsets) const - { - vector allParagraphItems; - - if ( allParagraphItemsOffsets != NULL ) - { - wstring text; - - text.push_back( sectionBreakText ); - - allParagraphItems.push_back( IParagraphItemPtr( dynamic_cast(Run( Text( text.c_str() ) ).Clone()) ) ); - allParagraphItemsOffsets->push_back( 0 ); - } - - return allParagraphItems; - } - - virtual IVirtualConstructor* New() const - { - return new SectionBreak(); - } - - virtual IVirtualConstructor* Clone() const - { - return new SectionBreak( *this ); - } - }; -} diff --git a/ASCOfficeDocFile_old/DocxDocConverter/SectionProperties.h b/ASCOfficeDocFile_old/DocxDocConverter/SectionProperties.h deleted file mode 100644 index ee3ba59829..0000000000 --- a/ASCOfficeDocFile_old/DocxDocConverter/SectionProperties.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "Sepx.h" -#include "Header.h" -#include "Footer.h" - -namespace ASCDocFileFormat -{ - class SectionProperties - { - public: - explicit SectionProperties(const Sepx& _sepx) : sepx(_sepx) - { - SetEvenPageHeader(Header()); - SetOddPageHeader(Header()); - SetEvenPageFooter(Footer()); - SetOddPageFooter(Footer()); - SetFirstPageHeader(Header()); - SetFirstPageFooter(Footer()); - } - - SectionProperties(const SectionProperties& sp) : sepx(sp.sepx) - { - if (sp.evenPageHeader.IsInit()) SetEvenPageHeader(sp.evenPageHeader.as
()); - if (sp.oddPageHeader.IsInit()) SetOddPageHeader(sp.oddPageHeader.as
()); - if (sp.evenPageFooter.IsInit()) SetEvenPageFooter(sp.evenPageFooter.as