mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
24 Commits
v5.3.0.156
...
v5.3.0.181
| Author | SHA1 | Date | |
|---|---|---|---|
| ea82bea6f1 | |||
| 28f5b1251a | |||
| 39fbf06511 | |||
| 0821edca07 | |||
| bc4faa26b9 | |||
| 668a89bbd1 | |||
| 2d21d334cf | |||
| b23bc97fdb | |||
| f4df80ebf3 | |||
| 230c51689d | |||
| 1d25f72ac9 | |||
| 9bfb0321b2 | |||
| 6c1bdc6ff8 | |||
| 826be463f5 | |||
| 29bb606d04 | |||
| 8f8995cbe7 | |||
| fb1ae2c79a | |||
| 0f4d594248 | |||
| 152d05d5a5 | |||
| 5c070f0475 | |||
| ab45804644 | |||
| 4cca54900d | |||
| b66ed403e1 | |||
| 428b5971e8 |
@ -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_;
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,6 +136,12 @@ namespace MetaFile
|
||||
|
||||
m_oSvmFile.Close();
|
||||
}
|
||||
// Это не svm
|
||||
if (m_oSvgFile.OpenFromFile(wsFilePath) == true)
|
||||
{
|
||||
m_lType = c_lMetaSvg;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
@ -162,6 +170,10 @@ 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;
|
||||
};
|
||||
@ -170,6 +182,7 @@ namespace MetaFile
|
||||
m_oWmfFile.Close();
|
||||
m_oEmfFile.Close();
|
||||
m_oSvmFile.Close();
|
||||
m_oSvgFile.Close();
|
||||
|
||||
m_lType = 0;
|
||||
};
|
||||
@ -177,49 +190,56 @@ namespace MetaFile
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
2363
DesktopEditor/raster/Metafile/svg/SVGFramework.cpp
Normal file
2363
DesktopEditor/raster/Metafile/svg/SVGFramework.cpp
Normal file
File diff suppressed because it is too large
Load Diff
6070
DesktopEditor/raster/Metafile/svg/SVGFramework.h
Normal file
6070
DesktopEditor/raster/Metafile/svg/SVGFramework.h
Normal file
File diff suppressed because it is too large
Load Diff
75
DesktopEditor/raster/Metafile/svg/SVGTransformer.cpp
Normal file
75
DesktopEditor/raster/Metafile/svg/SVGTransformer.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "SVGTransformer.h"
|
||||
#include "SVGFramework.h"
|
||||
|
||||
class CSVGTransformer_private
|
||||
{
|
||||
public:
|
||||
SVG::Parser m_oXmlParser;
|
||||
SVG::Storage m_oStorage;
|
||||
SVG::Painter m_oRender;
|
||||
};
|
||||
|
||||
CSVGTransformer::CSVGTransformer()
|
||||
{
|
||||
m_internal = new CSVGTransformer_private();
|
||||
}
|
||||
CSVGTransformer::~CSVGTransformer()
|
||||
{
|
||||
delete m_internal;
|
||||
}
|
||||
|
||||
bool CSVGTransformer::OpenFromFile(const std::wstring& file)
|
||||
{
|
||||
m_internal->m_oStorage.Clear();
|
||||
|
||||
std::wstring sDirectory = NSFile::GetDirectoryName(file);
|
||||
|
||||
m_internal->m_oXmlParser.SetWorkingDirectory(sDirectory);
|
||||
m_internal->m_oRender.SetWorkingDirectory(sDirectory);
|
||||
m_internal->m_oStorage.SetWorkingDirectory(sDirectory);
|
||||
|
||||
if (0 == m_internal->m_oXmlParser.LoadFromFile(file, &m_internal->m_oStorage))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CSVGTransformer::Load(const std::wstring& content)
|
||||
{
|
||||
m_internal->m_oStorage.Clear();
|
||||
|
||||
if (0 == m_internal->m_oXmlParser.LoadFromString(content, &m_internal->m_oStorage))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSVGTransformer::Close()
|
||||
{
|
||||
delete m_internal;
|
||||
m_internal = new CSVGTransformer_private();
|
||||
}
|
||||
|
||||
void CSVGTransformer::SetFontManager(NSFonts::IFontManager* pFontManager)
|
||||
{
|
||||
m_internal->m_oRender.SetFontManager(pFontManager);
|
||||
return;
|
||||
}
|
||||
|
||||
bool CSVGTransformer::Draw(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
|
||||
{
|
||||
m_internal->m_oRender.SetCSS(m_internal->m_oXmlParser.GetCSS());
|
||||
m_internal->m_oRender.Draw(&m_internal->m_oStorage, pRenderer, m_internal->m_oXmlParser.GetUnitSystem(), dX, dY, dWidth, dHeight);
|
||||
return true;
|
||||
}
|
||||
int CSVGTransformer::get_Width()
|
||||
{
|
||||
return m_internal->m_oXmlParser.GetWidth();
|
||||
}
|
||||
int CSVGTransformer::get_Height()
|
||||
{
|
||||
return m_internal->m_oXmlParser.GetHeight();
|
||||
}
|
||||
int CSVGTransformer::get_Metrics()
|
||||
{
|
||||
return m_internal->m_oXmlParser.GetMetrics();
|
||||
}
|
||||
33
DesktopEditor/raster/Metafile/svg/SVGTransformer.h
Normal file
33
DesktopEditor/raster/Metafile/svg/SVGTransformer.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef _BUILD_GRAPHICS_SVG_TRANSFORMER_H_
|
||||
#define _BUILD_GRAPHICS_SVG_TRANSFORMER_H_
|
||||
|
||||
#include "../../../graphics/IRenderer.h"
|
||||
#include "../../../graphics/config.h"
|
||||
#include "../../../graphics/pro/Fonts.h"
|
||||
|
||||
class CSVGTransformer_private;
|
||||
class GRAPHICS_DECL CSVGTransformer
|
||||
{
|
||||
public:
|
||||
CSVGTransformer();
|
||||
~CSVGTransformer();
|
||||
|
||||
public:
|
||||
|
||||
bool OpenFromFile(const std::wstring& file);
|
||||
bool Load(const std::wstring& content);
|
||||
|
||||
void Close();
|
||||
|
||||
void SetFontManager(NSFonts::IFontManager* pFontManager);
|
||||
|
||||
bool Draw(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight);
|
||||
int get_Width();
|
||||
int get_Height();
|
||||
int get_Metrics();
|
||||
|
||||
private:
|
||||
CSVGTransformer_private* m_internal;
|
||||
};
|
||||
|
||||
#endif // _BUILD_GRAPHICS_SVG_TRANSFORMER_H_
|
||||
@ -32,6 +32,7 @@
|
||||
//#include <QCoreApplication>
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
#include "../../DesktopEditor/graphics/pro/Graphics.h"
|
||||
|
||||
#include "../../PdfReader/PdfReader.h"
|
||||
#include "../../DjVuFile/DjVu.h"
|
||||
@ -46,9 +47,10 @@
|
||||
|
||||
//#define RASTER_TEST
|
||||
//#define METAFILE_TEST
|
||||
//#define ONLINE_WORD_TO_PDF
|
||||
//#define METAFILE_TEST_RASTER
|
||||
#define ONLINE_WORD_TO_PDF
|
||||
//#define TO_PDF
|
||||
#define TO_HTML_RENDERER
|
||||
//#define TO_HTML_RENDERER
|
||||
//#define ONLY_TEXT
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -74,14 +76,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifdef METAFILE_TEST
|
||||
|
||||
NSHtmlRenderer::CASCSVGWriter oWriterSVG;
|
||||
NSFonts::IFontManager* pManager = pFonts->GenerateFontManager();
|
||||
|
||||
NSHtmlRenderer::CASCSVGWriter oWriterSVG;
|
||||
oWriterSVG.SetFontManager(pManager);
|
||||
|
||||
MetaFile::IMetaFile* pMetafile = MetaFile::Create(pFonts);
|
||||
|
||||
//pMetafile->LoadFromFile(L"D:\\2\\ppt\\media\\image4.wmf");
|
||||
pMetafile->LoadFromFile(L"/home/oleg/activex/1/image2.wmf");
|
||||
pMetafile->LoadFromFile(L"D:\\SVG\\Disigner 2.svg");
|
||||
|
||||
double x = 0, y = 0, w = 0, h = 0;
|
||||
pMetafile->GetBounds(&x, &y, &w, &h);
|
||||
@ -96,7 +99,7 @@ int main(int argc, char *argv[])
|
||||
oWriterSVG.put_Height(HH);
|
||||
pMetafile->DrawOnRenderer(&oWriterSVG, 0, 0, WW, HH);
|
||||
|
||||
oWriterSVG.SaveFile(L"/home/oleg/activex/1/oleg.svg");
|
||||
oWriterSVG.SaveFile(L"D:\\SVG\\out.png");
|
||||
|
||||
RELEASEOBJECT(pMetafile);
|
||||
RELEASEINTERFACE(pManager);
|
||||
@ -105,6 +108,58 @@ int main(int argc, char *argv[])
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef METAFILE_TEST_RASTER
|
||||
|
||||
NSFonts::IFontManager* pManager = pFonts->GenerateFontManager();
|
||||
|
||||
NSGraphics::IGraphicsRenderer* pRasterRenderer = NSGraphics::Create();
|
||||
pRasterRenderer->SetFontManager(pManager);
|
||||
|
||||
int nRasterW = 1000;
|
||||
int nRasterH = 1000;
|
||||
BYTE* pData = new BYTE[4 * nRasterW * nRasterH];
|
||||
//memset(pData, 255, 4 * nRasterW * nRasterH);
|
||||
|
||||
unsigned int back = 0xffffff;
|
||||
unsigned int* pData32 = (unsigned int*)pData;
|
||||
unsigned int* pData32End = pData32 + nRasterW * nRasterH;
|
||||
//дефолтный тон должен быть прозрачным, а не белым
|
||||
while (pData32 < pData32End)
|
||||
*pData32++ = back;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
oFrame.put_Data(pData);
|
||||
oFrame.put_Width(nRasterW);
|
||||
oFrame.put_Height(nRasterH);
|
||||
oFrame.put_Stride(4 * nRasterW);
|
||||
|
||||
pRasterRenderer->CreateFromBgraFrame(&oFrame);
|
||||
pRasterRenderer->SetSwapRGB(false);
|
||||
|
||||
double dW_MM = nRasterW * 25.4 / 96;
|
||||
double dH_MM = nRasterH * 25.4 / 96;
|
||||
|
||||
pRasterRenderer->put_Width(dW_MM);
|
||||
pRasterRenderer->put_Height(dH_MM);
|
||||
|
||||
MetaFile::IMetaFile* pMetafile = MetaFile::Create(pFonts);
|
||||
pMetafile->LoadFromFile(L"D:\\test\\123.svg");
|
||||
|
||||
double x = 0, y = 0, w = 0, h = 0;
|
||||
pMetafile->GetBounds(&x, &y, &w, &h);
|
||||
|
||||
pMetafile->DrawOnRenderer(pRasterRenderer, dW_MM / 4, dW_MM / 4, dW_MM / 2, dH_MM / 2);
|
||||
pMetafile->ConvertToRaster(L"D:\\SVG\\out2.png", 4, 1000);
|
||||
|
||||
oFrame.SaveFile(L"D:\\SVG\\out.png", 4);
|
||||
|
||||
RELEASEOBJECT(pMetafile);
|
||||
RELEASEINTERFACE(pManager);
|
||||
RELEASEINTERFACE(pRasterRenderer);
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ONLINE_WORD_TO_PDF
|
||||
CPdfRenderer oPdfW(pFonts);
|
||||
oPdfW.SetTempFolder(L"D:\\test\\Document");
|
||||
|
||||
@ -1367,7 +1367,10 @@ HRESULT CPdfRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const d
|
||||
Aggplus::CImage* pAggImage = NULL;
|
||||
|
||||
CImageFileFormatChecker oImageFormat(wsImagePath);
|
||||
if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_EMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_SVM == oImageFormat.eFileType)
|
||||
if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_EMF == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_SVM == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
|
||||
{
|
||||
// TODO: Реализовать отрисовку метафайлов по-нормальному
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);
|
||||
@ -1546,14 +1549,16 @@ PdfWriter::CImageDict* CPdfRenderer::LoadImage(Aggplus::CImage* pImage, const BY
|
||||
|
||||
::memcpy(pCopyImage, pData, 4 * nImageW * nImageH);
|
||||
|
||||
BYTE* pDataMem = pCopyImage;
|
||||
for (int nIndex = 0, nSize = nImageW * nImageH; nIndex < nSize; nIndex++)
|
||||
{
|
||||
if (pCopyImage[4 * nIndex + 3] < 32)
|
||||
if (pDataMem[3] < 32)
|
||||
{
|
||||
pCopyImage[4 * nIndex + 0] = 255;
|
||||
pCopyImage[4 * nIndex + 1] = 255;
|
||||
pCopyImage[4 * nIndex + 2] = 255;
|
||||
pDataMem[0] = 255;
|
||||
pDataMem[1] = 255;
|
||||
pDataMem[2] = 255;
|
||||
}
|
||||
pDataMem += 4;
|
||||
}
|
||||
|
||||
oFrame.put_Width(nImageW);
|
||||
@ -1563,13 +1568,23 @@ PdfWriter::CImageDict* CPdfRenderer::LoadImage(Aggplus::CImage* pImage, const BY
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pDataMem = pData;
|
||||
for (int nIndex = 0, nSize = nImageW * nImageH; nIndex < nSize; nIndex++)
|
||||
{
|
||||
if (pData[4 * nIndex + 3] < 255)
|
||||
// making full-transparent pixels white
|
||||
if (pDataMem[3] == 0)
|
||||
{
|
||||
pDataMem[0] = 255;
|
||||
pDataMem[1] = 255;
|
||||
pDataMem[2] = 255;
|
||||
}
|
||||
|
||||
if (!bAlpha && (pDataMem[3] < 255))
|
||||
{
|
||||
bAlpha = true;
|
||||
break;
|
||||
bAlpha = true;
|
||||
}
|
||||
|
||||
pDataMem += 4;
|
||||
}
|
||||
oFrame.FromImage(pImage);
|
||||
}
|
||||
@ -1802,7 +1817,10 @@ void CPdfRenderer::UpdateBrush()
|
||||
pImage->LoadJpx(wsTexturePath.c_str(), nImageW, nImageH);
|
||||
}
|
||||
}
|
||||
else if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_EMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_SVM == oImageFormat.eFileType)
|
||||
else if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_EMF == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_SVM == oImageFormat.eFileType ||
|
||||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
|
||||
{
|
||||
// TODO: Реализовать отрисовку метафайлов по-нормальному
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);
|
||||
|
||||
Reference in New Issue
Block a user