mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
53 Commits
v5.3.0.153
...
v5.3.3.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 4894639c09 | |||
| 3727c2e982 | |||
| a5122a6a47 | |||
| c9330ee0f1 | |||
| 2214362426 | |||
| bf600c6eb0 | |||
| 0db6728463 | |||
| 09c43b1179 | |||
| 390ab3bcc8 | |||
| 075f70c220 | |||
| 6abf1613ec | |||
| 0abc21d4ee | |||
| 7a7cdab770 | |||
| 7ae3c6f2ea | |||
| 35bd2803a4 | |||
| e7bf661432 | |||
| 635265eaa2 | |||
| 7636ff79cc | |||
| ed1019a004 | |||
| 35c4d70cf5 | |||
| 0b987aeed2 | |||
| aefb229343 | |||
| eb9d69d1ec | |||
| 9670d021c2 | |||
| 79f18355fe | |||
| f86055c713 | |||
| ea82bea6f1 | |||
| 28f5b1251a | |||
| 39fbf06511 | |||
| 0821edca07 | |||
| bc4faa26b9 | |||
| 668a89bbd1 | |||
| 2d21d334cf | |||
| b23bc97fdb | |||
| f4df80ebf3 | |||
| 230c51689d | |||
| 1d25f72ac9 | |||
| 9bfb0321b2 | |||
| 6c1bdc6ff8 | |||
| 826be463f5 | |||
| 29bb606d04 | |||
| 8f8995cbe7 | |||
| fb1ae2c79a | |||
| 0f4d594248 | |||
| 152d05d5a5 | |||
| 942767eb79 | |||
| 5c070f0475 | |||
| 17c68ae414 | |||
| ab45804644 | |||
| 4cca54900d | |||
| b66ed403e1 | |||
| 428b5971e8 | |||
| 564b7f9c29 |
@ -769,18 +769,15 @@ namespace DocFileFormat
|
||||
|
||||
return bytes;
|
||||
}
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
static inline std::wstring IntToWideString(unsigned int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
|
||||
static inline std::wstring IntToWideString(int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
#endif
|
||||
static inline std::wstring IntToWideString(size_t value)
|
||||
}
|
||||
static inline std::wstring SizeTToWideString(size_t value)
|
||||
{
|
||||
return (std::to_wstring((unsigned int)value));
|
||||
}
|
||||
|
||||
@ -94,11 +94,11 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
@ -140,7 +140,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
@ -169,7 +169,7 @@ namespace DocFileFormat
|
||||
|
||||
//start num
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i + 1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(i + 1));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int index = FindIndexbyId( rglst->listData, lfo->lsid );
|
||||
@ -205,12 +205,12 @@ namespace DocFileFormat
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -285,7 +285,7 @@ namespace DocFileFormat
|
||||
newResult = find_if((result + 1), lvl->xst.end(), &NumberingMapping::IsPlaceholder);
|
||||
|
||||
ret += L"%";
|
||||
ret += FormatUtils::IntToWideString(*result + 1);
|
||||
ret += FormatUtils::SizeTToWideString(*result + 1);
|
||||
ret += std::wstring((result + 1), newResult);
|
||||
result = newResult;
|
||||
}
|
||||
|
||||
@ -85,19 +85,19 @@ namespace DocFileFormat
|
||||
|
||||
struct ImageFileStructure
|
||||
{
|
||||
ImageFileStructure()
|
||||
ImageFileStructure(const std::wstring& _ext, boost::shared_array<unsigned char> _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ImageFileStructure(const std::wstring& _ext, const std::vector<unsigned char>& _data, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), blipType(_blipType)
|
||||
ImageFileStructure(const std::wstring& _ext, unsigned char* _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
data = boost::shared_array<unsigned char>(new unsigned char[size]);
|
||||
memcpy(data.get(), _data, size);
|
||||
}
|
||||
|
||||
std::wstring ext;
|
||||
std::vector<unsigned char> data;
|
||||
Global::BlipType blipType;
|
||||
std::wstring ext;
|
||||
boost::shared_array<unsigned char> data;
|
||||
unsigned int size;
|
||||
Global::BlipType blipType;
|
||||
};
|
||||
|
||||
struct OleObjectFileStructure
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "PictureDescriptor.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#ifndef MM_ISOTROPIC
|
||||
#define MM_ISOTROPIC 7
|
||||
#endif
|
||||
@ -41,6 +43,111 @@
|
||||
#define MM_ANISOTROPIC 8
|
||||
#endif
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
int offset = 0, biSizeImage = 0;
|
||||
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
|
||||
if (header_core->bcSize != 12)
|
||||
{
|
||||
result = Global::msoblipWMF;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 12; //sizeof(BITMAPCOREHEADER)
|
||||
|
||||
oFrame.put_Height (header_core->bcHeight );
|
||||
oFrame.put_Width (header_core->bcWidth );
|
||||
|
||||
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
|
||||
|
||||
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
|
||||
// header_core->bcWidth++;
|
||||
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
|
||||
|
||||
int stride = -(size - offset) / header_core->bcHeight;
|
||||
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
|
||||
|
||||
biSizeImage = size - offset;
|
||||
|
||||
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 40; //sizeof(BITMAPINFOHEADER)
|
||||
|
||||
oFrame.put_Height (header->biHeight );
|
||||
oFrame.put_Width (header->biWidth );
|
||||
|
||||
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
if (result == Global::msoblipPNG)
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
|
||||
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
|
||||
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
namespace DocFileFormat
|
||||
{
|
||||
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
|
||||
|
||||
@ -134,3 +134,34 @@ namespace DocFileFormat
|
||||
int embeddedDataSize;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
{
|
||||
_UINT32 biSize;
|
||||
_INT32 biWidth;
|
||||
_INT32 biHeight;
|
||||
_UINT16 biPlanes;
|
||||
_UINT16 biBitCount;
|
||||
_UINT32 biCompression;
|
||||
_UINT32 biSizeImage;
|
||||
_INT32 biXPelsPerMeter;
|
||||
_INT32 biYPelsPerMeter;
|
||||
_UINT32 biClrUsed;
|
||||
_UINT32 biClrImportant;
|
||||
};
|
||||
|
||||
struct __BITMAPCOREHEADER
|
||||
{
|
||||
_UINT32 bcSize; /* used to get to color table */
|
||||
_UINT16 bcWidth;
|
||||
_UINT16 bcHeight;
|
||||
_UINT16 bcPlanes;
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name);
|
||||
}
|
||||
|
||||
|
||||
@ -557,10 +557,10 @@ namespace DocFileFormat
|
||||
pict->embeddedDataSize += lLenHeader;
|
||||
delete []pict->embeddedData;
|
||||
pict->embeddedData = newData;
|
||||
|
||||
}
|
||||
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
pict->embeddedData, pict->embeddedDataSize, Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
@ -577,26 +577,44 @@ namespace DocFileFormat
|
||||
if (metaBlip)
|
||||
{//decompress inside MetafilePictBlip
|
||||
unsigned char *newData = NULL;
|
||||
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
|
||||
RELEASEARRAYOBJECTS(newData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
unsigned int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
boost::shared_array<unsigned char> arData(newData);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), arData, newDataSize));
|
||||
}
|
||||
}break;
|
||||
case Global::msoblipDIB:
|
||||
{//user_manual_v52.doc
|
||||
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
oBlipEntry->btWin32 = ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name);
|
||||
|
||||
if (oBlipEntry->btWin32 == Global::msoblipPNG)
|
||||
{
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlipEntry->btWin32));
|
||||
}
|
||||
}break;
|
||||
|
||||
|
||||
@ -1293,7 +1293,7 @@ namespace DocFileFormat
|
||||
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
bool VMLShapeMapping::copyPicture(const BlipStoreEntry* oBlip)
|
||||
bool VMLShapeMapping::copyPicture(BlipStoreEntry* oBlip)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
@ -1304,9 +1304,9 @@ namespace DocFileFormat
|
||||
|
||||
switch (oBlip->btWin32)
|
||||
{
|
||||
case Global::msoblipEMF:
|
||||
case Global::msoblipWMF:
|
||||
case Global::msoblipPICT:
|
||||
case Global::msoblipEMF:
|
||||
case Global::msoblipWMF:
|
||||
case Global::msoblipPICT:
|
||||
{
|
||||
//it's a meta image
|
||||
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(RecordFactory::ReadRecord(&reader, 0));
|
||||
@ -1314,38 +1314,53 @@ namespace DocFileFormat
|
||||
{
|
||||
//meta images can be compressed
|
||||
unsigned char* decompressed = NULL;
|
||||
int decompressedSize = 0;
|
||||
unsigned int decompressedSize = 0;
|
||||
|
||||
decompressedSize = metaBlip->Decompress(&decompressed);
|
||||
|
||||
if (0 != decompressedSize && NULL != decompressed)
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), std::vector<unsigned char>(decompressed, (decompressed + decompressedSize))));
|
||||
RELEASEARRAYOBJECTS(decompressed);
|
||||
boost::shared_array<unsigned char> arDecompressed(decompressed);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), arDecompressed, decompressedSize));
|
||||
}
|
||||
|
||||
RELEASEOBJECT(metaBlip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{
|
||||
//it's a bitmap image
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{//it's a bitmap image
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(RecordFactory::ReadRecord(&reader, 0));
|
||||
if ((bitBlip) && (bitBlip->m_pvBits))
|
||||
{
|
||||
if (oBlip->btWin32 == Global::msoblipDIB)
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
|
||||
if (Global::msoblipPNG == ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name))
|
||||
{
|
||||
oBlip->btWin32 = Global::msoblipPNG;
|
||||
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
}
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32));
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlip->btWin32));
|
||||
RELEASEOBJECT (bitBlip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result = false;
|
||||
return result;
|
||||
|
||||
@ -80,7 +80,7 @@ namespace DocFileFormat
|
||||
void WriteShape (const ShapeContainer* pContainer);
|
||||
|
||||
std::wstring GenShapeId(const Shape* pShape) const;
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
bool copyPicture( BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
void AppendDimensionToStyle ( std::wstring& style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "WordprocessingDocument.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
@ -40,136 +39,6 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
{
|
||||
_UINT32 biSize;
|
||||
_INT32 biWidth;
|
||||
_INT32 biHeight;
|
||||
_UINT16 biPlanes;
|
||||
_UINT16 biBitCount;
|
||||
_UINT32 biCompression;
|
||||
_UINT32 biSizeImage;
|
||||
_INT32 biXPelsPerMeter;
|
||||
_INT32 biYPelsPerMeter;
|
||||
_UINT32 biClrUsed;
|
||||
_UINT32 biClrImportant;
|
||||
};
|
||||
|
||||
struct __BITMAPCOREHEADER
|
||||
{
|
||||
_UINT32 bcSize; /* used to get to color table */
|
||||
_UINT16 bcWidth;
|
||||
_UINT16 bcHeight;
|
||||
_UINT16 bcPlanes;
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
int offset = 0, biSizeImage = 0;
|
||||
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
|
||||
if (header_core->bcSize != 12)
|
||||
{
|
||||
result = Global::msoblipWMF;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 12; //sizeof(BITMAPCOREHEADER)
|
||||
|
||||
oFrame.put_Height (header_core->bcHeight );
|
||||
oFrame.put_Width (header_core->bcWidth );
|
||||
|
||||
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
|
||||
|
||||
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
|
||||
// header_core->bcWidth++;
|
||||
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
|
||||
|
||||
int stride = -(size - offset) / header_core->bcHeight;
|
||||
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
|
||||
|
||||
biSizeImage = size - offset;
|
||||
|
||||
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 40; //sizeof(BITMAPINFOHEADER)
|
||||
|
||||
oFrame.put_Height (header->biHeight );
|
||||
oFrame.put_Width (header->biWidth );
|
||||
|
||||
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
if (result == Global::msoblipPNG)
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
|
||||
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
|
||||
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
WordprocessingDocument::WordprocessingDocument(const std::wstring & _pathOutput, const WordDocument* _docFile) :
|
||||
@ -275,24 +144,7 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<ImageFileStructure>::iterator iter = ImagesList.begin(); iter != ImagesList.end(); ++iter)
|
||||
{
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[iter->data.size()];
|
||||
if (bytes)
|
||||
{
|
||||
copy(iter->data.begin(), iter->data.end(), bytes);
|
||||
|
||||
if (Global::msoblipDIB == iter->blipType)
|
||||
{//user_manual_v52.doc
|
||||
std::wstring file_name = pathMedia + FILE_SEPARATOR_STR + L"image" + FormatUtils::IntToWideString(i++);
|
||||
iter->blipType = ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)bytes, (unsigned int)iter->data.size());
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(bytes);
|
||||
}
|
||||
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)iter->data.get(), iter->size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +63,9 @@ public:
|
||||
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
|
||||
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -82,6 +82,11 @@ bool read_doc_element::read_sax( xml::sax * Reader )
|
||||
}
|
||||
break;
|
||||
case xml::typeWhitespace:
|
||||
{
|
||||
const std::wstring value = Reader->value();
|
||||
add_space(value);
|
||||
}
|
||||
break;
|
||||
case xml::typeText:
|
||||
{
|
||||
const std::wstring value = Reader->value();
|
||||
|
||||
@ -1464,7 +1464,7 @@ void docx_conversion_context::end_text_list_style()
|
||||
text_list_style_name_ = L"";
|
||||
}
|
||||
|
||||
const std::wstring & docx_conversion_context::get_text_list_style_name()
|
||||
std::wstring docx_conversion_context::get_text_list_style_name()
|
||||
{
|
||||
return text_list_style_name_;
|
||||
}
|
||||
@ -1490,9 +1490,9 @@ void docx_conversion_context::end_list()
|
||||
list_style_stack_.pop_back();
|
||||
}
|
||||
|
||||
const std::wstring docx_conversion_context::current_list_style() const
|
||||
std::wstring docx_conversion_context::current_list_style()
|
||||
{
|
||||
if (!list_style_stack_.empty())
|
||||
if (false == list_style_stack_.empty())
|
||||
return list_style_stack_.back();
|
||||
else
|
||||
return L"";
|
||||
@ -1545,6 +1545,93 @@ int docx_conversion_context::process_text_attr(odf_reader::text::paragraph_attrs
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
return 1;
|
||||
}
|
||||
int docx_conversion_context::process_paragraph_style(const std::wstring & style_name)
|
||||
{
|
||||
if (style_name.empty()) return 0;
|
||||
|
||||
if (odf_reader::style_instance * styleInst =
|
||||
root()->odf_context().styleContainer().style_by_name(style_name, odf_types::style_family::Paragraph, process_headers_footers_))
|
||||
{
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
//office_element_ptr parent_tab_stops_;
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
{
|
||||
std::wstring parent_name = parentStyleContent->name();
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
|
||||
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
|
||||
{
|
||||
table_content_context_.set_current_level(parent_name);
|
||||
}
|
||||
}
|
||||
|
||||
start_automatic_style(id);
|
||||
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
|
||||
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
|
||||
if (properties.style_writing_mode_)
|
||||
{
|
||||
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
|
||||
switch(type)
|
||||
{
|
||||
case odf_types::writing_mode::RlTb:
|
||||
case odf_types::writing_mode::TbRl:
|
||||
case odf_types::writing_mode::Rl:
|
||||
set_rtl(true);
|
||||
break;
|
||||
default:
|
||||
set_rtl(false);
|
||||
}
|
||||
}
|
||||
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
|
||||
|
||||
styleContent->docx_convert(*this);
|
||||
|
||||
end_automatic_style();
|
||||
|
||||
//push_text_properties(styleContent->get_style_text_properties());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_attrs *Attr)
|
||||
{
|
||||
if (!Attr) return 0;
|
||||
@ -1565,22 +1652,22 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
if (odf_reader::style_instance * styleInst =
|
||||
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
|
||||
)
|
||||
{
|
||||
{
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
//office_element_ptr parent_tab_stops_;
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
{
|
||||
std::wstring parent_name = parentStyleContent->name();
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
|
||||
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
|
||||
{
|
||||
@ -1588,7 +1675,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
}
|
||||
}
|
||||
|
||||
start_automatic_style(id);
|
||||
start_automatic_style(id);
|
||||
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
@ -1614,10 +1701,10 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
set_outline_level(*Attr->outline_level_ - 1);
|
||||
}
|
||||
styleContent->docx_convert(*this);
|
||||
|
||||
|
||||
end_automatic_style();
|
||||
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
@ -1633,6 +1720,8 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
//process_paragraph_style(Context.get_current_paragraph_style()); ??
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
@ -1652,58 +1741,58 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
//todooo причесать
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
&& (get_process_note() == oox::docx_conversion_context::noNote)
|
||||
&& !in_drawing)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
//todooo причесать
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
&& (get_process_note() == oox::docx_conversion_context::noNote)
|
||||
&& !in_drawing)
|
||||
{
|
||||
if (is_paragraph_header() )
|
||||
{
|
||||
if (is_paragraph_header() )
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
output_stream() << L"<w:pPr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
output_stream() << L"<w:pPr>";
|
||||
}
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
else
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
|
||||
}
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
|
||||
}
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@ -1754,28 +1843,27 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
|
||||
}
|
||||
void docx_conversion_context::serialize_list_properties(std::wostream & strm)
|
||||
{
|
||||
if (!list_style_stack_.empty())
|
||||
if (list_style_stack_.empty()) return;
|
||||
|
||||
if (first_element_list_item_)
|
||||
{
|
||||
if (first_element_list_item_)
|
||||
{
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
{
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
CP_XML_NODE(L"w:ilvl")
|
||||
{
|
||||
CP_XML_NODE(L"w:ilvl")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
|
||||
}
|
||||
CP_XML_NODE(L"w:numId")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", id );
|
||||
}
|
||||
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
|
||||
}
|
||||
CP_XML_NODE(L"w:numId")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", id );
|
||||
}
|
||||
}
|
||||
first_element_list_item_ = false;
|
||||
}
|
||||
}
|
||||
first_element_list_item_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -829,6 +829,7 @@ public:
|
||||
bool process_page_properties(std::wostream & strm);
|
||||
void process_section (std::wostream & strm, odf_reader::style_columns * columns = NULL);
|
||||
|
||||
int process_paragraph_style (const std::wstring & style_name);
|
||||
int process_paragraph_attr (odf_reader::text::paragraph_attrs *attr);
|
||||
int process_text_attr (odf_reader::text::paragraph_attrs *Attr);
|
||||
void process_page_break_after(const odf_reader::style_instance *styleInst);
|
||||
@ -872,8 +873,8 @@ public:
|
||||
void start_text_list_style (const std::wstring & StyleName);
|
||||
void end_text_list_style ();
|
||||
|
||||
const std::wstring & get_text_list_style_name();
|
||||
const std::wstring current_list_style () const;
|
||||
std::wstring get_text_list_style_name();
|
||||
std::wstring current_list_style();
|
||||
|
||||
void start_list (const std::wstring & StyleName, bool Continue = false);
|
||||
void end_list ();
|
||||
@ -926,6 +927,10 @@ public:
|
||||
NoteType get_process_note () const { return current_process_note_; }
|
||||
void add_note_reference ();
|
||||
|
||||
void start_paragraph_style(const std::wstring& style_name) {paragraph_style_stack_.push_back(style_name);}
|
||||
void end_paragraph_style() { if (!paragraph_style_stack_.empty()) paragraph_style_stack_.pop_back();}
|
||||
std::wstring get_current_paragraph_style() {return paragraph_style_stack_.empty() ? L"" : paragraph_style_stack_.back();}
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
void start_chart(std::wstring name);
|
||||
void end_chart ();
|
||||
@ -950,7 +955,7 @@ public:
|
||||
|
||||
headers_footers & get_headers_footers() { return headers_footers_; }
|
||||
header_footer_context & get_header_footer_context() { return header_footer_context_; }
|
||||
drop_cap_context & get_drop_cap_context() {return drop_cap_context_;}
|
||||
drop_cap_context & get_drop_cap_context() { return drop_cap_context_; }
|
||||
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
@ -1016,8 +1021,8 @@ private:
|
||||
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
|
||||
std::wstring text_list_style_name_;
|
||||
std::vector<std::wstring> paragraph_style_stack_;
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
std::vector<std::wstring> fields_names_stack_;
|
||||
|
||||
|
||||
@ -151,7 +151,6 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
break;
|
||||
case odf_types::style_wrap::Left:
|
||||
case odf_types::style_wrap::Right:
|
||||
case odf_types::style_wrap::Dynamic:
|
||||
serialize_wrap_square(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::RunThrough:
|
||||
@ -160,6 +159,7 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
case odf_types::style_wrap::None:
|
||||
serialize_wrap_top_bottom(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::Dynamic:
|
||||
default:
|
||||
CP_XML_NODE(L"wp:wrapTopAndBottom");
|
||||
break;
|
||||
|
||||
@ -74,6 +74,10 @@ void abstract_xml::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
xml_content_.push_back( elm );
|
||||
}
|
||||
|
||||
void abstract_xml::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
xml_content_.push_back( elm );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,19 +46,17 @@ public:
|
||||
static const ElementType type = type_AbstractXml;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual std::wostream & xml_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
public:
|
||||
abstract_xml() {};
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
office_element_ptr_array xml_content_;
|
||||
};
|
||||
|
||||
|
||||
@ -324,10 +324,6 @@ void draw_text_box::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void draw_text_box::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// draw:object
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_object::ns = L"draw";
|
||||
|
||||
@ -271,7 +271,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_text_box);
|
||||
|
||||
@ -1451,7 +1451,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool bImage = false;
|
||||
if (content_.empty() == false)
|
||||
{
|
||||
if (content_[0]->get_type() == typeDrawImage)
|
||||
if (content_[0]->get_type() == typeDrawImage || content_[0]->get_type() == typeDrawObject || content_[0]->get_type() == typeDrawObjectOle )
|
||||
bImage = true;
|
||||
}
|
||||
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() && !bImage)
|
||||
|
||||
@ -224,7 +224,11 @@ void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & At
|
||||
}
|
||||
void presentation_footer_decl::add_text(const std::wstring & text)
|
||||
{
|
||||
text_ = text;
|
||||
text_ += text;
|
||||
}
|
||||
void presentation_footer_decl::add_space(const std::wstring & text)
|
||||
{
|
||||
text_ += text;
|
||||
}
|
||||
void presentation_footer_decl::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
@ -242,7 +246,11 @@ void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr &
|
||||
}
|
||||
void presentation_date_time_decl::add_text(const std::wstring & text)
|
||||
{
|
||||
text_ = text;
|
||||
text_ += text;
|
||||
}
|
||||
void presentation_date_time_decl::add_space(const std::wstring & text)
|
||||
{
|
||||
text_ += text;
|
||||
}
|
||||
void presentation_date_time_decl::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -104,6 +104,7 @@ public:
|
||||
std::wstring text_;
|
||||
|
||||
private:
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
@ -131,6 +132,7 @@ public:
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
private:
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
@ -52,9 +52,12 @@ std::wostream & svg_desc::text_to_stream(std::wostream & _Wostream, bool bXmlEnc
|
||||
|
||||
void svg_desc::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_ = Text;
|
||||
text_ += Text;
|
||||
}
|
||||
void svg_desc::add_space(const std::wstring & Text)
|
||||
{
|
||||
text_ += Text;
|
||||
}
|
||||
|
||||
// svg:font-face-uri
|
||||
//---------------------------------------------------------------------------------------
|
||||
const wchar_t * svg_font_face_uri::ns = L"svg";
|
||||
@ -80,9 +83,6 @@ void svg_font_face_uri::add_child_element( xml::sax * Reader, const std::wstring
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void svg_font_face_uri::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
// svg:font-face-format
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * svg_font_face_format::ns = L"svg";
|
||||
@ -103,9 +103,6 @@ void svg_font_face_format::add_child_element( xml::sax * Reader, const std::wstr
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void svg_font_face_format::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
// svg:font-face-name
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * svg_font_face_name::ns = L"svg";
|
||||
@ -126,9 +123,6 @@ void svg_font_face_name::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void svg_font_face_name::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -77,7 +77,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_uri);
|
||||
|
||||
@ -100,6 +99,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_desc);
|
||||
|
||||
@ -121,7 +121,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_format);
|
||||
|
||||
@ -142,7 +141,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);
|
||||
|
||||
|
||||
@ -75,7 +75,11 @@ void note_citation::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void note_citation::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
void note_citation::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
@ -113,6 +117,11 @@ void note_body::add_text(const std::wstring & Text)
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void note_body::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
void note_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
oox::StreamsManPtr prev = Context.get_stream_man();
|
||||
|
||||
@ -50,22 +50,20 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextNoteCitation;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
public:
|
||||
note_citation() {}
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
std::wstring text_label_;
|
||||
office_element_ptr_array content_;
|
||||
std::wstring text_label_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -81,19 +79,18 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextNoteBody;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
public:
|
||||
note_body() {}
|
||||
|
||||
note_body() {}
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -184,9 +184,7 @@ void number_style_base::add_child_element( xml::sax * Reader, const std::wstring
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
}
|
||||
void number_style_base::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// number:number-style
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * number_number_style::ns = L"number";
|
||||
@ -211,7 +209,11 @@ void number_text::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
|
||||
void number_text::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
// number:embedded-text
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * number_embedded_text::ns = L"number";
|
||||
@ -232,6 +234,11 @@ void number_embedded_text::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
void number_embedded_text::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
void number_embedded_text::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
}
|
||||
@ -261,10 +268,6 @@ void number_number::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void number_number::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// number:scientific-number
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * number_scientific_number::ns = L"number";
|
||||
@ -304,7 +307,10 @@ void number_currency_symbol::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_.push_back(Text);
|
||||
}
|
||||
|
||||
void number_currency_symbol::add_space(const std::wstring & Text)
|
||||
{
|
||||
text_.push_back(Text);
|
||||
}
|
||||
void number_currency_symbol::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -342,7 +348,11 @@ void number_text_content::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
|
||||
void number_text_content::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
text_.push_back( elm );
|
||||
}
|
||||
void number_text_content::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
}
|
||||
@ -443,9 +453,6 @@ void number_day::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_day::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
void number_day::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -475,9 +482,6 @@ void number_day_of_week::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_day_of_week::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_day_of_week::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
@ -508,10 +512,6 @@ void number_quarter::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void number_quarter::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_quarter::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -544,9 +544,7 @@ void number_month::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_month::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_month::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -589,9 +587,7 @@ void number_year::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_year::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_year::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -630,9 +626,6 @@ void number_hours::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_hours::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_hours::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
@ -663,9 +656,7 @@ void number_minutes::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_minutes::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_minutes::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -696,9 +687,7 @@ void number_seconds::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_seconds::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_seconds::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -732,9 +721,7 @@ void number_am_pm::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_am_pm::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_am_pm::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -760,9 +747,7 @@ void number_fraction::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void number_fraction::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_fraction::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
@ -786,10 +771,6 @@ void number_fraction::oox_convert(oox::num_format_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
void number_scientific_number::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void number_scientific_number::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
|
||||
@ -58,8 +58,9 @@ public:
|
||||
std::wstring get_style_name() const;
|
||||
|
||||
private:
|
||||
virtual void add_text(const std::wstring &);
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element (xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
odf_types::common_data_style_attlist common_data_style_attlist_;
|
||||
|
||||
@ -182,12 +183,12 @@ public:
|
||||
virtual void oox_convert (oox::num_format_context & Context) = 0;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
|
||||
virtual void add_text (const std::wstring &) = 0;
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -210,6 +211,7 @@ private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
office_element_ptr_array text_;
|
||||
};
|
||||
@ -234,7 +236,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
// number-number-attlist
|
||||
_CP_OPT(std::wstring) number_decimal_replacement_;
|
||||
@ -272,6 +275,7 @@ private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(int) number_position_;
|
||||
office_element_ptr_array text_;
|
||||
@ -297,16 +301,13 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
private:
|
||||
// number-scientific-number-attlist
|
||||
_CP_OPT(int) number_min_exponent_digits_;
|
||||
|
||||
// common-decimal-places-attlist
|
||||
_CP_OPT(int) number_decimal_places_;
|
||||
|
||||
// common-number-attlist
|
||||
_CP_OPT(int) number_min_integer_digits_;
|
||||
_CP_OPT(bool) number_grouping_;
|
||||
|
||||
@ -333,6 +334,7 @@ private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_language_;
|
||||
_CP_OPT(std::wstring) number_country_;
|
||||
@ -362,6 +364,7 @@ private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
office_element_ptr_array text_;
|
||||
|
||||
@ -387,7 +390,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -414,7 +418,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -441,7 +446,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -467,7 +473,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(bool) number_textual_;
|
||||
_CP_OPT(bool) number_possessive_form_;
|
||||
@ -496,7 +503,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -518,15 +526,13 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
|
||||
|
||||
void oox_convert(oox::num_format_context & Context);
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
public:
|
||||
void oox_convert(oox::num_format_context & Context);
|
||||
|
||||
private:
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
|
||||
@ -551,7 +557,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -578,7 +585,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(int) number_decimal_places_;
|
||||
@ -606,7 +614,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(number_am_pm);
|
||||
@ -629,7 +638,8 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
virtual void add_text (const std::wstring & Text) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
|
||||
_CP_OPT(int) number_min_integer_digits_;
|
||||
_CP_OPT(bool) number_grouping_;
|
||||
|
||||
@ -94,10 +94,7 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void content_xml_t::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,8 +59,9 @@ public:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
virtual void add_text(const std::wstring & Text) {}
|
||||
virtual void add_space(const std::wstring & Text) {}
|
||||
|
||||
friend class odf_document;
|
||||
|
||||
office_element_ptr content_;
|
||||
|
||||
@ -75,11 +75,6 @@ void office_body::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void office_body::add_text(const std::wstring & Text)
|
||||
{
|
||||
// TODO : error
|
||||
}
|
||||
|
||||
void office_body::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_body();
|
||||
|
||||
@ -61,17 +61,15 @@ public:
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
public:
|
||||
office_body();
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
virtual void add_text(const std::wstring & Text) {}
|
||||
virtual void add_space(const std::wstring & Text) {}
|
||||
public:
|
||||
office_element_ptr content_;
|
||||
};
|
||||
|
||||
@ -82,10 +82,6 @@ void office_document_base::add_child_element( xml::sax * Reader, const std::wstr
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void office_document_base::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
void office_document_base::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (office_body_)
|
||||
|
||||
@ -47,18 +47,17 @@ public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
|
||||
office_document_base();
|
||||
|
||||
office_document_base();
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_text(const std::wstring & Text) {}
|
||||
virtual void add_space(const std::wstring & Text) {}
|
||||
|
||||
public:
|
||||
std::wstring office_mimetype_;
|
||||
@ -190,6 +189,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
@ -216,6 +216,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
@ -243,6 +244,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
@ -265,6 +267,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
@ -289,6 +292,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
@ -168,7 +168,9 @@ private:
|
||||
virtual void add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void add_space(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
// office_element impl
|
||||
public:
|
||||
virtual ElementType get_type() const
|
||||
|
||||
@ -57,9 +57,6 @@ void office_scripts::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void office_scripts::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// office:script
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -76,9 +73,5 @@ void office_script::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void office_script::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
@ -79,7 +78,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
std::wstring script_language_;
|
||||
|
||||
@ -125,6 +125,15 @@ std::wostream & text::text_to_stream(std::wostream & _Wostream, bool bXmlEncode)
|
||||
_Wostream << (bXmlEncode ? xml::utils::replace_text_to_xml( text_, true ) : text_);
|
||||
return _Wostream;
|
||||
}
|
||||
void text::add_space(const std::wstring & Text)
|
||||
{
|
||||
text_.reserve(Text.length());
|
||||
for (size_t i =0; i < Text.length(); i++)
|
||||
{
|
||||
if (Text[i] < 0x20) continue;
|
||||
text_ += Text[i];
|
||||
}
|
||||
}
|
||||
|
||||
void text::add_text(const std::wstring & Text)
|
||||
{
|
||||
@ -307,7 +316,7 @@ void line_break::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.finish_run();
|
||||
Context.finish_paragraph();
|
||||
Context.start_paragraph();
|
||||
|
||||
Context.process_paragraph_style(Context.get_current_paragraph_style());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -498,7 +507,11 @@ void span::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::create(Text);
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void span::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text);
|
||||
content_.push_back( elm );
|
||||
}
|
||||
void span::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
bool addNewRun = false;
|
||||
@ -603,7 +616,11 @@ void a::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void a::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text);
|
||||
content_.push_back( elm );
|
||||
}
|
||||
void a::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
bool pushed_style = false;
|
||||
@ -742,10 +759,6 @@ void note::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void note::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
void note::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
//см presentation:notes
|
||||
@ -835,12 +848,6 @@ void ruby::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void ruby::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// text:title
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * title::ns = L"text";
|
||||
|
||||
@ -93,7 +93,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ) {}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@ -276,7 +276,6 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@ -299,7 +298,6 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(reference_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@ -395,6 +393,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(span);
|
||||
@ -422,8 +421,9 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
odf_types::common_xlink_attlist xlink_attlist_;
|
||||
odf_types::common_xlink_attlist xlink_attlist_;
|
||||
|
||||
std::wstring office_name_;
|
||||
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
|
||||
@ -456,7 +456,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::wstring text_id_;
|
||||
odf_types::noteclass text_note_class_;
|
||||
@ -482,7 +481,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::wstring text_style_name_;
|
||||
office_element_ptr text_ruby_base_;
|
||||
|
||||
@ -73,12 +73,6 @@ void style_tab_stop::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
}
|
||||
|
||||
void style_tab_stop::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{}
|
||||
|
||||
void style_tab_stop::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
// style:tab-stop
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_tab_stops::ns = L"style";
|
||||
@ -117,12 +111,6 @@ void style_drop_cap::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
CP_APPLY_ATTR(L"style:style-name", style_style_name_);
|
||||
}
|
||||
|
||||
void style_drop_cap::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{}
|
||||
|
||||
void style_drop_cap::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
// style-background-image
|
||||
// style:background-image
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -158,9 +146,6 @@ void style_background_image::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
}
|
||||
|
||||
void style_background_image::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void paragraph_format_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
@ -95,8 +95,7 @@ public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
|
||||
public:
|
||||
odf_types::length style_position_;
|
||||
@ -136,6 +135,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
};
|
||||
|
||||
@ -160,8 +160,7 @@ public:
|
||||
_CP_OPT(std::wstring) style_style_name_;
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
|
||||
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
|
||||
|
||||
@ -183,8 +182,7 @@ public:
|
||||
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
|
||||
_CP_OPT(odf_types::style_repeat) style_repeat_;
|
||||
_CP_OPT(odf_types::style_position) style_position_;
|
||||
_CP_OPT(std::wstring) filter_name_;
|
||||
|
||||
@ -311,10 +311,6 @@ void default_style::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
void default_style::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_fill_image::ns = L"draw";
|
||||
const wchar_t * draw_fill_image::name = L"fill-image";
|
||||
@ -478,10 +474,6 @@ void style::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
|
||||
content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
void style::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// styles & draw_styles
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -579,9 +571,6 @@ void office_automatic_styles::add_child_element( xml::sax * Reader, const std::w
|
||||
}
|
||||
}
|
||||
|
||||
void office_automatic_styles::add_text(const std::wstring & Text)
|
||||
{}
|
||||
|
||||
// office:master-styles
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * office_master_styles::ns = L"office";
|
||||
@ -610,11 +599,6 @@ void office_master_styles::add_child_element( xml::sax * Reader, const std::wstr
|
||||
}
|
||||
}
|
||||
|
||||
void office_master_styles::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// office:styles
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * office_styles::ns = L"office";
|
||||
@ -1777,10 +1761,6 @@ void text_notes_configuration::add_child_element( xml::sax * Reader, const std::
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
void text_notes_configuration::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
/// style:presentation-page-layout
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_presentation_page_layout::ns = L"style";
|
||||
|
||||
@ -142,7 +142,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(default_style);
|
||||
@ -357,8 +356,7 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
|
||||
public:
|
||||
std::wstring style_name_;
|
||||
bool style_auto_update_; // default = false
|
||||
@ -452,7 +450,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_automatic_styles);
|
||||
@ -480,7 +477,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_master_styles);
|
||||
@ -1045,7 +1041,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
public:
|
||||
odf_types::noteclass noteclass_;
|
||||
|
||||
@ -186,6 +186,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ) {}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
virtual void add_text(const std::wstring & Text) {}
|
||||
virtual void add_space(const std::wstring & Text) {}
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
@ -542,6 +543,7 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ) {}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text) {}
|
||||
virtual void add_space(const std::wstring & Text) {}
|
||||
|
||||
static _CP_PTR(table_rows_no_group) create();
|
||||
|
||||
|
||||
@ -161,6 +161,11 @@ void paragraph::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
void paragraph::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
const wchar_t * emptyParagraphContent = L"<w:pPr></w:pPr><w:r><w:rPr></w:rPr></w:r>";
|
||||
|
||||
const wchar_t * emptyParagraphDrawing = L"<w:p><w:pPr></w:pPr></w:p>";
|
||||
@ -330,8 +335,10 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_drop_cap_context().state(1);//after
|
||||
Context.start_paragraph();
|
||||
Context.process_paragraph_style(Context.get_current_paragraph_style());
|
||||
|
||||
}
|
||||
Context.start_paragraph_style(styleName);
|
||||
|
||||
int textStyle = Context.process_paragraph_attr(&attrs_);
|
||||
|
||||
@ -396,6 +403,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (is_empty)
|
||||
Context.output_stream() << emptyParagraphContent;
|
||||
|
||||
Context.end_paragraph_style();
|
||||
Context.finish_paragraph();
|
||||
}
|
||||
|
||||
@ -508,6 +516,10 @@ void p::add_text(const std::wstring & Text)
|
||||
{
|
||||
paragraph_.add_text(Text);
|
||||
}
|
||||
void p::add_space(const std::wstring & Text)
|
||||
{
|
||||
paragraph_.add_space(Text);
|
||||
}
|
||||
|
||||
void p::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -561,11 +573,6 @@ void list::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
|
||||
}
|
||||
}
|
||||
|
||||
void list::add_text(const std::wstring & Text)
|
||||
{
|
||||
// TODO : false
|
||||
}
|
||||
|
||||
void list::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
bool continue_ = continue_numbering_.get_value_or(false);
|
||||
|
||||
@ -58,6 +58,7 @@ public:
|
||||
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
void add_text (const std::wstring & Text);
|
||||
void add_space (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) next_element_style_name; //for master page
|
||||
|
||||
@ -118,6 +119,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
// heading-attrs
|
||||
_CP_OPT(unsigned int) outline_level_;
|
||||
@ -155,6 +157,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(p);
|
||||
@ -179,7 +182,6 @@ public:
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::wstring style_name_;
|
||||
_CP_OPT(bool) continue_numbering_;
|
||||
|
||||
@ -959,11 +959,15 @@ void odf_drawing_context::end_shape()
|
||||
{
|
||||
double angle = *rotate;//impl_->current_drawing_state_.rotateAngle_ ? *impl_->current_drawing_state_.rotateAngle_ : 0;
|
||||
|
||||
line->draw_line_attlist_.svg_x1_ = *line->draw_line_attlist_.svg_x1_ / 2 - (*line->draw_line_attlist_.svg_x1_ / 2 * cos(-angle) - *line->draw_line_attlist_.svg_y1_ / 2 * sin(-angle) );
|
||||
line->draw_line_attlist_.svg_y1_ = *line->draw_line_attlist_.svg_y1_ / 2 - (*line->draw_line_attlist_.svg_x1_ / 2 * sin(-angle) + *line->draw_line_attlist_.svg_y1_ / 2 * cos(-angle) );
|
||||
if (line->draw_line_attlist_.svg_x1_)
|
||||
line->draw_line_attlist_.svg_x1_ = *line->draw_line_attlist_.svg_x1_ / 2 - (*line->draw_line_attlist_.svg_x1_ / 2 * cos(-angle) - *line->draw_line_attlist_.svg_y1_ / 2 * sin(-angle) );
|
||||
if (line->draw_line_attlist_.svg_y1_)
|
||||
line->draw_line_attlist_.svg_y1_ = *line->draw_line_attlist_.svg_y1_ / 2 - (*line->draw_line_attlist_.svg_x1_ / 2 * sin(-angle) + *line->draw_line_attlist_.svg_y1_ / 2 * cos(-angle) );
|
||||
|
||||
line->draw_line_attlist_.svg_x2_ = *line->draw_line_attlist_.svg_x2_ / 2 - (*line->draw_line_attlist_.svg_x2_ / 2 * cos(-angle) - *line->draw_line_attlist_.svg_y2_ / 2 * sin(-angle) );
|
||||
line->draw_line_attlist_.svg_y2_ = *line->draw_line_attlist_.svg_y2_ / 2 - (*line->draw_line_attlist_.svg_x2_ / 2 * sin(-angle) + *line->draw_line_attlist_.svg_y2_ / 2 * cos(-angle) );
|
||||
if (line->draw_line_attlist_.svg_x2_)
|
||||
line->draw_line_attlist_.svg_x2_ = *line->draw_line_attlist_.svg_x2_ / 2 - (*line->draw_line_attlist_.svg_x2_ / 2 * cos(-angle) - *line->draw_line_attlist_.svg_y2_ / 2 * sin(-angle) );
|
||||
if (line->draw_line_attlist_.svg_y2_)
|
||||
line->draw_line_attlist_.svg_y2_ = *line->draw_line_attlist_.svg_y2_ / 2 - (*line->draw_line_attlist_.svg_x2_ / 2 * sin(-angle) + *line->draw_line_attlist_.svg_y2_ / 2 * cos(-angle) );
|
||||
|
||||
line->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_= L"";
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#define MIN_SLIDE_TIME 5000.0
|
||||
|
||||
inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
|
||||
//inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
|
||||
@ -440,7 +440,7 @@ namespace Animations
|
||||
|
||||
virtual ~ParaBuildContainer()
|
||||
{
|
||||
for ( long i = 0; i < (long)rgParaBuildLevel.size(); ++i )
|
||||
for ( size_t i = 0; i < rgParaBuildLevel.size(); ++i )
|
||||
RELEASEOBJECT (rgParaBuildLevel[i]);
|
||||
}
|
||||
|
||||
@ -510,7 +510,7 @@ namespace Animations
|
||||
|
||||
virtual ~BuildListContainer()
|
||||
{
|
||||
for ( long i = 0; i < (long)rgChildRec.size(); ++i )
|
||||
for ( size_t i = 0; i < rgChildRec.size(); ++i )
|
||||
RELEASEOBJECT (rgChildRec[i]);
|
||||
}
|
||||
|
||||
@ -1051,7 +1051,7 @@ namespace Animations
|
||||
}
|
||||
void ClearNodes ()
|
||||
{
|
||||
for ( long i = 0; i < (long)m_arrElements.size(); ++i )
|
||||
for ( size_t i = 0; i < m_arrElements.size(); ++i )
|
||||
{
|
||||
RELEASEOBJECT ( m_arrElements[i] );
|
||||
}
|
||||
@ -1399,7 +1399,7 @@ namespace Animations
|
||||
|
||||
virtual bool IsCorrect () { return m_oHeader.RecVersion == 0xF && m_oHeader.RecInstance == 0x0 && m_oHeader.RecType == 0xF12A; }
|
||||
|
||||
inline long GetObjectID ()
|
||||
inline _UINT32 GetObjectID ()
|
||||
{
|
||||
return clientVisualElement.m_oVisualShapeAtom.m_nObjectIdRef;
|
||||
}
|
||||
@ -2481,13 +2481,13 @@ namespace Animations
|
||||
|
||||
RELEASEOBJECT(rgSlave);
|
||||
|
||||
for ( long i = 0; i < (long)rgExtTimeNodeChildren.size(); ++i )
|
||||
for ( size_t i = 0; i < rgExtTimeNodeChildren.size(); ++i )
|
||||
RELEASEOBJECT ( rgExtTimeNodeChildren[i] );
|
||||
|
||||
for ( long i = 0; i < (long)timeCondition.size(); ++i )
|
||||
for ( size_t i = 0; i < timeCondition.size(); ++i )
|
||||
RELEASEOBJECT ( timeCondition[i] );
|
||||
|
||||
for ( long i = 0; i < (long)rgTimeModifierAtom.size(); ++i )
|
||||
for ( size_t i = 0; i < rgTimeModifierAtom.size(); ++i )
|
||||
RELEASEOBJECT ( rgTimeModifierAtom[i] );
|
||||
}
|
||||
|
||||
@ -2714,7 +2714,7 @@ namespace Animations
|
||||
//
|
||||
inline TimeModifierAtom* GetModifier (long Type)
|
||||
{
|
||||
for ( long i = 0; i < (long)rgTimeModifierAtom.size(); ++i )
|
||||
for ( size_t i = 0; i < rgTimeModifierAtom.size(); ++i )
|
||||
if (rgTimeModifierAtom[i]->type == Type)
|
||||
return rgTimeModifierAtom[i];
|
||||
|
||||
@ -3008,7 +3008,7 @@ namespace Animations
|
||||
|
||||
inline long GetBuild (long nShapeID)
|
||||
{
|
||||
for ( long i = 0; i < (long)m_arrBuilds.size(); ++i )
|
||||
for ( size_t i = 0; i < m_arrBuilds.size(); ++i )
|
||||
{
|
||||
if (m_arrBuilds[i].m_nShapeID == nShapeID)
|
||||
return m_arrBuilds[i].m_nBuildType;
|
||||
@ -3023,7 +3023,7 @@ namespace Animations
|
||||
{
|
||||
if ( pContainer->buildList )
|
||||
{
|
||||
for ( long i = 0; i < (long)pContainer->buildList->rgChildRec.size(); ++i )
|
||||
for ( size_t i = 0; i < pContainer->buildList->rgChildRec.size(); ++i )
|
||||
m_arrBuilds.push_back(EffectBuild(pContainer->buildList->rgChildRec[i]->buildAtom.shapeIdRef, pContainer->buildList->rgChildRec[i]->paraBuildAtom.buildLevel) );
|
||||
|
||||
return true;
|
||||
@ -3193,7 +3193,7 @@ namespace Animations
|
||||
}
|
||||
|
||||
//
|
||||
inline void AddAnimation (ExtTimeNodeContainer* pTimeNode, long nID)
|
||||
inline void AddAnimation (ExtTimeNodeContainer* pTimeNode, int nID)
|
||||
{
|
||||
CalculateTimeEffect (pTimeNode);
|
||||
|
||||
@ -3407,9 +3407,9 @@ namespace Animations
|
||||
|
||||
if (MediaCallEffect == m_oTopEffect.m_nEffectType)
|
||||
{
|
||||
if ((long)pContainer->rgExtTimeNodeChildren.size())
|
||||
if (!pContainer->rgExtTimeNodeChildren.empty())
|
||||
{
|
||||
ExtTimeNodeContainer* pChild = pContainer->rgExtTimeNodeChildren[0];
|
||||
ExtTimeNodeContainer* pChild = pContainer->rgExtTimeNodeChildren[0];
|
||||
if (pChild)
|
||||
{
|
||||
if (pChild->timeNodeAtom.m_bDurationProperty)
|
||||
@ -3474,7 +3474,7 @@ namespace Animations
|
||||
|
||||
if (26 == m_oTopEffect.m_nEffectID)
|
||||
{
|
||||
if ((long)m_arDurations.size() && (long)m_arBeginTimes.size() )
|
||||
if (!m_arDurations.empty() && !m_arBeginTimes.empty() )
|
||||
m_dEffectDuration = m_arDurations.at(m_arDurations.size()-1) + m_arBeginTimes.at(m_arBeginTimes.size()-1);
|
||||
}
|
||||
|
||||
@ -3563,7 +3563,7 @@ namespace Animations
|
||||
m_oTopEffect.m_nTextSequence = container.clientVisualElement.m_oVisualShapeAtom.m_nData1; // номер параграфа - не нормальзован
|
||||
m_oTopEffect.m_bRemoveEmptyBlocks = true;
|
||||
|
||||
for (long i = 0; i < (long)m_arParIndexer.size(); ++i)
|
||||
for (size_t i = 0; i < m_arParIndexer.size(); ++i)
|
||||
{
|
||||
if (m_oTopEffect.m_nTextSequence == m_arParIndexer.at(i))
|
||||
return;
|
||||
@ -3575,7 +3575,7 @@ namespace Animations
|
||||
|
||||
inline bool UpdateParagraph ()
|
||||
{
|
||||
if ((long)m_arParIndexer.size())
|
||||
if (!m_arParIndexer.empty())
|
||||
{
|
||||
//ATLTRACE ( _T("====================PARAGRAPH==========================================\n"));
|
||||
//qsort ( m_arParIndexer.GetData(), m_arParIndexer.size(), sizeof (long), (int(*)(const void*, const void*))sort );
|
||||
@ -3587,12 +3587,12 @@ namespace Animations
|
||||
Effects* arEffects = pPair->second;
|
||||
if (arEffects)
|
||||
{
|
||||
for (long i = 0; i < (long)arEffects->size(); ++i)
|
||||
for (size_t i = 0; i < arEffects->size(); ++i)
|
||||
{
|
||||
Effect& oEffect = arEffects->at(i);
|
||||
if (oEffect.m_nTextSequence >= 0)
|
||||
{
|
||||
for (long ind = 0; ind < (long)m_arParIndexer.size(); ++ind)
|
||||
for (size_t ind = 0; ind < m_arParIndexer.size(); ++ind)
|
||||
{
|
||||
if (oEffect.m_nTextSequence == m_arParIndexer.at(ind))
|
||||
{
|
||||
@ -3646,7 +3646,7 @@ namespace Animations
|
||||
}
|
||||
}
|
||||
|
||||
for (long i = 0; i < (long)pContainer->rgExtTimeNodeChildren.size(); ++i )
|
||||
for (size_t i = 0; i < pContainer->rgExtTimeNodeChildren.size(); ++i )
|
||||
{
|
||||
if (GetMediaID(pContainer->rgExtTimeNodeChildren [i]))
|
||||
return true;
|
||||
@ -3668,7 +3668,7 @@ namespace Animations
|
||||
}
|
||||
}
|
||||
|
||||
for (long i = 0; i < (long)pContainer->rgExtTimeNodeChildren.size(); ++i )
|
||||
for (size_t i = 0; i < pContainer->rgExtTimeNodeChildren.size(); ++i )
|
||||
{
|
||||
if (CNodeTiming::AfterPreviousNode == pContainer->rgExtTimeNodeChildren [i]->GetEffectNodeType ()) // нод с описанием эффекта
|
||||
return false;
|
||||
@ -3704,20 +3704,20 @@ namespace Animations
|
||||
TimeArray m_arDurations;
|
||||
TimeArray m_arBeginTimes;
|
||||
|
||||
std::wstring m_ComposeEffectMothionPath;
|
||||
std::wstring m_ComposeEffectMothionPath;
|
||||
bool m_HaveAfterEffect;
|
||||
|
||||
EffectsMap m_oAnimation;
|
||||
CParagraphBuilds m_oParagraphBuilds;
|
||||
|
||||
std::vector <long> m_arParIndexer;
|
||||
std::vector <_INT32> m_arParIndexer;
|
||||
|
||||
// media
|
||||
int m_nMediaID;
|
||||
int m_nMediaShapeID;
|
||||
int m_nMediaPush; // глубина поиска
|
||||
|
||||
std::vector <int> m_arrMedia;
|
||||
std::vector <_INT32> m_arrMedia;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -199,13 +199,13 @@ CColor CPPTElement::CorrectSysColor(int nColorCode, CElementPtr pElement, CTheme
|
||||
}
|
||||
void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pWrapper, CSlide* pSlide, CProperties* pProperties)
|
||||
{
|
||||
long lCount = pProperties->m_lCount;
|
||||
size_t lCount = pProperties->m_lCount;
|
||||
switch (pElement->m_etType)
|
||||
{
|
||||
case PPT_FORMAT::etVideo:
|
||||
{
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
for (size_t i = 0; i < lCount; ++i)
|
||||
{
|
||||
SetUpPropertyVideo(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
|
||||
}
|
||||
@ -215,7 +215,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
|
||||
{
|
||||
pElement->m_oBrush.Type = c_BrushTypeTexture;
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
for (size_t i = 0; i < lCount; ++i)
|
||||
{
|
||||
SetUpPropertyImage(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
|
||||
}
|
||||
@ -224,7 +224,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
|
||||
case PPT_FORMAT::etAudio:
|
||||
{
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
for (size_t i = 0; i < lCount; ++i)
|
||||
{
|
||||
SetUpPropertyAudio(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
|
||||
}
|
||||
@ -234,7 +234,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
|
||||
{
|
||||
pElement->m_bLine = false;
|
||||
pElement->m_bIsFilled = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
for (size_t i = 0; i < lCount; ++i)
|
||||
{
|
||||
SetUpProperty(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
|
||||
}
|
||||
@ -249,7 +249,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
|
||||
pPPTShape->m_oCustomVML.SetAdjusts(&pPPTShape->m_arAdjustments);
|
||||
}
|
||||
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
for (size_t i = 0; i < lCount; ++i)
|
||||
{
|
||||
SetUpPropertyShape(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
|
||||
}
|
||||
@ -838,22 +838,22 @@ void CPPTElement::SetUpPropertyImage(CElementPtr pElement, CTheme* pTheme, CSlid
|
||||
}break;
|
||||
case cropFromTop:
|
||||
{
|
||||
image_element->m_lcropFromTop = pProperty->m_lValue;
|
||||
image_element->m_lcropFromTop = (_INT32)pProperty->m_lValue;
|
||||
image_element->m_bCropEnabled = true;
|
||||
}break;
|
||||
case cropFromBottom:
|
||||
{
|
||||
image_element->m_lcropFromBottom = pProperty->m_lValue;
|
||||
image_element->m_lcropFromBottom = (_INT32)pProperty->m_lValue;
|
||||
image_element->m_bCropEnabled = true;
|
||||
}break;
|
||||
case cropFromLeft:
|
||||
{
|
||||
image_element->m_lcropFromLeft = pProperty->m_lValue;
|
||||
image_element->m_lcropFromLeft = (_INT32)pProperty->m_lValue;
|
||||
image_element->m_bCropEnabled = true;
|
||||
}break;
|
||||
case cropFromRight:
|
||||
{
|
||||
image_element->m_lcropFromRight = pProperty->m_lValue;
|
||||
image_element->m_lcropFromRight = (_INT32)pProperty->m_lValue;
|
||||
image_element->m_bCropEnabled = true;
|
||||
}break;
|
||||
case pibFlags:
|
||||
|
||||
@ -1818,7 +1818,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
std::wstring strCoord1 = oNodeShape.GetAttributeOrValue(L"from");
|
||||
std::wstring strCoord2 = oNodeShape.GetAttributeOrValue(L"to");
|
||||
|
||||
if (strCoord1 != L"" && strCoord2 != L"")
|
||||
if (!strCoord1.empty() && !strCoord2.empty())
|
||||
{
|
||||
std::vector<std::wstring> oArray1;
|
||||
boost::algorithm::split(oArray1, strCoord1, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
@ -1905,7 +1905,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
int nOffsetX = _POINTS[0] - _x;
|
||||
int nOffsetY = _POINTS[1] - _y;
|
||||
|
||||
strStyleAdvenced = L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
|
||||
strStyleAdvenced += L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
|
||||
+ L";width:" + std::to_wstring(_r - _x) + L";height:" + std::to_wstring(_b - _y) + L";polyline_correct:true;";
|
||||
|
||||
double dKoefX = 21600.0 / (std::max)((_r - _x), 1);
|
||||
@ -3302,6 +3302,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
|
||||
std::map<std::wstring, std::wstring>::iterator pFind;
|
||||
|
||||
bool bIsInline = false;
|
||||
bool bIsMargin = false;
|
||||
|
||||
if (oProps.IsTop == true)
|
||||
{
|
||||
@ -3312,12 +3313,19 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
|
||||
{
|
||||
bIsInline = true;
|
||||
}
|
||||
|
||||
if (((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-left")) &&
|
||||
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-top")))
|
||||
||
|
||||
((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"left")) &&
|
||||
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"top"))))
|
||||
{
|
||||
bIsMargin = true;
|
||||
}
|
||||
pFind = oCssStyles.m_mapSettings.find(L"mso-position-horizontal-relative");
|
||||
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"char"))
|
||||
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"char"))
|
||||
{
|
||||
pFind = oCssStyles.m_mapSettings.find(L"mso-position-vertical-relative");
|
||||
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"line"))
|
||||
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"line"))
|
||||
{
|
||||
bIsInline = true;
|
||||
}
|
||||
@ -3355,7 +3363,13 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
|
||||
|
||||
if (oCssStyles.m_mapSettings.end() != pFind)
|
||||
{
|
||||
left = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
|
||||
std::vector<std::wstring> oArray1;
|
||||
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < oArray1.size(); i++)
|
||||
{
|
||||
left += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
pFind = oCssStyles.m_mapSettings.find(L"margin-top");
|
||||
@ -3365,7 +3379,12 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
|
||||
|
||||
if (oCssStyles.m_mapSettings.end() != pFind)
|
||||
{
|
||||
top = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
|
||||
std::vector<std::wstring> oArray1;
|
||||
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
for (size_t i = 0; i < oArray1.size(); i++)
|
||||
{
|
||||
top += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -293,10 +293,10 @@ namespace PPT_FORMAT
|
||||
|
||||
bool m_bCropEnabled;
|
||||
|
||||
long m_lcropFromRight;
|
||||
long m_lcropFromLeft;
|
||||
long m_lcropFromTop;
|
||||
long m_lcropFromBottom;
|
||||
_INT32 m_lcropFromRight;
|
||||
_INT32 m_lcropFromLeft;
|
||||
_INT32 m_lcropFromTop;
|
||||
_INT32 m_lcropFromBottom;
|
||||
|
||||
bool m_bStretch;
|
||||
bool m_bTile;
|
||||
|
||||
@ -173,7 +173,7 @@ public:
|
||||
std::vector<CProperty> m_arProperties;
|
||||
// по идее - это instance, но нам так удобнее,
|
||||
// тем более это класс - не связанный с RecordHeader
|
||||
long m_lCount;
|
||||
size_t m_lCount;
|
||||
|
||||
CProperties() : m_arProperties()
|
||||
{
|
||||
@ -187,7 +187,7 @@ public:
|
||||
void FromStream(POLE::Stream* pStream, long lCount)
|
||||
{
|
||||
m_lCount = lCount;
|
||||
for (long lIndex = 0; lIndex < m_lCount; ++lIndex)
|
||||
for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex)
|
||||
{
|
||||
CProperty elem;
|
||||
m_arProperties.push_back(elem);
|
||||
@ -195,7 +195,7 @@ public:
|
||||
}
|
||||
// теперь читаем дополнительную информацию
|
||||
// сортировано по pid'ам (но у нас пока просто по-порядку)
|
||||
for (long lIndex = 0; lIndex < m_lCount; ++lIndex)
|
||||
for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex)
|
||||
{
|
||||
m_arProperties[lIndex].ComplexFromStream(pStream);
|
||||
}
|
||||
@ -205,7 +205,7 @@ public:
|
||||
_UINT32 GetLen()
|
||||
{
|
||||
_UINT32 dwLen = 6 * m_lCount;
|
||||
for (long nIndex = 0; nIndex < m_lCount; ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_lCount; ++nIndex)
|
||||
{
|
||||
if (m_arProperties[nIndex].m_bComplex)
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ namespace PPTX
|
||||
XmlMacroReadNodeValueBase(oNode, _T("cp:revision"), revision);
|
||||
XmlMacroReadNodeValueBase(oNode, _T("dc:subject"), subject);
|
||||
XmlMacroReadNodeValueBase(oNode, _T("dc:title"), title);
|
||||
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), title);
|
||||
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), version);
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
|
||||
{
|
||||
@ -217,7 +217,7 @@ namespace PPTX
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteNodeValue2(_T("dc:title"), title);
|
||||
pWriter->WriteNodeValue2(_T("dc:subject"), title);
|
||||
pWriter->WriteNodeValue2(_T("dc:subject"), subject);
|
||||
pWriter->WriteNodeValue2(_T("dc:creator"), creator);
|
||||
pWriter->WriteNodeValue2(_T("cp:keywords"), keywords);
|
||||
pWriter->WriteNodeValue2(_T("dc:description"), description);
|
||||
@ -242,9 +242,9 @@ namespace PPTX
|
||||
pWriter->WriteStringXML(*modified);
|
||||
pWriter->WriteNodeEnd(_T("dcterms:modified"));
|
||||
}
|
||||
pWriter->WriteNodeValue2(_T("cp:category"), revision);
|
||||
pWriter->WriteNodeValue2(_T("cp:contentStatus"), revision);
|
||||
pWriter->WriteNodeValue2(_T("cp:version"), revision);
|
||||
pWriter->WriteNodeValue2(_T("cp:category"), category);
|
||||
pWriter->WriteNodeValue2(_T("cp:contentStatus"), contentStatus);
|
||||
pWriter->WriteNodeValue2(_T("cp:version"), version);
|
||||
|
||||
pWriter->EndNode(_T("cp:coreProperties"));
|
||||
}
|
||||
|
||||
@ -410,7 +410,6 @@ HEADERS += pptxformatlib.h \
|
||||
../../../PPTXFormat/Logic/TextListStyle.h \
|
||||
../../../PPTXFormat/Logic/TextParagraphPr.h \
|
||||
../../../PPTXFormat/Logic/TextSpacing.h \
|
||||
../../../PPTXFormat/Logic/Timing.h \
|
||||
../../../PPTXFormat/Logic/TxBody.h \
|
||||
../../../PPTXFormat/Logic/TxStyles.h \
|
||||
../../../PPTXFormat/Logic/UniColor.h \
|
||||
|
||||
@ -26,15 +26,15 @@ if not exist "%folder%" (
|
||||
md %folder%\shared
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\shared\"
|
||||
)
|
||||
|
||||
@ -54,14 +54,20 @@ if not exist "%folder%" (
|
||||
md %folder%\shared
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\shared\"
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
|
||||
@ -4,7 +4,7 @@ CD /D %~dp0
|
||||
if exist "%SCRIPTPATH%boost_1_58_0.7z" (
|
||||
echo "boost already downloaded"
|
||||
) else (
|
||||
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
|
||||
)
|
||||
|
||||
SET UNSIP_PROGRAMM="C:\Program Files\7-Zip\7z.exe"
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
BOOST_URL=https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -12,21 +11,11 @@ case "$os" in
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
if [[ -f "$SCRIPTPATH/7zX_1.7.1.dmg" ]]
|
||||
then
|
||||
echo "7z already downloaded"
|
||||
else
|
||||
wget http://static.updatestar.net/dl/7zX/7zX_1.7.1.dmg
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f "$SCRIPTPATH/boost_1_58_0.7z" ]]
|
||||
then
|
||||
echo "boost already downloaded"
|
||||
else
|
||||
wget http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
wget $BOOST_URL || curl -O $BOOST_URL
|
||||
fi
|
||||
|
||||
if [ -d "$SCRIPTPATH/boost_1_58_0" ]; then
|
||||
@ -36,8 +25,6 @@ if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
7z x -y "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
else
|
||||
hdiutil mount "$SCRIPTPATH/7zX_1.7.1.dmg"
|
||||
/Volumes/7zX/7zX.app/Contents/Resources/7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
hdiutil unmount /Volumes/7zX
|
||||
7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,18 +1,9 @@
|
||||
@echo off
|
||||
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
SET PLATFORM=win_32
|
||||
if defined ProgramFiles(x86) (
|
||||
SET PLATFORM=win_64
|
||||
)
|
||||
|
||||
if defined TARGET (
|
||||
SET PLATFORM=%TARGET%
|
||||
)
|
||||
|
||||
mkdir "%SCRIPTPATH%%PLATFORM%"
|
||||
cd "%SCRIPTPATH%%PLATFORM%"
|
||||
|
||||
Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%PLATFORM%/cef_binary.7z cef_binary.7z cef_binary
|
||||
setlocal
|
||||
|
||||
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
|
||||
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
|
||||
@ -20,11 +11,48 @@ if exist %UNSIP_PROGRAMM2% (
|
||||
SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
|
||||
)
|
||||
|
||||
if exist "cef_binary" (
|
||||
echo "cef_binary.7z already extracted"
|
||||
) else (
|
||||
call %UNSIP_PROGRAMM% x "cef_binary.7z"
|
||||
mkdir build
|
||||
xcopy /Y /S cef_binary\Release\* build\
|
||||
xcopy /Y /S cef_binary\Resources\* build\
|
||||
if defined BUILD_PLATFORM (
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32 winxp_64 winxp_32"
|
||||
GOTO :found
|
||||
)
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32"
|
||||
GOTO :found
|
||||
)
|
||||
)
|
||||
|
||||
SET "BUILD_PLATFORMS=win_32"
|
||||
if defined ProgramFiles(x86) (
|
||||
SET "BUILD_PLATFORMS=win_64"
|
||||
GOTO :found
|
||||
)
|
||||
if defined TARGET (
|
||||
SET "BUILD_PLATFORMS=%TARGET%"
|
||||
GOTO :found
|
||||
)
|
||||
|
||||
echo "error"
|
||||
GOTO :end
|
||||
|
||||
:found
|
||||
for %%a in (%BUILD_PLATFORMS%) do (
|
||||
echo "platform: %%a"
|
||||
mkdir "%SCRIPTPATH%%%a"
|
||||
cd "%SCRIPTPATH%%%a"
|
||||
Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%%a/cef_binary.7z cef_binary.7z cef_binary
|
||||
|
||||
if exist "cef_binary" (
|
||||
echo "cef_binary.7z already extracted"
|
||||
) else (
|
||||
call %UNSIP_PROGRAMM% x "cef_binary.7z"
|
||||
mkdir build
|
||||
xcopy /Y /S cef_binary\Release\* build\
|
||||
xcopy /Y /S cef_binary\Resources\* build\
|
||||
)
|
||||
)
|
||||
|
||||
:end
|
||||
endlocal
|
||||
|
||||
@echo on
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -42,9 +40,10 @@ cef_version="3163"
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
cef_version="3202"
|
||||
fi
|
||||
|
||||
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform$arch/$cef_arch
|
||||
else
|
||||
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform/$cef_arch
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
@ -75,3 +74,15 @@ then
|
||||
cp -r -t build/ ./$cef_binary/Release/* ./$cef_binary/Resources/*
|
||||
chmod a+xr build/locales
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
if [ -d "build/Chromium Embedded Framework.framework" ]
|
||||
then
|
||||
echo "cef_binary already extracted"
|
||||
else
|
||||
wget $cef_url || curl -O $cef_url
|
||||
7za x $cef_arch
|
||||
mv "$cef_binary" "build/Chromium Embedded Framework.framework"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
SET MACHINE=x86
|
||||
if defined ProgramFiles(x86) (
|
||||
SET MACHINE=x64
|
||||
)
|
||||
|
||||
if "%TARGET%" == "win-32" (
|
||||
SET MACHINE=x86
|
||||
)
|
||||
|
||||
if "%TARGET%" == "win-64" (
|
||||
SET MACHINE=x64
|
||||
)
|
||||
|
||||
if "%MACHINE%" == "x86" (
|
||||
SET OUTPUT=win_32
|
||||
)
|
||||
|
||||
if "%MACHINE%" == "x64" (
|
||||
SET OUTPUT=win_64
|
||||
)
|
||||
|
||||
SET VC=%ProgramFiles%\Microsoft Visual Studio 12.0\VC
|
||||
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC
|
||||
if exist %VC64% (
|
||||
SET VC=%VC64%
|
||||
)
|
||||
|
||||
call "%VC%\vcvarsall.bat" %MACHINE%
|
||||
|
||||
cd curl
|
||||
call buildconf.bat
|
||||
cd winbuild
|
||||
nmake /f Makefile.vc mode=static ENABLE_WINSSL=yes MACHINE=%MACHINE% VC=12
|
||||
|
||||
if not exist "%SCRIPTPATH%%OUTPUT%" (
|
||||
md %SCRIPTPATH%%OUTPUT%\build
|
||||
xcopy /Y /S ..\builds\libcurl-vc12-%MACHINE%-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\
|
||||
move %SCRIPTPATH%%OUTPUT%\build\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\curl.lib
|
||||
)
|
||||
|
||||
cd ..\..
|
||||
@ -1,73 +0,0 @@
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
|
||||
case "$os" in
|
||||
Linux*)
|
||||
platform="linux"
|
||||
BUILD_PLATFORM=Linux
|
||||
;;
|
||||
Darwin*)
|
||||
platform="mac"
|
||||
BUILD_PLATFORM=MacOSX
|
||||
;;
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
|
||||
architecture=$(uname -m)
|
||||
arch=""
|
||||
|
||||
case "$architecture" in
|
||||
x86_64*) arch="_64" ;;
|
||||
*) arch="_32" ;;
|
||||
esac
|
||||
|
||||
if [[ -d "$SCRIPTPATH/$platform$arch" ]]
|
||||
then
|
||||
echo
|
||||
else
|
||||
mkdir "$SCRIPTPATH/$platform$arch"
|
||||
fi
|
||||
|
||||
CURL_FOLDER=curl
|
||||
cd ${CURL_FOLDER}
|
||||
|
||||
if [[ ! -f configure ]]
|
||||
then
|
||||
./buildconf
|
||||
fi
|
||||
|
||||
if [[ ! -f Makefile ]]
|
||||
then
|
||||
./configure \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
--disable-ldap \
|
||||
--disable-sspi \
|
||||
--without-librtmp \
|
||||
--disable-ftp \
|
||||
--disable-file \
|
||||
--disable-dict \
|
||||
--disable-telnet \
|
||||
--disable-tftp \
|
||||
--disable-rtsp \
|
||||
--disable-pop3 \
|
||||
--disable-imap \
|
||||
--disable-smtp \
|
||||
--disable-gopher \
|
||||
--disable-smb \
|
||||
--without-libidn
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
if [ ! -d "$SCRIPTPATH/$platform$arch/build" ]
|
||||
then
|
||||
DESTDIR="$SCRIPTPATH/$platform$arch" make install
|
||||
mkdir -p "$SCRIPTPATH/$platform$arch/build"
|
||||
cp "$SCRIPTPATH/$platform$arch/usr/local/lib/libcurl.a" "$SCRIPTPATH/$platform$arch/build/"
|
||||
fi
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
core_linux {
|
||||
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/usr/local/include
|
||||
|
||||
LIBS += -lcurl
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
CD /D %~dp0
|
||||
SET CURL_FOLDER=curl
|
||||
IF NOT EXIST %CURL_FOLDER% CALL git clone https://github.com/curl/curl.git %CURL_FOLDER%
|
||||
CD %CURL_FOLDER%
|
||||
CALL git fetch
|
||||
CALL git checkout curl-7_54_1
|
||||
CD ..
|
||||
@ -1,8 +0,0 @@
|
||||
CURL_FOLDER=curl
|
||||
if [ ! -d ${CURL_FOLDER} ]; then
|
||||
git clone https://github.com/curl/curl.git ${CURL_FOLDER}
|
||||
fi
|
||||
cd ${CURL_FOLDER}
|
||||
git fetch
|
||||
git checkout curl-7_54_1
|
||||
cd ..
|
||||
@ -1,64 +1,84 @@
|
||||
@echo off
|
||||
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
setlocal
|
||||
|
||||
SET ICU_MAJOR_VER=58
|
||||
SET ICU_MINOR_VER=2
|
||||
|
||||
SET build_platform=win_32
|
||||
if defined ProgramFiles(x86) (
|
||||
SET build_platform=win_64
|
||||
)
|
||||
|
||||
if defined TARGET (
|
||||
SET build_platform=%TARGET%
|
||||
)
|
||||
|
||||
if "%build_platform%" == "win_32" (
|
||||
SET MACHINE=x86
|
||||
)
|
||||
|
||||
if "%build_platform%" == "win_64" (
|
||||
SET MACHINE=x64
|
||||
)
|
||||
|
||||
if not exist "%build_platform%" (
|
||||
md "%build_platform%"
|
||||
)
|
||||
|
||||
if not exist "%build_platform%\build" (
|
||||
md "%build_platform%\build"
|
||||
)
|
||||
|
||||
cd "%SCRIPTPATH%%build_platform%"
|
||||
|
||||
if exist "%SCRIPTPATH%%build_platform%\icu\" (
|
||||
echo "icu already exported"
|
||||
) else (
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
|
||||
)
|
||||
|
||||
SET VC=%ProgramFiles%\Microsoft Visual Studio 14.0\VC
|
||||
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC
|
||||
if exist %VC64% (
|
||||
SET VC=%VC64%
|
||||
)
|
||||
|
||||
call "%VC%\vcvarsall.bat" %MACHINE%
|
||||
|
||||
if "%build_platform%" == "win_64" (
|
||||
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
|
||||
) else (
|
||||
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
|
||||
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
|
||||
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
|
||||
if exist %UNSIP_PROGRAMM2% (
|
||||
SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
|
||||
)
|
||||
|
||||
if "%build_platform%" == "win_64" (
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin64\icudt%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib64\icudt.lib" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib64\icuuc.lib" "%SCRIPTPATH%%build_platform%\build\"
|
||||
) else (
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin\icudt%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin\icuuc%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib\icudt.lib" "%SCRIPTPATH%%build_platform%\build\"
|
||||
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib\icuuc.lib" "%SCRIPTPATH%%build_platform%\build\"
|
||||
if defined BUILD_PLATFORM (
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32"
|
||||
GOTO :found
|
||||
)
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32"
|
||||
GOTO :found
|
||||
)
|
||||
)
|
||||
|
||||
SET "BUILD_PLATFORMS=win_32"
|
||||
if defined ProgramFiles(x86) (
|
||||
SET "BUILD_PLATFORMS=win_64"
|
||||
GOTO :found
|
||||
)
|
||||
if defined TARGET (
|
||||
SET "BUILD_PLATFORMS=%TARGET%"
|
||||
GOTO :found
|
||||
)
|
||||
|
||||
echo "error"
|
||||
GOTO :end
|
||||
|
||||
:found
|
||||
for %%a in (%BUILD_PLATFORMS%) do (
|
||||
cd "%SCRIPTPATH%"
|
||||
if not exist "%%a" (
|
||||
md "%%a"
|
||||
)
|
||||
if not exist "%%a\build" (
|
||||
md "%%a\build"
|
||||
)
|
||||
cd "%SCRIPTPATH%%%a"
|
||||
if exist "icu" (
|
||||
echo "icu already exported"
|
||||
) else (
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
|
||||
)
|
||||
|
||||
if "%%a" == "win_64" (
|
||||
call "%VC%\vcvarsall.bat" x64
|
||||
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
|
||||
XCOPY /Y "icu\bin64\icudt%ICU_MAJOR_VER%.dll" "build\"
|
||||
XCOPY /Y "icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "build\"
|
||||
XCOPY /Y "icu\lib64\icudt.lib" "build\"
|
||||
XCOPY /Y "icu\lib64\icuuc.lib" "build\"
|
||||
) else (
|
||||
call "%VC%\vcvarsall.bat" x86
|
||||
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
|
||||
XCOPY /Y "icu\bin\icudt%ICU_MAJOR_VER%.dll" "build\"
|
||||
XCOPY /Y "icu\bin\icuuc%ICU_MAJOR_VER%.dll" "build\"
|
||||
XCOPY /Y "icu\lib\icudt.lib" "build\"
|
||||
XCOPY /Y "icu\lib\icuuc.lib" "build\"
|
||||
)
|
||||
)
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
:end
|
||||
endlocal
|
||||
|
||||
@echo on
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
ICU_MAJOR_VER=58
|
||||
ICU_MINOR_VER=2
|
||||
@ -59,11 +57,19 @@ else
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
|
||||
fi
|
||||
|
||||
# Workaround for building icu older than 60.0
|
||||
# on systems without xlocale.h (removed from glibc since 2.26)
|
||||
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
|
||||
# See https://bugs.archlinux.org/task/55246
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
# Workaround for building icu older than 60.0
|
||||
# on systems without xlocale.h (removed from glibc since 2.26)
|
||||
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
|
||||
# See https://bugs.archlinux.org/task/55246
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
sed -i -e 's/cmd\, \"%s %s -o %s%s %s %s%s %s %s\"\,/cmd\, \"%s %s -o %s%s %s %s %s %s %s\"\,/' ./icu/source/tools/pkgdata/pkgdata.cpp
|
||||
fi
|
||||
|
||||
cd ./icu/source/
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
ICU_MAJOR_VER=62
|
||||
ICU_MINOR_VER=1
|
||||
|
||||
@ -14,7 +14,13 @@ FOR /f "tokens=*" %%i in ('DIR /a:d /b *') DO (
|
||||
ECHO %%i
|
||||
|
||||
if exist %%i/build.bat (
|
||||
call %%i/build.bat
|
||||
call %%i/build.bat || goto :error
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"/openssl
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -9,15 +9,25 @@ call powershell -File .\fix-static_crt.ps1
|
||||
cd v8
|
||||
|
||||
call gn gen out.gn/win_64/release --args="is_debug=false target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_64/release
|
||||
call ninja -C out.gn/win_64/release || goto :error
|
||||
|
||||
call gn gen out.gn/win_64/debug --args="is_debug=true target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_64/debug
|
||||
call ninja -C out.gn/win_64/debug || goto :error
|
||||
|
||||
call gn gen out.gn/win_32/release --args="is_debug=false target_cpu=\"x86\" v8_target_cpu=\"x86\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_32/release
|
||||
call ninja -C out.gn/win_32/release || goto :error
|
||||
|
||||
call gn gen out.gn/win_32/debug --args="is_debug=true target_cpu=\"x86\" v8_target_cpu=\"x86\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_32/debug
|
||||
call ninja -C out.gn/win_32/debug || goto :error
|
||||
|
||||
rem v8_use_snapshot=true v8_use_external_startup_data=true
|
||||
rem v8_use_snapshot=true v8_use_external_startup_data=true
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
call %~dp0v8_xp\build.bat || goto :error
|
||||
cd %~dp0
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -2,8 +2,7 @@
|
||||
|
||||
export PATH=`pwd`/depot_tools:"$PATH"
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -38,6 +37,7 @@ fi
|
||||
|
||||
if [[ "$platform" == "mac" ]]
|
||||
then
|
||||
sed -i -e "s/if (mac_sdk_version != mac_sdk_min_build_override/if (false \&\& mac_sdk_version != mac_sdk_min_build_override/g" build/config/mac/mac_sdk.gni
|
||||
# for new macOS!!!
|
||||
#sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
gn gen out.gn/mac_64 --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false v8_use_snapshot=false'
|
||||
|
||||
@ -24,3 +24,8 @@ call git checkout -b 6.0 -t branch-heads/6.0
|
||||
cd ../
|
||||
|
||||
call gclient sync --no-history
|
||||
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
call v8_xp\fetch.bat
|
||||
cd %~dp0
|
||||
)
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
export PATH=`pwd`/depot_tools:"$PATH"
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_6_bin\python\bin;%PATH%
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_13_chromium7_bin\python\bin;%PATH%
|
||||
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
SET GYP_MSVS_VERSION=2015
|
||||
|
||||
@ -27,8 +27,8 @@ if not exist "win_32" (
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
call devenv v8.sln /Rebuild "Release" || goto :error
|
||||
call devenv v8.sln /Rebuild "Debug" || goto :error
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
@ -51,8 +51,8 @@ if not exist "win_64" (
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
call devenv v8.sln /Rebuild "Release" || goto :error
|
||||
call devenv v8.sln /Rebuild "Debug" || goto :error
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
@ -62,3 +62,9 @@ if not exist "win_64" (
|
||||
XCOPY /Y "v8\build\Debug\lib\*" "win_64\debug\"
|
||||
XCOPY /Y "v8\build\Debug\icudt.dll" "win_64\debug\"
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -8,7 +8,7 @@ if exist "depot_tools" (
|
||||
call powershell -File .\fix-depot_tools.ps1
|
||||
)
|
||||
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\python276_bin;%PATH%
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_13_chromium7_bin\python\bin;%PATH%
|
||||
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
SET GYP_MSVS_VERSION=2015
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ namespace OOX
|
||||
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
|
||||
writer.WriteString(_T(" xml:space=\"preserve\""));
|
||||
writer.WriteString(_T(">"));
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteEncodeXmlStringHHHH(m_sText);
|
||||
writer.WriteString(_T("</t>"));
|
||||
}
|
||||
virtual void toXML2(NSStringUtils::CStringBuilder& writer, const wchar_t* name) const
|
||||
@ -71,7 +71,7 @@ namespace OOX
|
||||
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
|
||||
writer.WriteString(_T(" xml:space=\"preserve\""));
|
||||
writer.WriteString(_T(">"));
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteEncodeXmlStringHHHH(m_sText);
|
||||
writer.WriteString(_T("</"));
|
||||
writer.WriteString(name);
|
||||
writer.WriteString(_T(">"));
|
||||
@ -83,7 +83,21 @@ namespace OOX
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
m_sText = oReader.GetText3();
|
||||
int nDepth = oReader.GetDepth();
|
||||
XmlUtils::XmlNodeType eNodeType = XmlUtils::XmlNodeType_EndElement;
|
||||
while (oReader.Read(eNodeType) && oReader.GetDepth() >= nDepth && XmlUtils::XmlNodeType_EndElement != eNodeType)
|
||||
{
|
||||
if (eNodeType == XmlUtils::XmlNodeType_Text || eNodeType == XmlUtils::XmlNodeType_Whitespace || eNodeType == XmlUtils::XmlNodeType_SIGNIFICANT_WHITESPACE)
|
||||
{
|
||||
std::string sTemp = oReader.GetTextA();
|
||||
wchar_t* pUnicodes = NULL;
|
||||
LONG lOutputCount = 0;
|
||||
NSFile::CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH((BYTE*)sTemp.c_str(), sTemp.length(), pUnicodes, lOutputCount);
|
||||
m_sText.append(pUnicodes);
|
||||
RELEASEARRAYOBJECTS(pUnicodes);
|
||||
}
|
||||
}
|
||||
|
||||
NSStringExt::Replace(m_sText, L"\t", L"");
|
||||
if(!(m_oSpace.IsInit() && SimpleTypes::xmlspacePreserve == m_oSpace->GetValue()))
|
||||
{
|
||||
|
||||
@ -2490,6 +2490,7 @@ namespace SimpleTypes
|
||||
else if(L"5Arrows" == sValue) this->m_eValue = Arrows5;
|
||||
else if(L"5ArrowsGray" == sValue) this->m_eValue = Arrows5Gray;
|
||||
else if(L"5Quarters" == sValue) this->m_eValue = Quarters5;
|
||||
//..ext....
|
||||
else if(L"5Rating" == sValue) this->m_eValue = Rating5;
|
||||
else if(L"3Triangles" == sValue) this->m_eValue = Triangles3;
|
||||
else if(L"3Stars" == sValue) this->m_eValue = Stars3;
|
||||
|
||||
@ -513,7 +513,7 @@ const CIconSet CIconSet::Merge(const CIconSet& oPrev, const CIconSet& oCurrent)
|
||||
}
|
||||
bool CIconSet::isExtended ()
|
||||
{
|
||||
return (false == m_arrIconSets.empty());
|
||||
return (false == m_arrIconSets.empty() || (m_oIconSet.IsInit() && m_oIconSet->GetValue() > 15));
|
||||
}
|
||||
void CIconSet::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
|
||||
@ -37,6 +37,12 @@ CONFIG(debug, debug|release) {
|
||||
#PLATFORM
|
||||
win32 {
|
||||
CONFIG += core_windows
|
||||
|
||||
WINDOWS_VERSION_XP = $$(WINDOWS_VERSION_XP)
|
||||
!isEmpty(WINDOWS_VERSION_XP) {
|
||||
CONFIG += build_xp
|
||||
message(xp using)
|
||||
}
|
||||
}
|
||||
|
||||
DST_ARCH=$$QMAKE_TARGET.arch
|
||||
|
||||
@ -788,4 +788,7 @@
|
||||
|
||||
#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003
|
||||
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_MESSAGE 22004
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_TURN_ON 22005
|
||||
|
||||
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_
|
||||
|
||||
@ -121,6 +121,10 @@ namespace NSFile
|
||||
std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8)
|
||||
{
|
||||
return GetUnicodeFromCharPtr(sParam.c_str(), (LONG)sParam.length(), bIsUtf8);
|
||||
}
|
||||
LONG CUtf8Converter::GetUnicodeStringFromUTF8BufferSize(LONG lCount)
|
||||
{
|
||||
return lCount + 1;
|
||||
}
|
||||
std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount )
|
||||
{
|
||||
@ -305,6 +309,249 @@ namespace NSFile
|
||||
return GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount);
|
||||
}
|
||||
|
||||
#define CHECK_HHHH(pBuffer) \
|
||||
wchar_t code = 0; \
|
||||
if('_' == pBuffer[0] && 'x' == pBuffer[1] && 0 != pBuffer[2] && 0 != pBuffer[3] && 0 != pBuffer[4] && 0 != pBuffer[5] && '_' == pBuffer[6]) \
|
||||
{ \
|
||||
int i = 2; \
|
||||
for(; i < 6; ++i) \
|
||||
{ \
|
||||
code *= 16; \
|
||||
if('0' <= pBuffer[i] && pBuffer[i] <= '9') \
|
||||
{ \
|
||||
code += pBuffer[i] - '0'; \
|
||||
} \
|
||||
else if('A' <= pBuffer[i] && pBuffer[i] <= 'F') \
|
||||
{ \
|
||||
code += pBuffer[i] - 'A' + 10; \
|
||||
} \
|
||||
else if('a' <= pBuffer[i] && pBuffer[i] <= 'f') \
|
||||
{ \
|
||||
code += pBuffer[i] - 'a' + 10; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if(i == 6) \
|
||||
{ \
|
||||
if(0x005F == code) \
|
||||
{ \
|
||||
code = '_'; \
|
||||
} \
|
||||
return code; \
|
||||
} \
|
||||
} \
|
||||
return -1;
|
||||
|
||||
long CUtf8Converter::CheckHHHHChar(const BYTE* pBuffer)
|
||||
{
|
||||
CHECK_HHHH(pBuffer);
|
||||
}
|
||||
long CUtf8Converter::CheckHHHHChar(const wchar_t* pBuffer)
|
||||
{
|
||||
CHECK_HHHH(pBuffer);
|
||||
}
|
||||
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (NULL == pUnicodes)
|
||||
{
|
||||
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
|
||||
}
|
||||
WCHAR* pUnicodeString = pUnicodes;
|
||||
LONG lIndexUnicode = 0;
|
||||
|
||||
LONG lIndex = 0;
|
||||
while (lIndex < lCount)
|
||||
{
|
||||
BYTE byteMain = pBuffer[lIndex];
|
||||
if (0x00 == (byteMain & 0x80))
|
||||
{
|
||||
// 1 byte
|
||||
long code = CheckHHHHChar(pBuffer + lIndex);
|
||||
if(code < 0)
|
||||
{
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain;
|
||||
++lIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)code;
|
||||
lIndex += 7;
|
||||
}
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x20))
|
||||
{
|
||||
// 2 byte
|
||||
int val = (int)(((byteMain & 0x1F) << 6) |
|
||||
(pBuffer[lIndex + 1] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 2;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x10))
|
||||
{
|
||||
// 3 byte
|
||||
int val = (int)(((byteMain & 0x0F) << 12) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 2] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 3;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x0F))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x08))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x04))
|
||||
{
|
||||
// 5 byte
|
||||
int val = (int)(((byteMain & 0x03) << 24) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 4] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 6 byte
|
||||
int val = (int)(((byteMain & 0x01) << 30) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 24) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 4] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 5] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 5;
|
||||
}
|
||||
}
|
||||
|
||||
pUnicodeString[lIndexUnicode] = 0;
|
||||
lOutputCount = lIndexUnicode;
|
||||
}
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (NULL == pUnicodes)
|
||||
{
|
||||
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
|
||||
}
|
||||
WCHAR* pUnicodeString = pUnicodes;
|
||||
WCHAR* pStart = pUnicodeString;
|
||||
LONG lIndex = 0;
|
||||
while (lIndex < lCount)
|
||||
{
|
||||
BYTE byteMain = pBuffer[lIndex];
|
||||
if (0x00 == (byteMain & 0x80))
|
||||
{
|
||||
// 1 byte
|
||||
long code = CheckHHHHChar(pBuffer + lIndex);
|
||||
if(code < 0)
|
||||
{
|
||||
*pUnicodeString++ = (WCHAR)byteMain;
|
||||
++lIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pUnicodeString++ = (WCHAR)code;
|
||||
lIndex += 7;
|
||||
}
|
||||
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x20))
|
||||
{
|
||||
// 2 byte
|
||||
int val = (int)(((byteMain & 0x1F) << 6) |
|
||||
(pBuffer[lIndex + 1] & 0x3F));
|
||||
*pUnicodeString++ = (WCHAR)(val);
|
||||
lIndex += 2;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x10))
|
||||
{
|
||||
// 3 byte
|
||||
int val = (int)(((byteMain & 0x0F) << 12) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 2] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 3;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x0F))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x08))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x04))
|
||||
{
|
||||
// 5 byte
|
||||
int val = (int)(((byteMain & 0x03) << 24) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 4] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 6 byte
|
||||
int val = (int)(((byteMain & 0x01) << 30) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 24) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 4] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 5] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 5;
|
||||
}
|
||||
}
|
||||
|
||||
*pUnicodeString++ = 0;
|
||||
lOutputCount = pUnicodeString - pStart;
|
||||
}
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (sizeof(WCHAR) == 2)
|
||||
return GetUnicodeStringFromUTF8WithHHHH_2bytes(pBuffer, lCount, pUnicodes, lOutputCount);
|
||||
return GetUnicodeStringFromUTF8WithHHHH_4bytes(pBuffer, lCount, pUnicodes, lOutputCount);
|
||||
}
|
||||
|
||||
void CUtf8Converter::GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM)
|
||||
{
|
||||
if (NULL == pData)
|
||||
|
||||
@ -100,11 +100,17 @@ namespace NSFile
|
||||
|
||||
static std::wstring GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8 = FALSE);
|
||||
static std::wstring GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8 = FALSE);
|
||||
|
||||
static std::wstring GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount );
|
||||
static std::wstring GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount );
|
||||
|
||||
static std::wstring GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount );
|
||||
|
||||
static void GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
static void GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
static void GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
|
||||
static inline LONG GetUnicodeStringFromUTF8BufferSize( LONG lCount );
|
||||
|
||||
static void GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
@ -118,6 +124,9 @@ namespace NSFile
|
||||
|
||||
static std::wstring GetWStringFromUTF16(const CStringUtf16& data);
|
||||
static std::wstring GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount);
|
||||
|
||||
static long CheckHHHHChar(const BYTE* pBuffer);
|
||||
static long CheckHHHHChar(const wchar_t* pBuffer);
|
||||
};
|
||||
|
||||
class KERNEL_DECL CFileBinary
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*
|
||||
*/
|
||||
#include "StringBuilder.h"
|
||||
#include "File.h"
|
||||
|
||||
namespace NSStringUtils
|
||||
{
|
||||
@ -301,6 +302,18 @@ namespace NSStringUtils
|
||||
else
|
||||
WriteEncodeXmlString_4bytes(pString, nCount);
|
||||
}
|
||||
void CStringBuilder::WriteEncodeXmlStringHHHH(const std::wstring& sString)
|
||||
{
|
||||
WriteEncodeXmlStringHHHH(sString.c_str(), (int)sString.length());
|
||||
}
|
||||
|
||||
void CStringBuilder::WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount)
|
||||
{
|
||||
if (sizeof(wchar_t) == 2)
|
||||
WriteEncodeXmlStringHHHH_2bytes(pString, nCount);
|
||||
else
|
||||
WriteEncodeXmlStringHHHH_4bytes(pString, nCount);
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
@ -354,6 +367,59 @@ namespace NSStringUtils
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
int nCounter = 0;
|
||||
unsigned int code;
|
||||
while (*pData != 0)
|
||||
{
|
||||
code = (unsigned int)*pData;
|
||||
WriteEncodeXmlChar(*pData, CheckXmlCodeHHHH(code, pData));
|
||||
|
||||
++pData;
|
||||
if (-1 != nCount)
|
||||
{
|
||||
++nCounter;
|
||||
if (nCounter >= nCount)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
int nCounter = 0;
|
||||
unsigned int code;
|
||||
BYTE type;
|
||||
while (*pData != 0)
|
||||
{
|
||||
code = (unsigned int)*pData;
|
||||
if (code >= 0xD800 && code <= 0xDFFF && *(pData + 1) != 0)
|
||||
{
|
||||
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & *(pData + 1)));
|
||||
type = CheckXmlCodeHHHH(code, pData);
|
||||
if(0 != type)
|
||||
{
|
||||
WriteEncodeXmlChar(*pData, type);
|
||||
++pData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = CheckXmlCodeHHHH(code, pData);
|
||||
}
|
||||
WriteEncodeXmlChar(*pData, type);
|
||||
|
||||
++pData;
|
||||
if (-1 != nCount)
|
||||
{
|
||||
++nCounter;
|
||||
if (nCounter >= nCount)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlChar(wchar_t code, BYTE type)
|
||||
{
|
||||
switch (type)
|
||||
@ -436,6 +502,27 @@ namespace NSStringUtils
|
||||
*m_pDataCur++ = (wchar_t)(';');
|
||||
m_lSizeCur += 5;
|
||||
break;
|
||||
case 10:
|
||||
AddSize(7);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
*m_pDataCur++ = (wchar_t)('x');
|
||||
*m_pDataCur++ = (wchar_t)('0');
|
||||
*m_pDataCur++ = (wchar_t)('0');
|
||||
*m_pDataCur++ = (wchar_t)('5');
|
||||
*m_pDataCur++ = (wchar_t)('F');
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
m_lSizeCur += 7;
|
||||
break;
|
||||
case 11:
|
||||
AddSize(7);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
*m_pDataCur++ = (wchar_t)('x');
|
||||
m_lSizeCur += 2;
|
||||
WriteHexByteNoSafe((code >> 8) & 0xFF);
|
||||
WriteHexByteNoSafe(code & 0xFF);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
++m_lSizeCur;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -751,6 +838,35 @@ namespace NSStringUtils
|
||||
|
||||
return 0;
|
||||
}
|
||||
unsigned char CStringBuilder::CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData)
|
||||
{
|
||||
if ('&' == c)
|
||||
return 2;
|
||||
if ('\'' == c)
|
||||
return 3;
|
||||
if ('<' == c)
|
||||
return 4;
|
||||
if ('>' == c)
|
||||
return 5;
|
||||
if ('\"' == c)
|
||||
return 6;
|
||||
if ('\n' == c)//when reading from the attributes is replaced by a space.
|
||||
return 7;
|
||||
if ('\r' == c)//when reading from the attributes is replaced by a space.
|
||||
return 8;
|
||||
if ('\t' == c)//when reading from the attributes is replaced by a space.
|
||||
return 9;
|
||||
if (NSFile::CUtf8Converter::CheckHHHHChar(pData) >= 0)
|
||||
return 10;
|
||||
|
||||
//xml 1.0 Character Range https://www.w3.org/TR/xml/#charsets
|
||||
if ((0x20 <= c && c <= 0xD7FF) || (0xE000 <= c && c <= 0xFFFD) || (0x10000 <= c && c <= 0x10FFFF))
|
||||
return 1;
|
||||
else if(c <= 0xFFFF)
|
||||
return 11;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
|
||||
{
|
||||
|
||||
@ -109,9 +109,11 @@ namespace NSStringUtils
|
||||
void AddChar2Safe(const wchar_t _c1, const wchar_t& _c2);
|
||||
|
||||
void WriteEncodeXmlString(const std::wstring& sString);
|
||||
|
||||
void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1);
|
||||
|
||||
void WriteEncodeXmlStringHHHH(const std::wstring& sString);
|
||||
void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1);
|
||||
|
||||
size_t GetCurSize();
|
||||
void SetCurSize(size_t lCurSize);
|
||||
size_t GetSize();
|
||||
@ -147,8 +149,11 @@ namespace NSStringUtils
|
||||
protected:
|
||||
inline void WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlString_2bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlChar(wchar_t code, unsigned char type);
|
||||
inline unsigned char CheckXmlCode(unsigned int c);
|
||||
inline unsigned char CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData);
|
||||
};
|
||||
|
||||
KERNEL_DECL void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo);
|
||||
|
||||
@ -25,6 +25,10 @@ LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics
|
||||
} else {
|
||||
DEFINES += V8_OS_XP
|
||||
DESTDIR=$$DESTDIR/xp
|
||||
OBJECTS_DIR = $$OBJECTS_DIR/xp
|
||||
MOC_DIR = $$MOC_DIR/xp
|
||||
RCC_DIR = $$RCC_DIR/xp
|
||||
UI_DIR = $$UI_DIR/xp
|
||||
include(../../Common/3dParty/v8/v8_xp/v8.pri)
|
||||
}
|
||||
|
||||
|
||||
@ -1626,6 +1626,25 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
std::vector<std::wstring> oArray2 = NSDirectory::GetFiles(L"C:/Windows/Fonts", true);
|
||||
|
||||
wchar_t sUserName[1000];
|
||||
DWORD nUserNameLen = 1000 + 1;
|
||||
GetUserNameW(sUserName, &nUserNameLen);
|
||||
std::wstring strUserName(sUserName, nUserNameLen - 1);
|
||||
|
||||
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\Windows\\Fonts", oArray2, true);
|
||||
|
||||
for (std::vector<std::wstring>::iterator i = oArray2.begin(); i != oArray2.end(); i++)
|
||||
{
|
||||
if (map_files.end() == map_files.find(*i))
|
||||
oArray.push_back(*i);
|
||||
}
|
||||
}
|
||||
|
||||
return oArray;
|
||||
#endif
|
||||
|
||||
|
||||
@ -107,7 +107,9 @@ HEADERS += \
|
||||
\
|
||||
./Fonts.h \
|
||||
./Graphics.h \
|
||||
./Image.h
|
||||
./Image.h \
|
||||
./../../raster/Metafile/svg/SVGFramework.h \
|
||||
./../../raster/Metafile/svg/SVGTransformer.h
|
||||
|
||||
SOURCES += \
|
||||
./../Matrix.cpp \
|
||||
@ -133,7 +135,9 @@ SOURCES += \
|
||||
\
|
||||
./pro_Fonts.cpp \
|
||||
./pro_Image.cpp \
|
||||
./pro_Graphics.cpp
|
||||
./pro_Graphics.cpp \
|
||||
./../../raster/Metafile/svg/SVGFramework.cpp \
|
||||
./../../raster/Metafile/svg/SVGTransformer.cpp
|
||||
|
||||
SOURCES += $$PWD/graphics_pri.cpp
|
||||
|
||||
|
||||
@ -173,6 +173,8 @@
|
||||
17A7F02B1B13154500760AFB /* SvmPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A7F0221B13154500760AFB /* SvmPlayer.cpp */; };
|
||||
17DD67B71B7E2778000F800F /* lepton_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17DD67B51B7E2778000F800F /* lepton_utils.cpp */; };
|
||||
697B72D41E3B78D90054C17C /* EmfFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697B72D31E3B78D90054C17C /* EmfFile.cpp */; };
|
||||
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */; };
|
||||
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */; };
|
||||
8AC2819D2195A582006FA3D7 /* StringExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC2819B2195A582006FA3D7 /* StringExt.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -436,6 +438,10 @@
|
||||
17A7F0231B13154500760AFB /* SvmPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SvmPlayer.h; sourceTree = "<group>"; };
|
||||
17DD67B51B7E2778000F800F /* lepton_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lepton_utils.cpp; sourceTree = "<group>"; };
|
||||
697B72D31E3B78D90054C17C /* EmfFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmfFile.cpp; sourceTree = "<group>"; };
|
||||
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFramework.h; sourceTree = "<group>"; };
|
||||
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformer.h; sourceTree = "<group>"; };
|
||||
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformer.cpp; sourceTree = "<group>"; };
|
||||
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFramework.cpp; sourceTree = "<group>"; };
|
||||
8AC2819B2195A582006FA3D7 /* StringExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExt.cpp; path = ../../../common/StringExt.cpp; sourceTree = "<group>"; };
|
||||
8AC2819C2195A582006FA3D7 /* StringExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringExt.h; path = ../../../common/StringExt.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@ -470,6 +476,7 @@
|
||||
17A762BC1B0F35320046BC0B /* metafile */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8A2EE9B622AFBAC200E8AB1A /* svg */,
|
||||
17A7F0191B13154500760AFB /* StarView */,
|
||||
17A765081B0F3A3E0046BC0B /* Jp2 */,
|
||||
17A7631F1B0F38FE0046BC0B /* JBig2 */,
|
||||
@ -793,6 +800,18 @@
|
||||
path = ../../../raster/Metafile/StarView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8A2EE9B622AFBAC200E8AB1A /* svg */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */,
|
||||
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */,
|
||||
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */,
|
||||
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */,
|
||||
);
|
||||
name = svg;
|
||||
path = ../../../raster/Metafile/svg;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -827,6 +846,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = 17A762B11B0F35320046BC0B;
|
||||
@ -1002,6 +1022,8 @@
|
||||
17A763EF1B0F39370046BC0B /* bardecode.cpp in Sources */,
|
||||
17A7631E1B0F389C0046BC0B /* MetaFileUtils.cpp in Sources */,
|
||||
17A763231B0F39120046BC0B /* JBig2File.cpp in Sources */,
|
||||
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */,
|
||||
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */,
|
||||
17A765031B0F39370046BC0B /* writefile.cpp in Sources */,
|
||||
17A764B11B0F39370046BC0B /* psio2stub.cpp in Sources */,
|
||||
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */,
|
||||
|
||||
@ -518,7 +518,7 @@ bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
if (isSvgFile(fileName))
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
|
||||
eFileType = _CXIMAGE_FORMAT_SVG;
|
||||
}
|
||||
if (isRawFile(fileName))
|
||||
{
|
||||
@ -599,8 +599,51 @@ bool CImageFileFormatChecker::isRawFile(std::wstring& fileName)
|
||||
}
|
||||
bool CImageFileFormatChecker::isSvgFile(std::wstring& fileName)
|
||||
{
|
||||
//TODO:
|
||||
return false;
|
||||
NSFile::CFileBinary file;
|
||||
if (!file.OpenFile(fileName))
|
||||
return false;
|
||||
|
||||
DWORD nSize = (DWORD)file.GetFileSize();
|
||||
if (nSize > 100)
|
||||
nSize = 100;
|
||||
|
||||
BYTE* buffer = new BYTE[nSize];
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
DWORD sizeRead = 0;
|
||||
if (!file.ReadFile(buffer, nSize, sizeRead))
|
||||
{
|
||||
delete []buffer;
|
||||
return false;
|
||||
}
|
||||
file.CloseFile();
|
||||
|
||||
if ('<' == buffer[0] &&
|
||||
's' == buffer[1] &&
|
||||
'v' == buffer[2] &&
|
||||
'g' == buffer[3])
|
||||
{
|
||||
delete [] buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('<' == buffer[0] &&
|
||||
'?' == buffer[1] &&
|
||||
'x' == buffer[2] &&
|
||||
'm' == buffer[3] &&
|
||||
'l' == buffer[4])
|
||||
{
|
||||
std::string test((char*)buffer, nSize);
|
||||
if (std::string::npos != test.find("<svg"))
|
||||
{
|
||||
delete [] buffer;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSize)
|
||||
|
||||
@ -61,7 +61,8 @@ enum __ENUM_CXIMAGE_FORMATS
|
||||
_CXIMAGE_FORMAT_PSD = 20,
|
||||
_CXIMAGE_FORMAT_EMF = 21,
|
||||
_CXIMAGE_FORMAT_WB = 22,
|
||||
_CXIMAGE_FORMAT_SVM = 23
|
||||
_CXIMAGE_FORMAT_SVM = 23,
|
||||
_CXIMAGE_FORMAT_SVG = 24,
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CImageFileFormatChecker
|
||||
|
||||
@ -107,6 +107,17 @@ namespace MetaFile
|
||||
|
||||
void Begin()
|
||||
{
|
||||
if (m_pFile)
|
||||
{
|
||||
TRect* pBounds = m_pFile->GetDCBounds();
|
||||
int nL = pBounds->nLeft;
|
||||
int nR = pBounds->nRight;
|
||||
int nT = pBounds->nTop;
|
||||
int nB = pBounds->nBottom;
|
||||
|
||||
m_dScaleX = (nR - nL <= 0) ? 1 : m_dW / (double)(nR - nL);
|
||||
m_dScaleY = (nB - nT <= 0) ? 1 : m_dH / (double)(nB - nT);
|
||||
}
|
||||
}
|
||||
void End()
|
||||
{
|
||||
|
||||
@ -93,6 +93,8 @@ namespace MetaFile
|
||||
m_oWmfFile.SetFontManager(m_pFontManager);
|
||||
m_oEmfFile.SetFontManager(m_pFontManager);
|
||||
m_oSvmFile.SetFontManager(m_pFontManager);
|
||||
m_oSvgFile.SetFontManager(m_pFontManager);
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
|
||||
@ -134,9 +136,15 @@ namespace MetaFile
|
||||
|
||||
m_oSvmFile.Close();
|
||||
}
|
||||
// Это не svm
|
||||
if (m_oSvgFile.OpenFromFile(wsFilePath) == true)
|
||||
{
|
||||
m_lType = c_lMetaSvg;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
bool CMetaFile::DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
|
||||
{
|
||||
if (NULL == pRenderer)
|
||||
@ -162,64 +170,76 @@ namespace MetaFile
|
||||
m_oSvmFile.SetOutputDevice((IOutputDevice*)&oSvmOut);
|
||||
m_oSvmFile.PlayMetaFile();
|
||||
}
|
||||
else if (c_lMetaSvg == m_lType)
|
||||
{
|
||||
m_oSvgFile.Draw(pRenderer, dX, dY, dWidth, dHeight);
|
||||
}
|
||||
pRenderer->EndCommand(c_nImageType);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
void CMetaFile::Close()
|
||||
{
|
||||
m_oWmfFile.Close();
|
||||
m_oEmfFile.Close();
|
||||
m_oSvmFile.Close();
|
||||
m_oSvgFile.Close();
|
||||
|
||||
m_lType = 0;
|
||||
};
|
||||
}
|
||||
int CMetaFile::GetType()
|
||||
{
|
||||
return m_lType;
|
||||
}
|
||||
void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH)
|
||||
void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH)
|
||||
{
|
||||
if (c_lMetaWmf == m_lType)
|
||||
{
|
||||
if (c_lMetaWmf == m_lType)
|
||||
{
|
||||
const TRectD& oRect = m_oWmfFile.GetBounds();
|
||||
*pdX = oRect.dLeft;
|
||||
*pdY = oRect.dTop;
|
||||
*pdW = oRect.dRight - oRect.dLeft;
|
||||
*pdH = oRect.dBottom - oRect.dTop;
|
||||
}
|
||||
else if (c_lMetaEmf == m_lType)
|
||||
{
|
||||
TEmfRectL* pRect = m_oEmfFile.GetBounds();
|
||||
*pdX = pRect->lLeft;
|
||||
*pdY = pRect->lTop;
|
||||
*pdW = pRect->lRight - pRect->lLeft;
|
||||
*pdH = pRect->lBottom - pRect->lTop;
|
||||
}
|
||||
else if (c_lMetaSvm == m_lType)
|
||||
{
|
||||
TRect* pRect = m_oSvmFile.GetBounds();
|
||||
*pdX = pRect->nLeft;
|
||||
*pdY = pRect->nTop;
|
||||
*pdW = pRect->nRight - pRect->nLeft;
|
||||
*pdH = pRect->nBottom - pRect->nTop;
|
||||
const TRectD& oRect = m_oWmfFile.GetBounds();
|
||||
*pdX = oRect.dLeft;
|
||||
*pdY = oRect.dTop;
|
||||
*pdW = oRect.dRight - oRect.dLeft;
|
||||
*pdH = oRect.dBottom - oRect.dTop;
|
||||
}
|
||||
else if (c_lMetaEmf == m_lType)
|
||||
{
|
||||
TEmfRectL* pRect = m_oEmfFile.GetBounds();
|
||||
*pdX = pRect->lLeft;
|
||||
*pdY = pRect->lTop;
|
||||
*pdW = pRect->lRight - pRect->lLeft;
|
||||
*pdH = pRect->lBottom - pRect->lTop;
|
||||
}
|
||||
else if (c_lMetaSvm == m_lType)
|
||||
{
|
||||
TRect* pRect = m_oSvmFile.GetBounds();
|
||||
*pdX = pRect->nLeft;
|
||||
*pdY = pRect->nTop;
|
||||
*pdW = pRect->nRight - pRect->nLeft;
|
||||
*pdH = pRect->nBottom - pRect->nTop;
|
||||
|
||||
if (*pdW > 10000 || *pdH > 10000)
|
||||
{
|
||||
*pdW /= 10;
|
||||
*pdH /= 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (*pdW > 10000 || *pdH > 10000)
|
||||
{
|
||||
*pdX = 0;
|
||||
*pdY = 0;
|
||||
*pdW = 0;
|
||||
*pdH = 0;
|
||||
*pdW /= 10;
|
||||
*pdH /= 10;
|
||||
}
|
||||
if (*pdW < 0) *pdW = -*pdW;
|
||||
if (*pdH < 0) *pdH = -*pdH;
|
||||
};
|
||||
void CMetaFile::ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight)
|
||||
}
|
||||
else if (c_lMetaSvg == m_lType)
|
||||
{
|
||||
*pdX = 0;
|
||||
*pdY = 0;
|
||||
*pdW = m_oSvgFile.get_Width();
|
||||
*pdH = m_oSvgFile.get_Height();
|
||||
}
|
||||
else
|
||||
{
|
||||
*pdX = 0;
|
||||
*pdY = 0;
|
||||
*pdW = 0;
|
||||
*pdH = 0;
|
||||
}
|
||||
if (*pdW < 0) *pdW = -*pdW;
|
||||
if (*pdH < 0) *pdH = -*pdH;
|
||||
};
|
||||
void CMetaFile::ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight)
|
||||
{
|
||||
CFontManager *pFontManager = (CFontManager*)m_pAppFonts->GenerateFontManager();
|
||||
CFontsCache* pFontCache = new CFontsCache();
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "Wmf/WmfFile.h"
|
||||
#include "Emf/EmfFile.h"
|
||||
#include "StarView/SvmFile.h"
|
||||
#include "svg/SVGTransformer.h"
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
@ -63,6 +64,8 @@ namespace MetaFile
|
||||
CWmfFile m_oWmfFile;
|
||||
CEmfFile m_oEmfFile;
|
||||
CSvmFile m_oSvmFile;
|
||||
CSVGTransformer m_oSvgFile;
|
||||
|
||||
int m_lType;
|
||||
};
|
||||
}
|
||||
|
||||
@ -64,10 +64,7 @@ namespace MetaFile
|
||||
TRectD oBounds = oBoundsBox;
|
||||
if (IsPlaceable())
|
||||
{
|
||||
double dLogicalToMM = 25.4 / 72;
|
||||
if (m_oPlaceable.Inch > 0)
|
||||
dLogicalToMM /= m_oPlaceable.Inch;
|
||||
|
||||
double dLogicalToMM = (m_oPlaceable.Inch > 0 ? 25.4 / m_oPlaceable.Inch : 25.4 / 1440);
|
||||
oBounds *= dLogicalToMM;
|
||||
}
|
||||
else
|
||||
@ -111,100 +108,100 @@ namespace MetaFile
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.1 Bitmap records
|
||||
//-----------------------------------------------------------
|
||||
case META_BITBLT: Read_META_BITBLT(); break;
|
||||
case META_DIBBITBLT: Read_META_DIBBITBLT(); break;
|
||||
case META_DIBSTRETCHBLT: Read_META_DIBSTRETCHBLT(); break;
|
||||
case META_SETDIBTODEV: Read_META_SETDIBTODEV(); break;
|
||||
case META_STRETCHBLT: Read_META_STRETCHBLT(); break;
|
||||
case META_STRETCHDIB: Read_META_STRETCHDIB(); break;
|
||||
case META_BITBLT: Read_META_BITBLT(); break;
|
||||
case META_DIBBITBLT: Read_META_DIBBITBLT(); break;
|
||||
case META_DIBSTRETCHBLT: Read_META_DIBSTRETCHBLT(); break;
|
||||
case META_SETDIBTODEV: Read_META_SETDIBTODEV(); break;
|
||||
case META_STRETCHBLT: Read_META_STRETCHBLT(); break;
|
||||
case META_STRETCHDIB: Read_META_STRETCHDIB(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.2 Control records
|
||||
//-----------------------------------------------------------
|
||||
case META_EOF: bEof = true; break;
|
||||
case META_EOF: bEof = true; break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.3 Drawing records
|
||||
//-----------------------------------------------------------
|
||||
case META_ARC: Read_META_ARC(); break;
|
||||
case META_CHORD: Read_META_CHORD(); break;
|
||||
case META_ELLIPSE: Read_META_ELLIPSE(); break;
|
||||
case META_EXTFLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXTTEXTOUT: Read_META_EXTTEXTOUT(); break;
|
||||
case META_FILLREGION: Read_META_FILLREGION(); break;
|
||||
case META_FLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_FRAMEREGION: Read_META_FRAMEREGION(); break;
|
||||
case META_INVERTREGION: Read_META_INVERTREGION(); break;
|
||||
case META_LINETO: Read_META_LINETO(); break;
|
||||
case META_PAINTREGION: Read_META_PAINTREGION(); break;
|
||||
case META_PATBLT: Read_META_PATBLT(); break;
|
||||
case META_PIE: Read_META_PIE(); break;
|
||||
case META_POLYLINE: Read_META_POLYLINE(); break;
|
||||
case META_POLYGON: Read_META_POLYGON(); break;
|
||||
case META_POLYPOLYGON: Read_META_POLYPOLYGON(); break;
|
||||
case META_RECTANGLE: Read_META_RECTANGLE(); break;
|
||||
case META_ROUNDRECT: Read_META_ROUNDRECT(); break;
|
||||
case META_SETPIXEL: Read_META_SETPIXEL(); break;
|
||||
case META_TEXTOUT: Read_META_TEXTOUT(); break;
|
||||
case META_ARC: Read_META_ARC(); break;
|
||||
case META_CHORD: Read_META_CHORD(); break;
|
||||
case META_ELLIPSE: Read_META_ELLIPSE(); break;
|
||||
case META_EXTFLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXTTEXTOUT: Read_META_EXTTEXTOUT(); break;
|
||||
case META_FILLREGION: Read_META_FILLREGION(); break;
|
||||
case META_FLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_FRAMEREGION: Read_META_FRAMEREGION(); break;
|
||||
case META_INVERTREGION: Read_META_INVERTREGION(); break;
|
||||
case META_LINETO: Read_META_LINETO(); break;
|
||||
case META_PAINTREGION: Read_META_PAINTREGION(); break;
|
||||
case META_PATBLT: Read_META_PATBLT(); break;
|
||||
case META_PIE: Read_META_PIE(); break;
|
||||
case META_POLYLINE: Read_META_POLYLINE(); break;
|
||||
case META_POLYGON: Read_META_POLYGON(); break;
|
||||
case META_POLYPOLYGON: Read_META_POLYPOLYGON(); break;
|
||||
case META_RECTANGLE: Read_META_RECTANGLE(); break;
|
||||
case META_ROUNDRECT: Read_META_ROUNDRECT(); break;
|
||||
case META_SETPIXEL: Read_META_SETPIXEL(); break;
|
||||
case META_TEXTOUT: Read_META_TEXTOUT(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.4 Object records
|
||||
//-----------------------------------------------------------
|
||||
case META_CREATEBRUSHINDIRECT: Read_META_CREATEBRUSHINDIRECT(); break;
|
||||
case META_CREATEFONTINDIRECT: Read_META_CREATEFONTINDIRECT(); break;
|
||||
case META_CREATEPALETTE: Read_META_CREATEPALETTE(); break;
|
||||
case META_CREATEPATTERNBRUSH: Read_META_CREATEPATTERNBRUSH(); break;
|
||||
case META_CREATEPENINDIRECT: Read_META_CREATEPENINDIRECT(); break;
|
||||
case META_CREATEREGION: Read_META_CREATEREGION(); break;
|
||||
case META_DELETEOBJECT: Read_META_DELETEOBJECT(); break;
|
||||
case META_DIBCREATEPATTERNBRUSH: Read_META_DIBCREATEPATTERNBRUSH(); break;
|
||||
case META_SELECTCLIPREGION: Read_META_SELECTCLIPREGION(); break;
|
||||
case META_SELECTOBJECT: Read_META_SELECTOBJECT(); break;
|
||||
case META_SELECTPALETTE: Read_META_SELECTPALETTE(); break;
|
||||
case META_CREATEBRUSHINDIRECT: Read_META_CREATEBRUSHINDIRECT(); break;
|
||||
case META_CREATEFONTINDIRECT: Read_META_CREATEFONTINDIRECT(); break;
|
||||
case META_CREATEPALETTE: Read_META_CREATEPALETTE(); break;
|
||||
case META_CREATEPATTERNBRUSH: Read_META_CREATEPATTERNBRUSH(); break;
|
||||
case META_CREATEPENINDIRECT: Read_META_CREATEPENINDIRECT(); break;
|
||||
case META_CREATEREGION: Read_META_CREATEREGION(); break;
|
||||
case META_DELETEOBJECT: Read_META_DELETEOBJECT(); break;
|
||||
case META_DIBCREATEPATTERNBRUSH: Read_META_DIBCREATEPATTERNBRUSH(); break;
|
||||
case META_SELECTCLIPREGION: Read_META_SELECTCLIPREGION(); break;
|
||||
case META_SELECTOBJECT: Read_META_SELECTOBJECT(); break;
|
||||
case META_SELECTPALETTE: Read_META_SELECTPALETTE(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.5 State records
|
||||
//-----------------------------------------------------------
|
||||
case META_ANIMATEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXCLUDECLIPRECT: Read_META_EXCLUDECLIPRECT(); break;
|
||||
case META_INTERSECTCLIPRECT: Read_META_INTERSECTCLIPRECT(); break;
|
||||
case META_MOVETO: Read_META_MOVETO(); break;
|
||||
case META_OFFSETCLIPRGN: Read_META_OFFSETCLIPRGN(); break;
|
||||
case META_OFFSETVIEWPORTORG: Read_META_OFFSETVIEWPORTORG(); break;
|
||||
case META_OFFSETWINDOWORG: Read_META_OFFSETWINDOWORG(); break;
|
||||
case META_REALIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESTOREDC: Read_META_RESTOREDC(); break;
|
||||
case META_SAVEDC: Read_META_SAVEDC(); break;
|
||||
case META_SCALEVIEWPORTEXT: Read_META_SCALEVIEWPORTEXT(); break;
|
||||
case META_SCALEWINDOWEXT: Read_META_SCALEWINDOWEXT(); break;
|
||||
case META_SETBKCOLOR: Read_META_SETBKCOLOR(); break;
|
||||
case META_SETBKMODE: Read_META_SETBKMODE(); break;
|
||||
case META_SETLAYOUT: Read_META_SETLAYOUT(); break;
|
||||
case META_SETMAPMODE: Read_META_SETMAPMODE(); break;
|
||||
case META_SETMAPPERFLAGS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPALENTRIES: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPOLYFILLMODE: Read_META_SETPOLYFILLMODE(); break;
|
||||
case META_SETRELABS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETROP2: Read_META_SETROP2(); break;
|
||||
case META_SETSTRETCHBLTMODE: Read_META_SETSTRETCHBLTMODE(); break;
|
||||
case META_SETTEXTALIGN: Read_META_SETTEXTALIGN(); break;
|
||||
case META_SETTEXTCHAREXTRA: Read_META_SETTEXTCHAREXTRA(); break;
|
||||
case META_SETTEXTCOLOR: Read_META_SETTEXTCOLOR(); break;
|
||||
case META_SETTEXTJUSTIFICATION: Read_META_SETTEXTJUSTIFICATION(); break;
|
||||
case META_SETVIEWPORTEXT: Read_META_SETVIEWPORTEXT(); break;
|
||||
case META_SETVIEWPORTORG: Read_META_SETVIEWPORTORG(); break;
|
||||
case META_SETWINDOWEXT: Read_META_SETWINDOWEXT(); break;
|
||||
case META_SETWINDOWORG: Read_META_SETWINDOWORG(); break;
|
||||
case META_ANIMATEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXCLUDECLIPRECT: Read_META_EXCLUDECLIPRECT(); break;
|
||||
case META_INTERSECTCLIPRECT: Read_META_INTERSECTCLIPRECT(); break;
|
||||
case META_MOVETO: Read_META_MOVETO(); break;
|
||||
case META_OFFSETCLIPRGN: Read_META_OFFSETCLIPRGN(); break;
|
||||
case META_OFFSETVIEWPORTORG: Read_META_OFFSETVIEWPORTORG(); break;
|
||||
case META_OFFSETWINDOWORG: Read_META_OFFSETWINDOWORG(); break;
|
||||
case META_REALIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESTOREDC: Read_META_RESTOREDC(); break;
|
||||
case META_SAVEDC: Read_META_SAVEDC(); break;
|
||||
case META_SCALEVIEWPORTEXT: Read_META_SCALEVIEWPORTEXT(); break;
|
||||
case META_SCALEWINDOWEXT: Read_META_SCALEWINDOWEXT(); break;
|
||||
case META_SETBKCOLOR: Read_META_SETBKCOLOR(); break;
|
||||
case META_SETBKMODE: Read_META_SETBKMODE(); break;
|
||||
case META_SETLAYOUT: Read_META_SETLAYOUT(); break;
|
||||
case META_SETMAPMODE: Read_META_SETMAPMODE(); break;
|
||||
case META_SETMAPPERFLAGS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPALENTRIES: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPOLYFILLMODE: Read_META_SETPOLYFILLMODE(); break;
|
||||
case META_SETRELABS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETROP2: Read_META_SETROP2(); break;
|
||||
case META_SETSTRETCHBLTMODE: Read_META_SETSTRETCHBLTMODE(); break;
|
||||
case META_SETTEXTALIGN: Read_META_SETTEXTALIGN(); break;
|
||||
case META_SETTEXTCHAREXTRA: Read_META_SETTEXTCHAREXTRA(); break;
|
||||
case META_SETTEXTCOLOR: Read_META_SETTEXTCOLOR(); break;
|
||||
case META_SETTEXTJUSTIFICATION: Read_META_SETTEXTJUSTIFICATION(); break;
|
||||
case META_SETVIEWPORTEXT: Read_META_SETVIEWPORTEXT(); break;
|
||||
case META_SETVIEWPORTORG: Read_META_SETVIEWPORTORG(); break;
|
||||
case META_SETWINDOWEXT: Read_META_SETWINDOWEXT(); break;
|
||||
case META_SETWINDOWORG: Read_META_SETWINDOWORG(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.6 State records
|
||||
//-----------------------------------------------------------
|
||||
case META_ESCAPE: Read_META_ESCAPE(); break;
|
||||
case META_ESCAPE: Read_META_ESCAPE(); break;
|
||||
//-----------------------------------------------------------
|
||||
// Неизвестные записи
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
{
|
||||
//std::cout << ushType << " ";
|
||||
Read_META_UNKNOWN();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//std::cout << ushType << " ";
|
||||
Read_META_UNKNOWN();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bEof)
|
||||
@ -236,23 +233,8 @@ namespace MetaFile
|
||||
m_oDCRect.nTop = pViewport->y;
|
||||
m_oDCRect.nRight = pViewport->w + pViewport->x;
|
||||
m_oDCRect.nBottom = pViewport->h + pViewport->y;
|
||||
|
||||
return &m_oDCRect;
|
||||
|
||||
unsigned short ushMapMode = m_pDC->GetMapMode();
|
||||
if (MM_ANISOTROPIC == ushMapMode || MM_ISOTROPIC == ushMapMode)
|
||||
{
|
||||
TWmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
m_oDCRect.nLeft = pViewport->x;
|
||||
m_oDCRect.nTop = pViewport->y;
|
||||
m_oDCRect.nRight = pViewport->w + pViewport->x;
|
||||
m_oDCRect.nBottom = pViewport->h + pViewport->y;
|
||||
return &m_oDCRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &m_oRect;
|
||||
}
|
||||
}
|
||||
double GetPixelHeight()
|
||||
{
|
||||
@ -321,7 +303,14 @@ namespace MetaFile
|
||||
}
|
||||
TXForm* GetTransform(int iGraphicsMode = GM_ADVANCED)
|
||||
{
|
||||
return m_pDC->GetTransform();
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TXForm oShiftXForm(1, 0, 0, 1, -dL, -dT);
|
||||
m_oTransform.Copy(m_pDC->GetFinalTransform(iGraphicsMode));
|
||||
m_oTransform.Multiply(oShiftXForm, MWT_RIGHTMULTIPLY);
|
||||
return &m_oTransform;
|
||||
}
|
||||
unsigned int GetMiterLimit()
|
||||
{
|
||||
@ -359,24 +348,8 @@ namespace MetaFile
|
||||
|
||||
void TranslatePoint(short shX, short shY, double& dX, double &dY)
|
||||
{
|
||||
TWmfWindow* pWindow = m_pDC->GetWindow();
|
||||
TWmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
dX = (double)((double)(shX - pWindow->x) * m_pDC->GetPixelWidth()) + pViewport->x;
|
||||
dY = (double)((double)(shY - pWindow->y) * m_pDC->GetPixelHeight()) + pViewport->y;
|
||||
|
||||
// Координаты приходят уже с примененной матрицей. Поэтому сначала мы умножаем на матрицу преобразования,
|
||||
// вычитаем начальные координаты и умножаем на обратную матрицу преобразования.
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TEmfXForm* pInverse = GetInverseTransform();
|
||||
TEmfXForm* pTransform = GetTransform();
|
||||
pTransform->Apply(dX, dY);
|
||||
dX -= dL;
|
||||
dY -= dT;
|
||||
pInverse->Apply(dX, dY);
|
||||
dX = (double)shX;
|
||||
dY = (double)shY;
|
||||
}
|
||||
TRect GetBoundingBox()
|
||||
{
|
||||
@ -820,6 +793,9 @@ namespace MetaFile
|
||||
m_oStream >> m_oPlaceable.Inch;
|
||||
m_oStream >> m_oPlaceable.Reserved;
|
||||
m_oStream >> m_oPlaceable.Checksum;
|
||||
|
||||
m_pDC->SetViewportOrg(m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Top);
|
||||
m_pDC->SetViewportExt(m_oPlaceable.BoundingBox.Right - m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Bottom - m_oPlaceable.BoundingBox.Top);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -852,7 +828,7 @@ namespace MetaFile
|
||||
if (0x0100 != m_oHeader.Version && 0x0300 != m_oHeader.Version)
|
||||
return SetError();
|
||||
|
||||
// Если у нас не задан Output, значит мы считаем, что идет сканирование метафайла.
|
||||
// Если у нас не задан Output, значит мы считаем, что идет сканирование метафайла.
|
||||
// Во время сканирования мы регистрируем все точки и вычисляем BoundingBox
|
||||
if (m_pOutput)
|
||||
{
|
||||
@ -1627,6 +1603,8 @@ namespace MetaFile
|
||||
|
||||
TRect m_oBoundingBox;
|
||||
bool m_bFirstPoint;
|
||||
|
||||
TXForm m_oTransform;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -253,6 +253,8 @@ namespace MetaFile
|
||||
m_ushTextAlign = TA_TOP | TA_LEFT | TA_NOUPDATECP;
|
||||
m_ushCharSpacing = 0;
|
||||
m_oTransform.Init();
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform2.Init();
|
||||
}
|
||||
CWmfDC::~CWmfDC()
|
||||
{
|
||||
@ -286,6 +288,7 @@ namespace MetaFile
|
||||
pNewDC->m_ushCharSpacing = m_ushCharSpacing;
|
||||
pNewDC->m_oTransform.Init();
|
||||
pNewDC->m_oClip = m_oClip;
|
||||
pNewDC->m_oFinalTransform.Copy(&m_oFinalTransform);
|
||||
|
||||
return pNewDC;
|
||||
}
|
||||
@ -363,53 +366,55 @@ namespace MetaFile
|
||||
|
||||
switch (m_ushMapMode)
|
||||
{
|
||||
case MM_TEXT: // 1 unit = 1pt
|
||||
{
|
||||
SetPixelWidth(1);
|
||||
SetPixelHeight(1);
|
||||
break;
|
||||
}
|
||||
case MM_LOMETRIC: // 1 unit = 0.1mm
|
||||
{
|
||||
double dPixel = 0.1 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIMETRIC: // 1 unit = 0.01mm
|
||||
{
|
||||
double dPixel = 0.01 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_LOENGLISH: // 1 unit = 0.01 inch
|
||||
{
|
||||
double dPixel = 0.01 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIENGLISH: // 1 unit = 0.001 inch
|
||||
{
|
||||
double dPixel = 0.001 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_TWIPS: // 1 unit = 1/1440 inch
|
||||
{
|
||||
SetPixelWidth(0.05);
|
||||
SetPixelHeight(0.05);
|
||||
break;
|
||||
}
|
||||
case MM_ISOTROPIC:
|
||||
case MM_ANISOTROPIC:
|
||||
{
|
||||
UpdatePixelMetrics();
|
||||
break;
|
||||
}
|
||||
case MM_TEXT: // 1 unit = 1pt
|
||||
{
|
||||
SetPixelWidth(1);
|
||||
SetPixelHeight(1);
|
||||
break;
|
||||
}
|
||||
case MM_LOMETRIC: // 1 unit = 0.1mm
|
||||
{
|
||||
double dPixel = 0.1 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIMETRIC: // 1 unit = 0.01mm
|
||||
{
|
||||
double dPixel = 0.01 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_LOENGLISH: // 1 unit = 0.01 inch
|
||||
{
|
||||
double dPixel = 0.01 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIENGLISH: // 1 unit = 0.001 inch
|
||||
{
|
||||
double dPixel = 0.001 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_TWIPS: // 1 unit = 1/1440 inch
|
||||
{
|
||||
SetPixelWidth(0.05);
|
||||
SetPixelHeight(0.05);
|
||||
break;
|
||||
}
|
||||
case MM_ISOTROPIC:
|
||||
case MM_ANISOTROPIC:
|
||||
{
|
||||
UpdatePixelMetrics();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
unsigned int CWmfDC::GetMapMode()
|
||||
{
|
||||
@ -440,24 +445,28 @@ namespace MetaFile
|
||||
m_oWindow.x = shX;
|
||||
m_oWindow.y = shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowExt(short shW, short shH)
|
||||
{
|
||||
m_oWindow.w = shW;
|
||||
m_oWindow.h = shH;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowOff(short shX, short shY)
|
||||
{
|
||||
m_oWindow.x += shX;
|
||||
m_oWindow.y += shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowScale(double dX, double dY)
|
||||
{
|
||||
m_oWindow.w = (short)(m_oWindow.w * dX);
|
||||
m_oWindow.h = (short)(m_oWindow.h * dY);
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TWmfWindow* CWmfDC::GetViewport()
|
||||
{
|
||||
@ -468,24 +477,28 @@ namespace MetaFile
|
||||
m_oViewport.x = shX;
|
||||
m_oViewport.y = shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportExt(short shW, short shH)
|
||||
{
|
||||
m_oViewport.w = shW;
|
||||
m_oViewport.h = shH;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportOff(short shX, short shY)
|
||||
{
|
||||
m_oViewport.x += shX;
|
||||
m_oViewport.y += shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportScale(double dX, double dY)
|
||||
{
|
||||
m_oViewport.w = (short)(m_oViewport.w * dX);
|
||||
m_oViewport.h = (short)(m_oViewport.h * dY);
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
bool CWmfDC::UpdatePixelMetrics()
|
||||
{
|
||||
@ -510,6 +523,23 @@ namespace MetaFile
|
||||
|
||||
return true;
|
||||
}
|
||||
void CWmfDC::UpdateFinalTransform()
|
||||
{
|
||||
TWmfWindow* pWindow = GetWindow();
|
||||
TWmfWindow* pViewPort = GetViewport();
|
||||
|
||||
TXForm oWindowXForm(1, 0, 0, 1, -pWindow->x, -pWindow->y);
|
||||
TXForm oViewportXForm((double)GetPixelWidth(), 0, 0, (double)GetPixelHeight(), pViewPort->x, pViewPort->y);
|
||||
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(m_oTransform, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
|
||||
m_oFinalTransform2.Init();
|
||||
m_oFinalTransform2.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform2.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
}
|
||||
void CWmfDC::SetTextColor(TWmfColor& oColor)
|
||||
{
|
||||
m_oTextColor = oColor;
|
||||
@ -603,6 +633,13 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oTransform;
|
||||
}
|
||||
TXForm* CWmfDC::GetFinalTransform(int iGraphicsMode)
|
||||
{
|
||||
if (GM_COMPATIBLE == iGraphicsMode)
|
||||
return &m_oFinalTransform2;
|
||||
|
||||
return &m_oFinalTransform;
|
||||
}
|
||||
unsigned int CWmfDC::GetMiterLimit()
|
||||
{
|
||||
return 0;
|
||||
@ -611,4 +648,4 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +129,7 @@ namespace MetaFile
|
||||
unsigned short GetCharSpacing();
|
||||
TXForm* GetTransform();
|
||||
TXForm* GetInverseTransform();
|
||||
TXForm* GetFinalTransform(int iGraphicsMode);
|
||||
unsigned int GetMiterLimit();
|
||||
CWmfClip* GetClip();
|
||||
|
||||
@ -137,6 +138,7 @@ namespace MetaFile
|
||||
void SetPixelWidth(double dW);
|
||||
void SetPixelHeight(double dH);
|
||||
bool UpdatePixelMetrics();
|
||||
void UpdateFinalTransform();
|
||||
|
||||
private:
|
||||
|
||||
@ -163,6 +165,8 @@ namespace MetaFile
|
||||
unsigned short m_ushTextAlign;
|
||||
unsigned short m_ushCharSpacing;
|
||||
TXForm m_oTransform;
|
||||
TXForm m_oFinalTransform;
|
||||
TXForm m_oFinalTransform2;
|
||||
CWmfClip m_oClip;
|
||||
};
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user