mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-24 19:02:56 +08:00
Compare commits
114 Commits
core-win-3
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 0499c6ff4f | |||
| 1860c19539 | |||
| 2d5015bcf2 | |||
| c0d16ed7c3 | |||
| 7c6218ccb5 | |||
| 34c5a4b3af | |||
| 9256b0f9a3 | |||
| ce370581a8 | |||
| 39647894a8 | |||
| 3d456bcc80 | |||
| 404058354e | |||
| d398488f3d | |||
| c312a2b868 | |||
| 08f75771b9 | |||
| 060f695fb1 | |||
| de3261521e | |||
| e7bf661432 | |||
| 14aed88307 | |||
| 132f770d28 | |||
| 8f5318a9a2 | |||
| 635265eaa2 | |||
| 038a687d01 | |||
| 69e8ea6f4b | |||
| 1393de8057 | |||
| 7636ff79cc | |||
| 2092aef589 | |||
| eff937699b | |||
| 3efc1f0432 | |||
| 69fee1ae0b | |||
| a0cc6b6274 | |||
| 31eb395858 | |||
| ed1019a004 | |||
| 4e554d128a | |||
| b8d441a327 | |||
| 8fb809bf4a | |||
| cabf6ab32a | |||
| 35c4d70cf5 | |||
| 58952393f0 | |||
| 688d5972ea | |||
| 81176e851c | |||
| 0b987aeed2 | |||
| c7315e2f21 | |||
| aefb229343 | |||
| ac080b3485 | |||
| eb9d69d1ec | |||
| eb4ffee9e7 | |||
| 763347d8ec | |||
| 9670d021c2 | |||
| 232115e684 | |||
| 79f18355fe | |||
| f86055c713 | |||
| ea82bea6f1 | |||
| 28f5b1251a | |||
| 39fbf06511 | |||
| a265d82dda | |||
| e68b550d1e | |||
| 0821edca07 | |||
| bc4faa26b9 | |||
| 668a89bbd1 | |||
| 832d35dc17 | |||
| 2d21d334cf | |||
| b23bc97fdb | |||
| f4df80ebf3 | |||
| 230c51689d | |||
| 799fcbc342 | |||
| 1d25f72ac9 | |||
| 9bfb0321b2 | |||
| 6c1bdc6ff8 | |||
| 826be463f5 | |||
| 469ce9aafb | |||
| 29bb606d04 | |||
| 8f8995cbe7 | |||
| fb1ae2c79a | |||
| 0f4d594248 | |||
| 152d05d5a5 | |||
| 942767eb79 | |||
| 5c070f0475 | |||
| 17c68ae414 | |||
| ab45804644 | |||
| 5f7288f66f | |||
| b308f53e76 | |||
| 0982b8fb11 | |||
| 4cca54900d | |||
| b66ed403e1 | |||
| 692fe69426 | |||
| 428b5971e8 | |||
| 32193b8a04 | |||
| 5bb1de7dbd | |||
| 97531fe80f | |||
| 84755143fa | |||
| 37ab11c58a | |||
| 22cdeaf821 | |||
| ee4d2079dc | |||
| 68606f4cb0 | |||
| dbb11a480e | |||
| 6c29f811d9 | |||
| eb157610d3 | |||
| 89ac698d35 | |||
| e1d910f952 | |||
| ef7331d803 | |||
| 5bb3ca6aff | |||
| bae655ba49 | |||
| e4b4949471 | |||
| 2bfcfbf21c | |||
| 1266382747 | |||
| 287059a891 | |||
| 966809a8f2 | |||
| d8f8720d05 | |||
| aa8471b024 | |||
| 27c9b40ad3 | |||
| 699eb731b4 | |||
| 0eb032a281 | |||
| f89174ded5 | |||
| 564b7f9c29 |
@ -769,18 +769,15 @@ namespace DocFileFormat
|
||||
|
||||
return bytes;
|
||||
}
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
static inline std::wstring IntToWideString(unsigned int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
|
||||
static inline std::wstring IntToWideString(int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
#endif
|
||||
static inline std::wstring IntToWideString(size_t value)
|
||||
}
|
||||
static inline std::wstring SizeTToWideString(size_t value)
|
||||
{
|
||||
return (std::to_wstring((unsigned int)value));
|
||||
}
|
||||
|
||||
@ -94,11 +94,11 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
@ -140,7 +140,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
@ -169,7 +169,7 @@ namespace DocFileFormat
|
||||
|
||||
//start num
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i + 1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(i + 1));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int index = FindIndexbyId( rglst->listData, lfo->lsid );
|
||||
@ -205,12 +205,12 @@ namespace DocFileFormat
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -285,7 +285,7 @@ namespace DocFileFormat
|
||||
newResult = find_if((result + 1), lvl->xst.end(), &NumberingMapping::IsPlaceholder);
|
||||
|
||||
ret += L"%";
|
||||
ret += FormatUtils::IntToWideString(*result + 1);
|
||||
ret += FormatUtils::SizeTToWideString(*result + 1);
|
||||
ret += std::wstring((result + 1), newResult);
|
||||
result = newResult;
|
||||
}
|
||||
|
||||
@ -85,19 +85,19 @@ namespace DocFileFormat
|
||||
|
||||
struct ImageFileStructure
|
||||
{
|
||||
ImageFileStructure()
|
||||
ImageFileStructure(const std::wstring& _ext, boost::shared_array<unsigned char> _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ImageFileStructure(const std::wstring& _ext, const std::vector<unsigned char>& _data, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), blipType(_blipType)
|
||||
ImageFileStructure(const std::wstring& _ext, unsigned char* _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
data = boost::shared_array<unsigned char>(new unsigned char[size]);
|
||||
memcpy(data.get(), _data, size);
|
||||
}
|
||||
|
||||
std::wstring ext;
|
||||
std::vector<unsigned char> data;
|
||||
Global::BlipType blipType;
|
||||
std::wstring ext;
|
||||
boost::shared_array<unsigned char> data;
|
||||
unsigned int size;
|
||||
Global::BlipType blipType;
|
||||
};
|
||||
|
||||
struct OleObjectFileStructure
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "PictureDescriptor.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#ifndef MM_ISOTROPIC
|
||||
#define MM_ISOTROPIC 7
|
||||
#endif
|
||||
@ -41,6 +43,111 @@
|
||||
#define MM_ANISOTROPIC 8
|
||||
#endif
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
int offset = 0, biSizeImage = 0;
|
||||
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
|
||||
if (header_core->bcSize != 12)
|
||||
{
|
||||
result = Global::msoblipWMF;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 12; //sizeof(BITMAPCOREHEADER)
|
||||
|
||||
oFrame.put_Height (header_core->bcHeight );
|
||||
oFrame.put_Width (header_core->bcWidth );
|
||||
|
||||
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
|
||||
|
||||
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
|
||||
// header_core->bcWidth++;
|
||||
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
|
||||
|
||||
int stride = -(size - offset) / header_core->bcHeight;
|
||||
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
|
||||
|
||||
biSizeImage = size - offset;
|
||||
|
||||
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 40; //sizeof(BITMAPINFOHEADER)
|
||||
|
||||
oFrame.put_Height (header->biHeight );
|
||||
oFrame.put_Width (header->biWidth );
|
||||
|
||||
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
if (result == Global::msoblipPNG)
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
|
||||
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
|
||||
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
namespace DocFileFormat
|
||||
{
|
||||
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
|
||||
|
||||
@ -134,3 +134,34 @@ namespace DocFileFormat
|
||||
int embeddedDataSize;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
{
|
||||
_UINT32 biSize;
|
||||
_INT32 biWidth;
|
||||
_INT32 biHeight;
|
||||
_UINT16 biPlanes;
|
||||
_UINT16 biBitCount;
|
||||
_UINT32 biCompression;
|
||||
_UINT32 biSizeImage;
|
||||
_INT32 biXPelsPerMeter;
|
||||
_INT32 biYPelsPerMeter;
|
||||
_UINT32 biClrUsed;
|
||||
_UINT32 biClrImportant;
|
||||
};
|
||||
|
||||
struct __BITMAPCOREHEADER
|
||||
{
|
||||
_UINT32 bcSize; /* used to get to color table */
|
||||
_UINT16 bcWidth;
|
||||
_UINT16 bcHeight;
|
||||
_UINT16 bcPlanes;
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute layoutType ( L"w:type", L"fixed");
|
||||
bool bLayoutFixed = true;
|
||||
|
||||
short tblIndent = 0;
|
||||
_CP_OPT(short) tblIndent;
|
||||
short gabHalf = 0;
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
@ -98,8 +98,7 @@ namespace DocFileFormat
|
||||
//For this cases we can calculate the indent of the table by getting the
|
||||
//first boundary of the TDef and adding the padding of the cells
|
||||
|
||||
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
tblIndent += gabHalf;
|
||||
tblIndent = gabHalf + FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
@ -404,11 +403,11 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//indent
|
||||
if ( tblIndent != 0 )
|
||||
if ( tblIndent )
|
||||
{
|
||||
XMLTools::XMLElement tblInd( L"w:tblInd");
|
||||
|
||||
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( tblIndent ) );
|
||||
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( *tblIndent ) );
|
||||
tblInd.AppendAttribute( tblIndW );
|
||||
|
||||
XMLTools::XMLAttribute tblIndType( L"w:type", L"dxa");
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +62,8 @@ public:
|
||||
std::wstring pgBorders;
|
||||
std::wstring footnotePr;
|
||||
std::wstring endnotePr;
|
||||
bool RtlGutter;
|
||||
long Gutter;
|
||||
|
||||
bool bW;
|
||||
bool bH;
|
||||
@ -76,6 +78,8 @@ public:
|
||||
bool bEvenAndOddHeaders;
|
||||
bool bSectionType;
|
||||
bool bPageNumStart;
|
||||
bool bRtlGutter;
|
||||
bool bGutter;
|
||||
SectPr()
|
||||
{
|
||||
sHeaderFooterReference = _T("");
|
||||
@ -94,6 +98,7 @@ public:
|
||||
bEvenAndOddHeaders = false;
|
||||
bSectionType = false;
|
||||
bPageNumStart = false;
|
||||
bRtlGutter = false;
|
||||
}
|
||||
std::wstring Write()
|
||||
{
|
||||
@ -152,7 +157,9 @@ public:
|
||||
sRes += L" w:header=\"" + std::to_wstring(Header) + L"\"";
|
||||
if(bFooter)
|
||||
sRes += L" w:footer=\"" + std::to_wstring(Footer) + L"\"";
|
||||
sRes += L" w:gutter=\"0\"/>";
|
||||
if(bGutter)
|
||||
sRes += L" w:gutter=\"" + std::to_wstring(Gutter) + L"\"";
|
||||
sRes += L"/>";
|
||||
}
|
||||
if(!pgBorders.empty())
|
||||
sRes += pgBorders;
|
||||
@ -160,6 +167,14 @@ public:
|
||||
if(bPageNumStart)
|
||||
sRes += L"<w:pgNumType w:start=\"" + std::to_wstring(PageNumStart) + L"\"/>";
|
||||
|
||||
if(bRtlGutter)
|
||||
{
|
||||
if(RtlGutter)
|
||||
sRes += L"<w:rtlGutter/>";
|
||||
else
|
||||
sRes += L"<w:rtlGutter w:val=\"0\"/>";
|
||||
}
|
||||
|
||||
if(!cols.empty())
|
||||
sRes += cols;
|
||||
sRes += L"<w:docGrid w:linePitch=\"360\"/>";
|
||||
|
||||
@ -1397,6 +1397,11 @@ int Binary_pPrReader::Read_SecPr(BYTE type, long length, void* poResult)
|
||||
READ1_DEF(length, res, this->ReadEndnotePr, &oEdnProps);
|
||||
pSectPr->endnotePr = oEdnProps.toXML();
|
||||
}
|
||||
else if( c_oSerProp_secPrType::rtlGutter == type )
|
||||
{
|
||||
pSectPr->bRtlGutter = true;
|
||||
pSectPr->RtlGutter = m_oBufferedStream.GetBool();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -1592,6 +1597,11 @@ int Binary_pPrReader::Read_pgMar(BYTE type, long length, void* poResult)
|
||||
pSectPr->bFooter = true;
|
||||
pSectPr->Footer = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::GutterTwips == type )
|
||||
{
|
||||
pSectPr->bGutter = true;
|
||||
pSectPr->Gutter = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -2624,7 +2634,7 @@ int Binary_tblPrReader::ReadTrPrChange(BYTE type, long length, void* poResult)
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
TrackRevision* pTrackRevision = static_cast<TrackRevision*>(poResult);
|
||||
READ1_TRACKREV(type, length, pTrackRevision)
|
||||
else if (c_oSerProp_RevisionType::tblPrChange == type)
|
||||
else if (c_oSerProp_RevisionType::trPrChange == type)
|
||||
{
|
||||
pTrackRevision->trPr = new NSStringUtils::CStringBuilder();
|
||||
READ2_DEF(length, res, this->Read_RowPr, pTrackRevision->trPr);
|
||||
@ -3518,6 +3528,50 @@ int Binary_SettingsTableReader::ReadSettings(BYTE type, long length, void* poRes
|
||||
std::wstring sListSeparator = m_oBufferedStream.GetString3(length);
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:listSeparator w:val=\"" + XmlUtils::EncodeXmlString(sListSeparator) + L"\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::GutterAtTop == type )
|
||||
{
|
||||
bool bGutterAtTop = m_oBufferedStream.GetBool();
|
||||
if (bGutterAtTop)
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:gutterAtTop/>");
|
||||
else
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:gutterAtTop w:val=\"0\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::MirrorMargins == type )
|
||||
{
|
||||
bool bMirrorMargins = m_oBufferedStream.GetBool();
|
||||
if (bMirrorMargins)
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:mirrorMargins/>");
|
||||
else
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:mirrorMargins w:val=\"0\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::PrintTwoOnOne == type )
|
||||
{
|
||||
bool bPrintTwoOnOne = m_oBufferedStream.GetBool();
|
||||
if (bPrintTwoOnOne)
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:printTwoOnOne/>");
|
||||
else
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:printTwoOnOne w:val=\"0\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::BookFoldPrinting == type )
|
||||
{
|
||||
bool bBookFoldPrinting = m_oBufferedStream.GetBool();
|
||||
if (bBookFoldPrinting)
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:bookFoldPrinting/>");
|
||||
else
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:bookFoldPrinting w:val=\"0\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::BookFoldPrintingSheets == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:bookFoldPrintingSheets w:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::BookFoldRevPrinting == type )
|
||||
{
|
||||
bool bBookFoldRevPrinting = m_oBufferedStream.GetBool();
|
||||
if (bBookFoldRevPrinting)
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:bookFoldRevPrinting/>");
|
||||
else
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:bookFoldRevPrinting w:val=\"0\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::SdtGlobalColor == type )
|
||||
{
|
||||
rPr oRPr(m_oFileWriter.m_oFontTableWriter.m_mapFonts);
|
||||
@ -4080,6 +4134,30 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void
|
||||
READ1_DEF(length, res, this->ReadBookmarkEnd, &oBookmarkEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeStart, &oMoveFromRangeStart);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeEnd, &oMoveToRangeEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeStart, &oMoveToRangeStart);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeEnd, &oMoveToRangeEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if(c_oSerParType::JsaProject == type)
|
||||
{
|
||||
BYTE* pData = m_oBufferedStream.GetPointer(length);
|
||||
@ -4922,6 +5000,30 @@ int Binary_DocumentTableReader::ReadMathArg(BYTE type, long length, void* poResu
|
||||
READ1_DEF(length, res, this->ReadBookmarkEnd, &oBookmarkEnd);
|
||||
GetRunStringWriter().WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeStart, &oMoveFromRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeEnd, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeStart, &oMoveToRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeEnd, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -7161,7 +7263,7 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR
|
||||
if(NULL != m_pComments)
|
||||
{
|
||||
CComment* pComment = m_pComments->get(nId);
|
||||
if(NULL != pComment && pComment->bIdFormat)
|
||||
if(NULL != pComment) // могут быть и без start/end
|
||||
{
|
||||
GetRunStringWriter().WriteString(pComment->writeRef(std::wstring(_T("")), std::wstring(_T("w:commentReference")), std::wstring(_T(""))));
|
||||
}
|
||||
@ -7407,6 +7509,30 @@ int Binary_DocumentTableReader::Read_TableContent(BYTE type, long length, void*
|
||||
READ1_DEF(length, res, this->ReadBookmarkEnd, &oBookmarkEnd);
|
||||
pCStringWriter->WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeStart, &oMoveFromRangeStart);
|
||||
pCStringWriter->WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeEnd, &oMoveToRangeEnd);
|
||||
pCStringWriter->WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeStart, &oMoveToRangeStart);
|
||||
pCStringWriter->WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeEnd, &oMoveToRangeEnd);
|
||||
pCStringWriter->WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -7456,6 +7582,30 @@ int Binary_DocumentTableReader::ReadRowContent(BYTE type, long length, void* poR
|
||||
READ1_DEF(length, res, this->ReadBookmarkEnd, &oBookmarkEnd);
|
||||
pCStringWriter->WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeStart, &oMoveFromRangeStart);
|
||||
pCStringWriter->WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveFromRangeEnd, &oMoveToRangeEnd);
|
||||
pCStringWriter->WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeStart, &oMoveToRangeStart);
|
||||
pCStringWriter->WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerDocTableType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
READ1_DEF(length, res, this->ReadMoveToRangeEnd, &oMoveToRangeEnd);
|
||||
pCStringWriter->WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
|
||||
@ -467,7 +467,8 @@ extern int g_nCurFormatVersion;
|
||||
cols = 8,
|
||||
pgBorders = 9,
|
||||
footnotePr = 10,
|
||||
endnotePr = 11
|
||||
endnotePr = 11,
|
||||
rtlGutter = 12
|
||||
};}
|
||||
namespace c_oSerProp_secPrSettingsType{enum c_oSerProp_secPrSettingsType
|
||||
{
|
||||
@ -524,7 +525,11 @@ extern int g_nCurFormatVersion;
|
||||
Sdt = 10,
|
||||
BookmarkStart = 11,
|
||||
BookmarkEnd = 12,
|
||||
tblGrid_ItemTwips = 13
|
||||
tblGrid_ItemTwips = 13,
|
||||
MoveFromRangeStart = 14,
|
||||
MoveFromRangeEnd = 15,
|
||||
MoveToRangeStart = 16,
|
||||
MoveToRangeEnd = 17
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -778,7 +783,8 @@ extern int g_nCurFormatVersion;
|
||||
RightTwips = 8,
|
||||
BottomTwips = 9,
|
||||
HeaderTwips = 10,
|
||||
FooterTwips = 11
|
||||
FooterTwips = 11,
|
||||
GutterTwips = 12
|
||||
};}
|
||||
namespace c_oSer_ColorType{enum c_oSer_ColorType
|
||||
{
|
||||
@ -812,7 +818,13 @@ extern int g_nCurFormatVersion;
|
||||
Compat = 8,
|
||||
DefaultTabStopTwips = 9,
|
||||
DecimalSymbol = 10,
|
||||
ListSeparator = 11
|
||||
ListSeparator = 11,
|
||||
GutterAtTop = 12,
|
||||
MirrorMargins = 13,
|
||||
PrintTwoOnOne = 14,
|
||||
BookFoldPrinting = 15,
|
||||
BookFoldPrintingSheets = 16,
|
||||
BookFoldRevPrinting = 17
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -979,7 +991,11 @@ extern int g_nCurFormatVersion;
|
||||
columnbreak = 64,
|
||||
ARPr = 65,
|
||||
BookmarkStart = 66,
|
||||
BookmarkEnd = 67
|
||||
BookmarkEnd = 67,
|
||||
MoveFromRangeStart = 68,
|
||||
MoveFromRangeEnd = 69,
|
||||
MoveToRangeStart = 70,
|
||||
MoveToRangeEnd = 71
|
||||
};}
|
||||
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
|
||||
{
|
||||
|
||||
@ -801,7 +801,7 @@ void Binary_rPrWriter::Write_rPrChange(const OOX::Logic::CRPrChange& rPrChange)
|
||||
if(rPrChange.m_pRunPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::rPrChange);
|
||||
Write_rPr(rPrChange.m_pRunPr.operator->());
|
||||
Write_rPr(rPrChange.m_pRunPr.GetPointer());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -944,7 +944,7 @@ void Binary_pPrWriter::Write_pPr(const OOX::Logic::CParagraphProperty& pPr)
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::pPr_rPr);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
brPrs.Write_rPr(pPr.m_oRPr.operator->());
|
||||
brPrs.Write_rPr(pPr.m_oRPr.GetPointer());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//FramePr
|
||||
@ -1313,6 +1313,12 @@ void Binary_pPrWriter::WriteSectPr (OOX::Logic::CSectionProperty* pSectPr)
|
||||
NULL, &pSectPr->m_oEndnotePr->m_oPos, NULL);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pSectPr->m_oRtlGutter.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_secPrType::rtlGutter);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(pSectPr->m_oRtlGutter->m_oVal.ToBool());
|
||||
}
|
||||
}
|
||||
void Binary_pPrWriter::WritePageSettings(OOX::Logic::CSectionProperty* pSectPr)
|
||||
{
|
||||
@ -1411,6 +1417,12 @@ void Binary_pPrWriter::WritePageMargin(OOX::Logic::CSectionProperty* pSectPr)
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oFooter->ToTwips());
|
||||
}
|
||||
if(pMar.m_oGutter.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::GutterTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oGutter->ToTwips());
|
||||
}
|
||||
}
|
||||
}
|
||||
void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr, std::vector<ComplexTypes::Word::CHdrFtrRef*>& aRefs, bool bHdr)
|
||||
@ -1425,7 +1437,7 @@ void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr,
|
||||
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
|
||||
{
|
||||
int nIndex = 0;
|
||||
OOX::CHdrFtr* pHdrFtr = (OOX::CHdrFtr*)oFile.operator->();
|
||||
OOX::CHdrFtr* pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
|
||||
if(bHdr)
|
||||
{
|
||||
nIndex = (int)m_oBinaryHeaderFooterTableWriter->m_aHeaders.size();
|
||||
@ -2264,7 +2276,7 @@ void Binary_tblPrWriter::WriteTcPrChange(const OOX::Logic::CTcPrChange& tcPrChan
|
||||
if(tcPrChange.m_pTcPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::tcPrChange);
|
||||
WriteCellPr(tcPrChange.m_pTcPr.operator->());
|
||||
WriteCellPr(tcPrChange.m_pTcPr.GetPointer());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -2452,7 +2464,7 @@ void BinaryStyleTableWriter::WriteStyle(const OOX::CStyle& style)
|
||||
if(false != style.m_oRunPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_sts::Style_TextPr);
|
||||
brPrs.Write_rPr(style.m_oRunPr.operator->());
|
||||
brPrs.Write_rPr(style.m_oRunPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
//ParaPr
|
||||
@ -2480,7 +2492,7 @@ void BinaryStyleTableWriter::WriteStyle(const OOX::CStyle& style)
|
||||
if(false != style.m_oTcPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_sts::Style_CellPr);
|
||||
btblPrs.WriteCellPr(style.m_oTcPr.operator->());
|
||||
btblPrs.WriteCellPr(style.m_oTcPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
//TblStylePr
|
||||
@ -2557,7 +2569,7 @@ void BinaryStyleTableWriter::WriteTblStyleProperties(const OOX::Logic::CTableSty
|
||||
if(false != oProperty.m_oRunPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblStylePrType::RunPr);
|
||||
brPrs.Write_rPr(oProperty.m_oRunPr.operator->());
|
||||
brPrs.Write_rPr(oProperty.m_oRunPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
//ParaPr
|
||||
@ -2585,7 +2597,7 @@ void BinaryStyleTableWriter::WriteTblStyleProperties(const OOX::Logic::CTableSty
|
||||
if(false != oProperty.m_oTcPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblStylePrType::TcPr);
|
||||
btblPrs.WriteCellPr(oProperty.m_oTcPr.operator->());
|
||||
btblPrs.WriteCellPr(oProperty.m_oTcPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -3082,6 +3094,34 @@ void BinaryDocumentTableWriter::WriteDocumentContent(const std::vector<OOX::Writ
|
||||
WriteBookmarkEnd(*pBookmarkEnd);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_moveFromRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeStart);
|
||||
WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_moveFromRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_moveToRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeStart);
|
||||
WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_moveToRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -3285,39 +3325,38 @@ void BinaryDocumentTableWriter::WriteParagraphContent(const std::vector<OOX::Wri
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
//todo moveRange on all levels(body, p ...)
|
||||
// case OOX::et_w_moveFromRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveFromRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
case OOX::et_w_moveFromRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeStart);
|
||||
WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveFromRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveToRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeStart);
|
||||
WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveToRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_m_oMathPara:
|
||||
{
|
||||
OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item);
|
||||
@ -4222,6 +4261,38 @@ void BinaryDocumentTableWriter::WriteMathArgNodes(const std::vector<OOX::Writing
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveFromRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MoveFromRangeStart);
|
||||
WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveFromRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MoveFromRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveToRangeStart:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MoveToRangeStart);
|
||||
WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveToRangeEnd:
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MoveToRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4234,7 +4305,7 @@ void BinaryDocumentTableWriter::WriteMathRunContent(OOX::Logic::CMRun* pMRun)
|
||||
if ( pMRun->m_oRPr.IsInit() )
|
||||
{
|
||||
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_OMathContentType::RPr);
|
||||
brPrs.Write_rPr(pMRun->m_oRPr.operator->());
|
||||
brPrs.Write_rPr(pMRun->m_oRPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos2);
|
||||
}
|
||||
if ( pMRun->m_oARPr.IsInit() )
|
||||
@ -4483,7 +4554,7 @@ void BinaryDocumentTableWriter::WriteMathCtrlPr(const OOX::Logic::CCtrlPr &pCtrl
|
||||
if ( pCtrlPr.m_oRPr.IsInit() )
|
||||
{
|
||||
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::rPr);
|
||||
brPrs.Write_rPr(pCtrlPr.m_oRPr.operator->());
|
||||
brPrs.Write_rPr(pCtrlPr.m_oRPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos2);
|
||||
}
|
||||
if ( pCtrlPr.m_oARPr.IsInit() )
|
||||
@ -6806,6 +6877,34 @@ void BinaryDocumentTableWriter::WriteTableContent(std::vector<OOX::WritingElemen
|
||||
WriteBookmarkEnd(*pBookmarkEnd);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveFromRangeStart == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveFromRangeStart);
|
||||
WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveFromRangeEnd == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveFromRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveToRangeStart == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveToRangeStart);
|
||||
WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveToRangeEnd == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveToRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void BinaryDocumentTableWriter::WriteRow(const OOX::Logic::CTr& Row, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
|
||||
@ -6880,6 +6979,34 @@ void BinaryDocumentTableWriter::WriteRowContent(const std::vector<OOX::WritingEl
|
||||
WriteBookmarkEnd(*pBookmarkEnd);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveFromRangeStart == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveFromRangeStart);
|
||||
WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveFromRangeEnd == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveFromRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveToRangeStart == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveToRangeStart);
|
||||
WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_moveToRangeEnd == item->getType())
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::MoveToRangeEnd);
|
||||
WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void BinaryDocumentTableWriter::WriteCell(OOX::Logic::CTc& tc, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nCurColIndex, int nRows, int nCols)
|
||||
@ -6913,7 +7040,7 @@ void BinaryDocumentTableWriter::WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::
|
||||
if(pStd->m_oSdtEndPr.IsInit() && pStd->m_oSdtEndPr->m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::EndPr);
|
||||
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.operator->());
|
||||
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
@ -7037,7 +7164,7 @@ void BinaryDocumentTableWriter::WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
|
||||
if(oStdPr.m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::RPr);
|
||||
brPrs.Write_rPr(oStdPr.m_oRPr.operator->());
|
||||
brPrs.Write_rPr(oStdPr.m_oRPr.GetPointer());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oShowingPlcHdr.IsInit())
|
||||
@ -7430,6 +7557,42 @@ void BinarySettingsTableWriter::WriteSettingsContent(OOX::CSettings& oSettings,
|
||||
m_oBcw.m_oStream.WriteStringW3(oSettings.m_oListSeparator->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oGutterAtTop.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::GutterAtTop);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettings.m_oGutterAtTop->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oMirrorMargins.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::MirrorMargins);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettings.m_oMirrorMargins->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oPrintTwoOnOne.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::PrintTwoOnOne);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettings.m_oPrintTwoOnOne->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oBookFoldPrinting.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::BookFoldPrinting);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettings.m_oBookFoldPrinting->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oBookFoldPrintingSheets.IsInit() && oSettings.m_oBookFoldPrintingSheets->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::BookFoldPrintingSheets);
|
||||
m_oBcw.m_oStream.WriteLONG(oSettings.m_oBookFoldPrintingSheets->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oBookFoldRevPrinting.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::BookFoldRevPrinting);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettings.m_oBookFoldRevPrinting->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettingsCustom.m_oSdtGlobalColor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::SdtGlobalColor);
|
||||
|
||||
@ -92,8 +92,9 @@ public:
|
||||
std::wstring convert_conditional_formula(std::wstring const & expr);
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
std::wstring convert_named_ref (std::wstring const & expr);
|
||||
std::wstring convert_named_ref(std::wstring const & expr);
|
||||
std::wstring convert_named_formula(std::wstring const & expr);
|
||||
bool is_simple_ref(std::wstring const & expr);
|
||||
|
||||
std::wstring get_table_name();
|
||||
|
||||
|
||||
@ -133,6 +133,7 @@ public:
|
||||
}
|
||||
static void oox_replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"MINYS", L"-");
|
||||
XmlUtils::replace_all( expr, L"ТОСHKA", L".");
|
||||
XmlUtils::replace_all( expr, L"VOSKL", L"!");
|
||||
|
||||
@ -149,6 +150,7 @@ public:
|
||||
|
||||
static void oox_replace_tmp(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"-", L"MINYS");
|
||||
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
|
||||
@ -174,6 +176,7 @@ public:
|
||||
}
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
void replace_named_formula(std::wstring & expr);
|
||||
bool is_simple_ref(std::wstring const & expr);
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
|
||||
@ -195,7 +198,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
|
||||
|
||||
if (b)
|
||||
{
|
||||
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
|
||||
boost::wregex re1(L"(\\$?[^\\']+\\!)?([a-zA-Z$]+\\d*)(\\:[a-zA-Z$]+\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
@ -238,9 +241,11 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
table_name_ = L"$" + sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
if (!c2.empty() && c2.substr(0, 1) == L":")
|
||||
c2 = c2.substr(1);
|
||||
|
||||
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
@ -281,10 +286,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
table_name_ = L"$" + sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
|
||||
if (!c2.empty() && c2.substr(0, 1) == L":")
|
||||
c2 = c2.substr(1);
|
||||
|
||||
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
|
||||
}
|
||||
@ -310,6 +317,19 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
expr = convert_formula(expr);
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
bool oox2odf_converter::Impl::is_simple_ref(std::wstring const & expr)
|
||||
{
|
||||
if (expr.find(L"(") != std::wstring::npos) return false;
|
||||
if (expr.find(L" ") != std::wstring::npos) return false;
|
||||
if (expr.find(L";") != std::wstring::npos) return false;
|
||||
|
||||
boost::wsmatch match;
|
||||
if (boost::regex_search(expr, match, boost::wregex(L"([\\w]+\\!)?\\$?[a-zA-Z]+\\$?\\d+(\\:\\$?[a-zA-Z]+\\$?\\d+)?")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
@ -644,6 +664,11 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
|
||||
impl_->replace_named_formula(workstr);
|
||||
return workstr;
|
||||
}
|
||||
bool oox2odf_converter::is_simple_ref(std::wstring const & expr)
|
||||
{
|
||||
return impl_->is_simple_ref(expr);
|
||||
}
|
||||
|
||||
std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -468,6 +468,7 @@ enum ElementType
|
||||
typeDrawHandle,
|
||||
typeDrawEquation,
|
||||
typeDrawEnhancedGeometry,
|
||||
typeDrawGluePoint,
|
||||
|
||||
typeDr3dScene,
|
||||
typeDr3dLight,
|
||||
@ -506,6 +507,7 @@ enum ElementType
|
||||
typeFormTime,
|
||||
typeFormValueRange,
|
||||
typeFormItem,
|
||||
typeFormOption,
|
||||
|
||||
typeDrawPage,
|
||||
typePresentationFooterDecl,
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -144,7 +144,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf
|
||||
text_tracked_context_ (*this),
|
||||
table_context_ (*this),
|
||||
output_document_ (NULL),
|
||||
process_note_ (noNote),
|
||||
current_process_note_ (noNote),
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
current_outline_level_ (-1),
|
||||
@ -152,7 +152,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
process_comment_ (false),
|
||||
current_process_comment_ (false),
|
||||
odf_document_ (_odf_document),
|
||||
math_context_ (_odf_document->odf_context().fontContainer(), false)
|
||||
{
|
||||
@ -622,9 +622,9 @@ std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, b
|
||||
{
|
||||
hyperlinks::_type_place type = hyperlinks::document_place;
|
||||
|
||||
if (process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (process_note_ == footNote || process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (process_note_ == endNote || process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
if (current_process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (current_process_note_ == footNote || current_process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (current_process_note_ == endNote || current_process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
@ -694,7 +694,7 @@ void docx_conversion_context::end_document()
|
||||
output_document_->get_word_files().set_comments ( comments_context_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content());
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content(), chart_drawing_handle_->content_vml());
|
||||
output_document_->get_word_files().set_drawings(drawings);
|
||||
|
||||
package::content_types_file & content_file_ = output_document_->get_content_types_file();
|
||||
@ -1470,7 +1470,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_;
|
||||
}
|
||||
@ -1496,9 +1496,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"";
|
||||
@ -1551,6 +1551,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;
|
||||
@ -1571,19 +1658,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_)
|
||||
)
|
||||
{
|
||||
process_page_break_after(styleInst);
|
||||
{
|
||||
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;
|
||||
{
|
||||
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())
|
||||
{
|
||||
@ -1591,7 +1681,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());
|
||||
|
||||
@ -1617,10 +1707,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()
|
||||
@ -1636,6 +1726,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>";
|
||||
@ -1655,58 +1747,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;
|
||||
}
|
||||
}
|
||||
@ -1757,28 +1849,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1944,12 +2035,12 @@ void notes_context::dump_rels(rels & Rels) const
|
||||
|
||||
void docx_conversion_context::add_note_reference ()
|
||||
{
|
||||
if (process_note_ == footNote || process_note_ == endNote)
|
||||
if (current_process_note_ == footNote || current_process_note_ == endNote)
|
||||
{
|
||||
add_element_to_run(_T(""));
|
||||
output_stream() << ((process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
output_stream() << ((current_process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
finish_run();
|
||||
process_note_ = (NoteType) (process_note_ + 1); //add ref set
|
||||
current_process_note_ = (NoteType) (current_process_note_ + 1); //add ref set
|
||||
}
|
||||
}
|
||||
|
||||
@ -1998,7 +2089,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
|
||||
void docx_conversion_context::start_changes()
|
||||
{
|
||||
if (map_current_changes_.empty()) return;
|
||||
if (process_comment_) return;
|
||||
if (current_process_comment_) return;
|
||||
|
||||
text_tracked_context_.dumpPPr_.clear();
|
||||
text_tracked_context_.dumpRPr_.clear();
|
||||
@ -2097,7 +2188,7 @@ void docx_conversion_context::start_changes()
|
||||
|
||||
void docx_conversion_context::end_changes()
|
||||
{
|
||||
if (process_comment_) return;
|
||||
if (current_process_comment_) return;
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
|
||||
@ -830,6 +830,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);
|
||||
@ -873,8 +874,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 ();
|
||||
@ -912,26 +913,32 @@ public:
|
||||
StreamsManPtr get_stream_man() const { return streams_man_; }
|
||||
void set_stream_man(StreamsManPtr Sm) { streams_man_ = Sm; }
|
||||
|
||||
void set_rtl(bool val) { is_rtl_ = val; }
|
||||
bool get_rtl() const {return is_rtl_;}
|
||||
void set_rtl(bool val) { is_rtl_ = val; }
|
||||
bool get_rtl() const {return is_rtl_;}
|
||||
|
||||
double get_current_fontSize() {return current_fontSize.empty() ? 0 : current_fontSize.back();}
|
||||
void pop_current_fontSize() {if (!current_fontSize.empty()) current_fontSize.pop_back();}
|
||||
|
||||
void set_margin_left(int val) {current_margin_left_ = val;}
|
||||
int get_margin_left() {return current_margin_left_;}
|
||||
|
||||
void set_outline_level(int val) {current_outline_level_ = val;}
|
||||
int get_outline_level() {return current_outline_level_;}
|
||||
|
||||
void set_process_note (NoteType Val) { process_note_ = Val; }
|
||||
NoteType get_process_note () const { return process_note_; }
|
||||
void set_process_note (NoteType Val) { current_process_note_ = Val; }
|
||||
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 ();
|
||||
|
||||
void start_comment () {process_comment_ = true;}
|
||||
void end_comment () {process_comment_ = false;}
|
||||
bool process_comment_;
|
||||
void start_comment () {current_process_comment_ = true;}
|
||||
void end_comment () {current_process_comment_ = false;}
|
||||
|
||||
void start_math_formula ();
|
||||
void end_math_formula ();
|
||||
@ -950,7 +957,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_;
|
||||
@ -961,6 +968,7 @@ public:
|
||||
void end_changes();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
@ -1015,14 +1023,14 @@ private:
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
headers_footers headers_footers_;
|
||||
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
std::vector<std::wstring> fields_names_stack_;
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_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_;
|
||||
|
||||
bool first_element_list_item_;
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
bool page_break_before_;
|
||||
@ -1036,11 +1044,13 @@ private:
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
int current_outline_level_;
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
NoteType process_note_;
|
||||
NoteType current_process_note_;
|
||||
bool current_process_comment_;
|
||||
std::vector<double> current_fontSize;
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
int current_outline_level_;
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -73,7 +73,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
|
||||
// return std::pair<float, float>(7,8);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
|
||||
return std::pair<float, float>(7,8);
|
||||
|
||||
TBBox box;
|
||||
@ -96,7 +96,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
|
||||
}
|
||||
|
||||
double width = (minWidth + 2 * maxWidth) /3. /5.;
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
return std::pair<float, float>(width, maxHeight);
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +194,14 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
CImageFileFormatChecker image_checker;
|
||||
sExt = image_checker.DetectFormatByData(buffer, buffer_size);
|
||||
|
||||
if (!sExt.empty()) sExt = std::wstring(L".") + sExt;
|
||||
if (sExt.empty())
|
||||
{
|
||||
size_t n = fileName.rfind(L".");
|
||||
if (n != std::wstring::npos)
|
||||
sExt = XmlUtils::GetLower(fileName.substr(n));
|
||||
|
||||
}
|
||||
else sExt = std::wstring(L".") + sExt;
|
||||
}
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
|
||||
@ -131,7 +131,16 @@ static const std::wstring _ooxDashStyle[]=
|
||||
L"dashDot",
|
||||
L"sysDashDotDot"
|
||||
};
|
||||
|
||||
static const std::wstring _vmlDashStyle[]=
|
||||
{
|
||||
L"none",
|
||||
L"solid",
|
||||
L"dot",
|
||||
L"dash",
|
||||
L"dash",
|
||||
L"dashdot",
|
||||
L"shortdashdotdot"
|
||||
};
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
@ -152,7 +161,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
odf_reader::GetProperty(prop, L"stroke" , iStroke);
|
||||
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
|
||||
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
|
||||
|
||||
|
||||
if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
@ -224,6 +233,69 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
}
|
||||
}
|
||||
}
|
||||
void vml_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
|
||||
{
|
||||
_CP_OPT(std::wstring) strStrokeColor;
|
||||
_CP_OPT(int) iStroke;
|
||||
_CP_OPT(double) dStrokeWidth;
|
||||
_CP_OPT(double) dStrokeOpacity;
|
||||
_CP_OPT(bool) bWordArt;
|
||||
|
||||
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
|
||||
|
||||
odf_reader::GetProperty(prop, L"stroke-color" , strStrokeColor);
|
||||
odf_reader::GetProperty(prop, L"stroke" , iStroke);
|
||||
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
|
||||
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
|
||||
|
||||
if (!strStrokeColor && !iStroke && !dStrokeWidth) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
std::wstring color, dash_style ;
|
||||
|
||||
if (strStrokeColor) color = *strStrokeColor;
|
||||
|
||||
if (iStroke)
|
||||
{
|
||||
if (iStroke.get() != 0 ) dash_style = _vmlDashStyle[iStroke.get()];
|
||||
}
|
||||
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0))
|
||||
{
|
||||
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
|
||||
if (val < 10) val = 12700;
|
||||
|
||||
CP_XML_ATTR(L"weight", val);
|
||||
}
|
||||
|
||||
if (false == color.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"color", L"#" + color);
|
||||
}
|
||||
if (!dash_style.empty() && dash_style != L"solid")
|
||||
{
|
||||
CP_XML_ATTR(L"dashstyle", dash_style);
|
||||
}
|
||||
//odf_reader::GetProperty(prop,L"marker-start", strVal);
|
||||
//if (strVal)
|
||||
//{
|
||||
//}
|
||||
//odf_reader::GetProperty(prop,L"marker-end",strVal);
|
||||
//if (strVal)
|
||||
//{
|
||||
//}
|
||||
|
||||
CP_XML_ATTR(L"startarrow", L"block");
|
||||
CP_XML_ATTR(L"startarrowwidth", L"medium");
|
||||
CP_XML_ATTR(L"startarrowlength", L"medium");
|
||||
CP_XML_ATTR(L"joinstyle", L"round");
|
||||
CP_XML_ATTR(L"endcap", L"flat");
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
@ -124,6 +124,7 @@ namespace oox {
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
void vml_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.gradient->colors.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
|
||||
CP_XML_ATTR(L"color2", L"#" + val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
|
||||
|
||||
std::wstring colors_value;
|
||||
for (size_t i = 0; i < val.gradient->colors.size(); i++)
|
||||
@ -404,6 +404,27 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
|
||||
}
|
||||
}
|
||||
|
||||
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
switch (val.type)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
vml_serialize_solid_fill(strm, val);
|
||||
break;
|
||||
case 2:
|
||||
vml_serialize_bitmap_fill(strm, val);
|
||||
break;
|
||||
case 3:
|
||||
vml_serialize_gradient_fill(strm, val);
|
||||
break;
|
||||
case 4:
|
||||
//vml_serialize_hatch_fill(strm, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
switch (val.type)
|
||||
|
||||
@ -154,5 +154,6 @@ namespace oox {
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, pptx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
|
||||
@ -495,6 +495,10 @@ void pptx_slide_context::set_image(const std::wstring & path)
|
||||
impl_->object_description_.type_ = typeImage;
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
}
|
||||
else if (impl_->object_description_.type_ == typeImage && impl_->object_description_.xlink_href_.rfind(L".svg") != std::wstring::npos)
|
||||
{
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
}
|
||||
else if (impl_->use_image_replacement_)
|
||||
{
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
|
||||
@ -39,14 +39,14 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
unsigned int hex_string_to_int(std::wstring str)
|
||||
{
|
||||
unsigned int x;
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << str;
|
||||
ss >> x;
|
||||
return x;
|
||||
}
|
||||
unsigned int hex_string_to_int(std::wstring str)
|
||||
{
|
||||
unsigned int x;
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << str;
|
||||
ss >> x;
|
||||
return x;
|
||||
}
|
||||
|
||||
class xlsx_comments::Impl
|
||||
{
|
||||
@ -82,6 +82,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"ref", c.ref_);
|
||||
CP_XML_ATTR(L"authorId", c.author_);
|
||||
CP_XML_ATTR(L"shapeId", 0);
|
||||
|
||||
CP_XML_NODE(L"text")
|
||||
{
|
||||
@ -94,127 +95,6 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
void serialize_vml(std::wostream & strm) const
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) dVal;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xml")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
|
||||
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
for (size_t i = 0; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
std::wstring str_fill_color_ = L"00003f";
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"fill-color",strVal))
|
||||
str_fill_color_ = strVal.get();
|
||||
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"shapetype_202");
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"o:spt", L"202");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600l21600,21600l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"v:shape")
|
||||
{
|
||||
if( hex_string_to_int(str_fill_color_) !=0 )
|
||||
{
|
||||
CP_XML_ATTR(L"fillcolor", std::wstring(L"#") + str_fill_color_);
|
||||
}//иначе это полная прозрачность
|
||||
|
||||
CP_XML_ATTR(L"id", L"shape_0");
|
||||
|
||||
std::wstring style = std::wstring(L"position:absolute;");
|
||||
|
||||
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
|
||||
|
||||
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
|
||||
|
||||
CP_XML_ATTR(L"style",style);
|
||||
CP_XML_ATTR(L"type", L"shapetype_202");
|
||||
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
|
||||
//{
|
||||
// CP_XML_ATTR(L"opacity", boost::lexical_cast<std::wstring>((int)(100.-dVal.get())) + L"%");
|
||||
//}
|
||||
//CP_XML_NODE(L"v:shadow")
|
||||
//{
|
||||
// CP_XML_ATTR(L"color", L"black");
|
||||
// CP_XML_ATTR(L"obscured", L"t");
|
||||
// CP_XML_ATTR(L"on", L"t");
|
||||
//}
|
||||
|
||||
CP_XML_NODE(L"v:wrap")
|
||||
{
|
||||
CP_XML_ATTR(L"v:type", L"none");
|
||||
}
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
CP_XML_ATTR(L"detectmouseclick", L"t");
|
||||
if( hex_string_to_int(str_fill_color_) !=0 )
|
||||
{
|
||||
CP_XML_ATTR(L"color", std::wstring(L"#") + str_fill_color_);
|
||||
CP_XML_ATTR(L"color2", std::wstring(L"#") + str_fill_color_);
|
||||
CP_XML_ATTR(L"type", L"solid");
|
||||
}//иначе это полная прозрачность
|
||||
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
|
||||
//{
|
||||
// CP_XML_ATTR(L"opacity", (dVal.get())/100.);
|
||||
// //CP_XML_ATTR(L"opacity2",(dVal.get())/100.);
|
||||
//}
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-color",strVal))
|
||||
CP_XML_ATTR(L"color", std::wstring(L"#") + strVal.get());
|
||||
else
|
||||
CP_XML_ATTR(L"color",L"#3465af"); //синенький
|
||||
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-opacity",dVal))
|
||||
{
|
||||
CP_XML_ATTR(L"opacity",(100.-dVal.get())/100.);
|
||||
}
|
||||
CP_XML_ATTR(L"endcap", L"flat");
|
||||
CP_XML_ATTR(L"joinstyle", L"round");
|
||||
CP_XML_ATTR(L"startarrow", L"block");
|
||||
CP_XML_ATTR(L"v:startarrowwidth", L"medium");
|
||||
CP_XML_ATTR(L"startarrowlength", L"medium");
|
||||
}
|
||||
CP_XML_NODE(L"x:ClientData")
|
||||
{
|
||||
CP_XML_ATTR(L"ObjectType", L"Note");
|
||||
CP_XML_NODE(L"x:MoveWithCells"){}
|
||||
CP_XML_NODE(L"x:SizeWithCells"){}
|
||||
CP_XML_NODE(L"x:AutoFill"){CP_XML_CONTENT("False");}
|
||||
CP_XML_NODE(L"x:Row"){CP_XML_CONTENT(c.row_);}
|
||||
CP_XML_NODE(L"x:Column"){CP_XML_CONTENT(c.col_);}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return ( xlsx_comment_.empty());
|
||||
@ -264,11 +144,6 @@ void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val)
|
||||
val.impl_->serialize(_Wostream);
|
||||
}
|
||||
|
||||
void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val)
|
||||
{
|
||||
val.impl_->serialize_vml(_Wostream);
|
||||
}
|
||||
|
||||
xlsx_comments_ptr xlsx_comments::create()
|
||||
{
|
||||
return boost::make_shared<xlsx_comments>();
|
||||
|
||||
@ -42,38 +42,24 @@ namespace oox {
|
||||
|
||||
struct _xlsx_comment
|
||||
{
|
||||
size_t left_, top_;
|
||||
size_t width_, height_;
|
||||
|
||||
std::wstring ref_;
|
||||
|
||||
int col_;
|
||||
int row_;
|
||||
|
||||
bool visibly_;
|
||||
|
||||
std::vector<odf_reader::_property> graphicProperties_;
|
||||
|
||||
std::wstring author_;
|
||||
std::wstring content_;
|
||||
};
|
||||
//class rels;
|
||||
|
||||
class xlsx_comments;
|
||||
typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
|
||||
struct comment_elm
|
||||
{
|
||||
comment_elm(std::wstring const & _filename, std::wstring const & _vml_filename, std::wstring const & _content, std::wstring const & _vml_content, xlsx_comments_ptr _comments)
|
||||
: filename(_filename), content(_content), comments(_comments),vml_filename(_vml_filename),vml_content(_vml_content)
|
||||
comment_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_comments_ptr _comments)
|
||||
: filename(_filename), content(_content), comments(_comments)
|
||||
{}
|
||||
xlsx_comments_ptr comments;
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
|
||||
std::wstring vml_filename;
|
||||
std::wstring vml_content;
|
||||
};
|
||||
|
||||
class xlsx_comments
|
||||
@ -87,10 +73,7 @@ public:
|
||||
void add(_xlsx_comment & d);
|
||||
bool empty() const;
|
||||
|
||||
friend void docx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
|
||||
friend void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
friend void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "../odf/datatypes/length.h"
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
//#include <formulasconvert.h>
|
||||
|
||||
namespace cpdoccore { namespace oox {
|
||||
|
||||
@ -46,32 +45,22 @@ typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
class xlsx_comments_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl()
|
||||
: next_comments_id_(1) ,next_file_id_(1)
|
||||
Impl() : next_comments_id_(1), next_file_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
|
||||
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
|
||||
|
||||
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
|
||||
comments_.push_back(comment_elm(fileName, content, comments));
|
||||
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
|
||||
}
|
||||
|
||||
const std::vector<comment_elm> & content() const
|
||||
{
|
||||
return comments_;
|
||||
@ -89,25 +78,17 @@ xlsx_comments_context_handle::xlsx_comments_context_handle()
|
||||
: impl_(new xlsx_comments_context_handle::Impl())
|
||||
{
|
||||
}
|
||||
|
||||
xlsx_comments_context_handle::~xlsx_comments_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
|
||||
{
|
||||
return impl_->add_comments_xml(content,vml_content, comments);
|
||||
return impl_->add_comments_xml(content, comments);
|
||||
}
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::get_vml_drawing_xml()
|
||||
{
|
||||
return impl_->get_vml_drawing_xml();
|
||||
}
|
||||
|
||||
const std::vector<comment_elm> & xlsx_comments_context_handle::content() const
|
||||
{
|
||||
return impl_->content();
|
||||
}
|
||||
|
||||
class xlsx_comments_context::Impl
|
||||
{
|
||||
public:
|
||||
@ -127,10 +108,6 @@ public:
|
||||
{
|
||||
xlsx_serialize(strm, *xlsx_comments_);
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
xlsx_serialize_vml(strm, *xlsx_comments_);
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return xlsx_comments_->empty();
|
||||
@ -154,40 +131,20 @@ xlsx_comments_context::~xlsx_comments_context()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_comments_context::start_comment (double width_pt, double height_pt, double x_pt, double y_pt)
|
||||
void xlsx_comments_context::start_comment(const std::wstring & ref)
|
||||
{
|
||||
impl_->current_.ref_ = L"";
|
||||
impl_->current_.width_ = width_pt;
|
||||
impl_->current_.height_ = height_pt;
|
||||
impl_->current_.left_ = x_pt;
|
||||
impl_->current_.top_ = y_pt;
|
||||
|
||||
impl_->current_.visibly_ = false;
|
||||
impl_->current_.ref_ = ref;
|
||||
}
|
||||
void xlsx_comments_context::add_content(std::wstring content)
|
||||
void xlsx_comments_context::add_content(const std::wstring & content)
|
||||
{
|
||||
impl_->current_.content_ = content;
|
||||
}
|
||||
void xlsx_comments_context::add_author(std::wstring author)
|
||||
void xlsx_comments_context::add_author(const std::wstring & author)
|
||||
{
|
||||
impl_->current_.author_ = author;
|
||||
}
|
||||
void xlsx_comments_context::set_visibly(bool Val)
|
||||
void xlsx_comments_context::end_comment()
|
||||
{
|
||||
impl_->current_.visibly_ = Val;
|
||||
}
|
||||
|
||||
std::vector<odf_reader::_property> & xlsx_comments_context::get_draw_properties()
|
||||
{
|
||||
return impl_->current_.graphicProperties_;
|
||||
|
||||
}
|
||||
void xlsx_comments_context::end_comment(std::wstring ref,int col, int row)
|
||||
{
|
||||
impl_->current_.ref_ = ref;
|
||||
impl_->current_.col_ = col;
|
||||
impl_->current_.row_ = row;
|
||||
|
||||
impl_->add_comment(impl_->current_);
|
||||
}
|
||||
|
||||
@ -200,11 +157,6 @@ void xlsx_comments_context::serialize(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
}
|
||||
void xlsx_comments_context::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
xlsx_comments_ptr xlsx_comments_context::get_comments()
|
||||
{
|
||||
return impl_->get_comments();
|
||||
|
||||
@ -45,16 +45,13 @@ class xlsx_table_metrics;
|
||||
class xlsx_comments;
|
||||
typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
|
||||
|
||||
|
||||
class xlsx_comments_context_handle
|
||||
{
|
||||
public:
|
||||
xlsx_comments_context_handle();
|
||||
~xlsx_comments_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments);
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_xml();
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments);
|
||||
const std::vector<comment_elm> & content() const;
|
||||
|
||||
friend class xlsx_comments_context;
|
||||
@ -72,21 +69,16 @@ public:
|
||||
xlsx_comments_context(xlsx_comments_context_handle & h);
|
||||
~xlsx_comments_context();
|
||||
|
||||
void start_comment(double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
void start_comment(const std::wstring & ref);
|
||||
|
||||
void add_content(std::wstring content);
|
||||
void add_author(std::wstring author);
|
||||
void add_content(const std::wstring & content);
|
||||
void add_author(const std::wstring & author);
|
||||
|
||||
std::vector<odf_reader::_property> & get_draw_properties();
|
||||
|
||||
void set_visibly(bool Val);
|
||||
|
||||
void end_comment(std::wstring ref,int col,int row);
|
||||
void end_comment();
|
||||
|
||||
bool empty() const;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
void serialize_vml (std::wostream & strm);
|
||||
void serialize (std::wostream & strm);
|
||||
xlsx_comments_ptr get_comments();
|
||||
|
||||
private:
|
||||
|
||||
@ -55,10 +55,17 @@ struct xlsx_dataValidation
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
|
||||
bool showErrorMessage = false;
|
||||
bool showInputMessage = false;
|
||||
bool showDropDown = false;
|
||||
bool allowBlank = false;
|
||||
|
||||
std::wstring error_text;
|
||||
std::wstring error_title;
|
||||
|
||||
std::wstring promt_text;
|
||||
std::wstring promt_title;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
@ -103,24 +110,23 @@ public:
|
||||
if (jt2_next == mapCells.end() || jt2->first + 1 != jt2_next->first)
|
||||
break;
|
||||
|
||||
size_t j = 0; bool bFound = false;
|
||||
for (size_t j = 0; j < jt2_next->second.size(); j++)
|
||||
//size_t j = 0;
|
||||
bool bFound = false;
|
||||
|
||||
for (std::vector<std::pair<int, int>>::iterator v_jt2 = jt2_next->second.begin();
|
||||
v_jt2 != jt2_next->second.end(); ++v_jt2)
|
||||
{
|
||||
if (jt1->second[i].first == jt2_next->second[j].first ||
|
||||
jt1->second[i].second == jt2_next->second[j].second)
|
||||
if (jt1->second[i].first == v_jt2->first ||
|
||||
jt1->second[i].second == v_jt2->second)
|
||||
{
|
||||
bFound = true;
|
||||
jt2_next->second.erase(v_jt2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound)
|
||||
{
|
||||
jt2_next->second.erase(jt2_next->second.begin() + j, jt2_next->second.begin() + j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (false == bFound)
|
||||
break;
|
||||
}
|
||||
|
||||
jt2 = jt2_next;
|
||||
}
|
||||
if (!activate_ref.empty()) activate_ref += L" ";
|
||||
@ -135,11 +141,33 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
if (!it->second->operator_.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
}
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
|
||||
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
if (!it->second->type.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
}
|
||||
if (!it->second->error_title.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"errorTitle", it->second->error_title);
|
||||
}
|
||||
if (!it->second->error_text.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"error", it->second->error_text);
|
||||
}
|
||||
if (!it->second->promt_title.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"promptTitle", it->second->promt_title);
|
||||
}
|
||||
if (!it->second->promt_text.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"prompt", it->second->promt_text);
|
||||
}
|
||||
|
||||
if (!it->second->formula1.empty())
|
||||
{
|
||||
@ -237,22 +265,26 @@ void xlsx_dataValidations_context::add(const std::wstring & name, const std::wst
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showInputMessage = val;
|
||||
pFind->second->showInputMessage = display;
|
||||
pFind->second->promt_title = title;
|
||||
pFind->second->promt_text = content;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
pFind->second->showErrorMessage = display;
|
||||
pFind->second->error_title = title;
|
||||
pFind->second->error_text = content;
|
||||
}
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
@ -261,10 +293,10 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
size_t pos;
|
||||
std::wstring val, val2;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
if ( std::wstring::npos != (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
{
|
||||
pFind->second->type = L"list";
|
||||
val = f.substr(24 + pos, f.size() - 25 - pos);
|
||||
@ -287,6 +319,108 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
}
|
||||
else if ( std::wstring::npos != (pos = f.find(L"is-true-formula")))
|
||||
{
|
||||
pFind->second->type = L"custom";
|
||||
val = f.substr(16 + pos, f.size() - 17 - pos);
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (std::wstring::npos != (pos = f.find(L"cell-content-is-date")))
|
||||
{
|
||||
pFind->second->type = L"date";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-decimal-number")))
|
||||
{
|
||||
pFind->second->type = L"decimal";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-time")))
|
||||
{
|
||||
pFind->second->type = L"time";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-whole-number")))
|
||||
{
|
||||
pFind->second->type = L"whole";
|
||||
}
|
||||
|
||||
if (std::wstring::npos != (pos = f.find(L"cell-content()==")))
|
||||
{
|
||||
pFind->second->operator_ = L"equal";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<>")))
|
||||
{
|
||||
pFind->second->operator_ = L"notEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<=")))
|
||||
{
|
||||
pFind->second->operator_ = L"lessThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<")))
|
||||
{
|
||||
pFind->second->operator_ = L"lessThan";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 15);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 15, pos2 - pos - 15);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()>=")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()>")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThan";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 15);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 15, pos2 - pos - 15);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-not-between(")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L",", pos + 27);
|
||||
size_t pos3 = f.rfind(L")");
|
||||
|
||||
val = f.substr(pos + 27, pos2 - pos - 27);
|
||||
val2 = f.substr(pos2 + 1, pos3 - pos2 - 1);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-between(")))
|
||||
{
|
||||
pFind->second->operator_ = L"between";
|
||||
|
||||
size_t pos2 = f.find(L",", pos + 24);
|
||||
size_t pos3 = f.rfind(L")");
|
||||
|
||||
val = f.substr(pos + 24, pos2 - pos - 24);
|
||||
val2 = f.substr(pos2 + 1, pos3 - pos2 - 1);
|
||||
}
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
pFind->second->formula2 = converter.convert(val2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ public:
|
||||
|
||||
void add(const std::wstring & name, /*int col, int row*/const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
void add_help_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display);
|
||||
void add_error_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display);
|
||||
|
||||
void activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/);
|
||||
|
||||
|
||||
@ -35,6 +35,30 @@
|
||||
#include <xml/utils.h>
|
||||
|
||||
#include "../odf/datatypes/custom_shape_types_convert.h"
|
||||
#include "../../formulasconvert/formulasconvert.h"
|
||||
|
||||
#define OBJ_Group 0x0000
|
||||
#define OBJ_Line 0x0001
|
||||
#define OBJ_Rectangle 0x0002
|
||||
#define OBJ_Oval 0x0003
|
||||
#define OBJ_Arc 0x0004
|
||||
#define OBJ_Text 0x0006
|
||||
#define OBJ_OfficeArt 0x001E
|
||||
#define OBJ_Polygon 0x0009
|
||||
#define OBJ_Picture 0x0008
|
||||
#define OBJ_Chart 0x0005
|
||||
#define OBJ_Button 0x0007
|
||||
#define OBJ_CheckBox 0x000B
|
||||
#define OBJ_RadioButton 0x000C
|
||||
#define OBJ_EditBox 0x000D
|
||||
#define OBJ_Label 0x000E
|
||||
#define OBJ_DialogBox 0x000F
|
||||
#define OBJ_SpinControl 0x0010
|
||||
#define OBJ_Scrollbar 0x0011
|
||||
#define OBJ_List 0x0012
|
||||
#define OBJ_GroupBox 0x0013
|
||||
#define OBJ_DropdownList 0x0014
|
||||
#define OBJ_Note 0x0019
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -48,7 +72,7 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
void xml_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
_CP_OPT(std::wstring) strTextContent;
|
||||
odf_reader::GetProperty ( val.additional, L"text-content", strTextContent);
|
||||
@ -71,28 +95,34 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::w
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
std::wstring xlsx_drawing_position::vml_serialize()
|
||||
{
|
||||
//emu -> pt = 1 / 12700 = 72.0 / (360000.0 * 2.54);
|
||||
return std::to_wstring(position.col) + L"," + std::to_wstring((int)(position.colOff / 12700)) + L"," +
|
||||
std::to_wstring(position.row) + L"," + std::to_wstring((int)(position.rowOff / 12700));
|
||||
}
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns_title, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE( ns + (ns.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
CP_XML_NODE( ns_title + (ns_title.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
{
|
||||
CP_XML_NODE(ns + L":col")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
|
||||
{
|
||||
CP_XML_CONTENT(position.col);
|
||||
}
|
||||
|
||||
CP_XML_NODE(ns + L":colOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
|
||||
}
|
||||
|
||||
CP_XML_NODE(ns + L":row")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
|
||||
{
|
||||
CP_XML_CONTENT(position.row);
|
||||
}
|
||||
|
||||
CP_XML_NODE(ns + L":rowOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
|
||||
}
|
||||
@ -100,7 +130,7 @@ void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring &
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
void xml_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -139,12 +169,12 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
xml_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
void xml_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -174,11 +204,11 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
xml_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
{//отображательная часть
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -206,7 +236,7 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
void xml_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -231,7 +261,7 @@ void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
{//отображательная часть
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -266,36 +296,37 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
void xml_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
if (val.type == typeShape)
|
||||
{
|
||||
xlsx_serialize_shape(strm, val, ns);
|
||||
xml_serialize_shape(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
xlsx_serialize_image(strm, val, ns);
|
||||
xml_serialize_image(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeChart)
|
||||
{
|
||||
xlsx_serialize_chart(strm, val);
|
||||
xml_serialize_chart(strm, val);
|
||||
}
|
||||
else if (val.type == typeGroupShape)
|
||||
{
|
||||
xlsx_serialize_group(strm, val, ns);
|
||||
xml_serialize_group(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject ||
|
||||
val.type == typeControl)
|
||||
{
|
||||
xlsx_serialize_object(strm, val);
|
||||
xml_serialize_object(strm, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
return xlsx_serialize(strm, *this, ns);
|
||||
return xml_serialize(strm, *this, ns);
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -308,7 +339,7 @@ void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
from_.serialize (CP_XML_STREAM());
|
||||
to_.serialize (CP_XML_STREAM());
|
||||
|
||||
xlsx_serialize (CP_XML_STREAM(), *this, ns);
|
||||
xml_serialize (CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
@ -326,7 +357,7 @@ void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
@ -359,14 +390,12 @@ void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
{
|
||||
if (type != typeOleObject && type != typeMsObject) return;
|
||||
@ -390,9 +419,8 @@ void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,8 +450,8 @@ void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
from_.serialize (CP_XML_STREAM(), L"", L"xdr");
|
||||
to_.serialize (CP_XML_STREAM(), L"", L"xdr");
|
||||
|
||||
}
|
||||
}
|
||||
@ -431,6 +459,167 @@ void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
}
|
||||
|
||||
}
|
||||
void _xlsx_drawing::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:shape")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(id));
|
||||
CP_XML_ATTR(L"type", sub_type == OBJ_Note ? L"#_x0000_t202" : L"#_x0000_t201");
|
||||
|
||||
std::wstring color;
|
||||
|
||||
if (fill.solid)
|
||||
color = fill.solid->color;
|
||||
|
||||
if (!color.empty())
|
||||
CP_XML_ATTR(L"fillcolor", L"#" + color);
|
||||
|
||||
CP_XML_ATTR(L"stroked", /*lined ? */L"t"/* : L"f"*/);
|
||||
|
||||
std::wstring style = L"position:absolute";
|
||||
//style +="margin-left:414.3pt;margin-top:70.2pt;width:144.15pt;height:96.75pt";
|
||||
|
||||
CP_XML_ATTR(L"style", style);
|
||||
CP_XML_NODE(L"v:shadow")
|
||||
{
|
||||
CP_XML_ATTR(L"on", L"t");
|
||||
CP_XML_ATTR(L"obscured", L"t");
|
||||
CP_XML_ATTR(L"color", L"black");
|
||||
}
|
||||
//CP_XML_NODE(L"w10:wrap")
|
||||
//{
|
||||
// CP_XML_ATTR(L"type", L"none");
|
||||
//}
|
||||
vml_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
vml_serialize_ln(CP_XML_STREAM(), additional);
|
||||
|
||||
CP_XML_NODE(L"x:ClientData")
|
||||
{
|
||||
switch(sub_type)
|
||||
{
|
||||
case OBJ_Button: CP_XML_ATTR(L"ObjectType", L"Button"); break;
|
||||
case OBJ_CheckBox: CP_XML_ATTR(L"ObjectType", L"Checkbox");break;
|
||||
case OBJ_RadioButton: CP_XML_ATTR(L"ObjectType", L"Radio"); break;
|
||||
case OBJ_EditBox: CP_XML_ATTR(L"ObjectType", L"Edit"); break;
|
||||
case OBJ_Label: CP_XML_ATTR(L"ObjectType", L"Label"); break;
|
||||
case OBJ_DialogBox: CP_XML_ATTR(L"ObjectType", L"Dialog"); break;
|
||||
case OBJ_SpinControl: CP_XML_ATTR(L"ObjectType", L"Spin"); break;
|
||||
case OBJ_Scrollbar: CP_XML_ATTR(L"ObjectType", L"Scroll"); break;
|
||||
case OBJ_List: CP_XML_ATTR(L"ObjectType", L"List"); break;
|
||||
case OBJ_DropdownList: CP_XML_ATTR(L"ObjectType", L"List"); break;
|
||||
case OBJ_Note: CP_XML_ATTR(L"ObjectType", L"Note"); break;
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"x:MoveWithCells");
|
||||
CP_XML_NODE(L"x:SizeWithCells");
|
||||
CP_XML_NODE(L"x:Anchor")
|
||||
{
|
||||
CP_XML_STREAM() << from_.vml_serialize() << L"," << to_.vml_serialize();
|
||||
}
|
||||
CP_XML_NODE(L"x:AutoFill")
|
||||
{
|
||||
CP_XML_STREAM() << L"False";
|
||||
}
|
||||
|
||||
_CP_OPT(int) base_col, base_row;
|
||||
GetProperty(additional, L"base_col", base_col);
|
||||
GetProperty(additional, L"base_row", base_row);
|
||||
|
||||
if (base_row)
|
||||
{
|
||||
CP_XML_NODE(L"x:Row")
|
||||
{
|
||||
CP_XML_STREAM() << *base_row;
|
||||
}
|
||||
}
|
||||
if (base_col)
|
||||
{
|
||||
CP_XML_NODE(L"x:Column")
|
||||
{
|
||||
CP_XML_STREAM() << *base_col;
|
||||
}
|
||||
}
|
||||
_CP_OPT(std::wstring) sVal;
|
||||
GetProperty(additional, L"linked_cell", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
std::wstring fmla = converter.convert_named_ref(*sVal);
|
||||
CP_XML_NODE(L"x:FmlaLink")
|
||||
{
|
||||
CP_XML_STREAM() << fmla;
|
||||
}
|
||||
}
|
||||
_CP_OPT(bool) visible;
|
||||
GetProperty(additional, L"visible", visible);
|
||||
if (visible)
|
||||
{
|
||||
if (*visible == false)
|
||||
{
|
||||
CP_XML_NODE(L"x:Visible")
|
||||
{
|
||||
CP_XML_STREAM() << L"False";
|
||||
}
|
||||
}
|
||||
else
|
||||
CP_XML_NODE(L"x:Visible");
|
||||
}
|
||||
|
||||
_CP_OPT(int) nVal;
|
||||
GetProperty(additional, L"min_value", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Min")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"max_value", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Max")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"step", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Inc")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"page_step", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Page")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"value", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Val")
|
||||
{
|
||||
CP_XML_STREAM() << *sVal;
|
||||
}
|
||||
}
|
||||
|
||||
GetProperty(additional, L"orientation", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
if (*sVal == L"horizontal") CP_XML_NODE(L"x:Horiz");
|
||||
else CP_XML_NODE(L"x:Vert");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,10 +49,10 @@ struct xlsx_drawing_position
|
||||
enum type_t {from, to} type;
|
||||
xlsx_table_position position;
|
||||
|
||||
void serialize(std::wostream & _Wostream, const std::wstring & ns = L"xdr");
|
||||
void serialize(std::wostream & _Wostream, const std::wstring & ns_title = L"xdr", const std::wstring & ns = L"xdr");
|
||||
std::wstring vml_serialize();
|
||||
};
|
||||
|
||||
|
||||
class _xlsx_drawing : public _oox_drawing
|
||||
{
|
||||
public:
|
||||
@ -71,6 +71,7 @@ public:
|
||||
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns);
|
||||
void serialize_vml (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
};
|
||||
|
||||
@ -53,15 +53,21 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems_ptr & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems_ptr & items) : items_(items), next_drawing_id_(1), next_vml_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return items_; }
|
||||
|
||||
size_t next_rId()
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
{
|
||||
return next_rId_++;
|
||||
const std::wstring id = std::to_wstring(next_vml_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"vmlDrawing") + id + L".vml";
|
||||
|
||||
drawings_vml_.push_back(drawing_elm(fileName, content, drawings, typeDefault));
|
||||
const std::wstring rId = std::wstring(L"rVId") + id;
|
||||
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
@ -75,20 +81,26 @@ public:
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
const std::vector<drawing_elm> & content_vml() const
|
||||
{
|
||||
return drawings_vml_;
|
||||
}
|
||||
private:
|
||||
mediaitems_ptr items_;
|
||||
std::vector<drawing_elm> drawings_;
|
||||
|
||||
std::vector<drawing_elm> drawings_;
|
||||
std::vector<drawing_elm> drawings_vml_;
|
||||
|
||||
size_t next_rId_;
|
||||
size_t next_drawing_id_;
|
||||
size_t next_vml_drawing_id_;
|
||||
};
|
||||
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems_ptr & items) :
|
||||
impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
next_rId_(1), impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
{
|
||||
}
|
||||
|
||||
@ -100,12 +112,19 @@ std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_x
|
||||
{
|
||||
return impl_->add_drawing_xml(content, drawings, type_);
|
||||
}
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
{
|
||||
return impl_->add_drawing_vml(content, drawings);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
{
|
||||
return impl_->content();
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content_vml() const
|
||||
{
|
||||
return impl_->content_vml();
|
||||
}
|
||||
class xlsx_drawing_context::Impl
|
||||
{
|
||||
public:
|
||||
@ -131,15 +150,21 @@ public:
|
||||
{
|
||||
xlsx_drawings_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
xlsx_drawings_->serialize_vml(strm);
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return xlsx_drawings_->empty();
|
||||
}
|
||||
|
||||
bool vml_empty() const
|
||||
{
|
||||
return xlsx_drawings_->vml_empty();
|
||||
}
|
||||
size_t next_rId()
|
||||
{
|
||||
return handle_->impl_->next_rId();
|
||||
return handle_->next_rId();
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr get_drawings()
|
||||
@ -282,7 +307,29 @@ void xlsx_drawing_context::end_shape()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::start_comment(int base_col, int base_row)
|
||||
{
|
||||
impl_->object_description_.type_ = typeComment;
|
||||
impl_->object_description_.shape_type_ = 0x0019; // OBJ_Note object type for vml
|
||||
|
||||
set_property(odf_reader::_property(L"base_col", base_col));
|
||||
set_property(odf_reader::_property(L"base_row", base_row));
|
||||
}
|
||||
void xlsx_drawing_context::end_comment()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::start_control(const std::wstring & ctrlPropId, int type)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.shape_type_ = type; // object type for vml
|
||||
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::end_control()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::set_use_image_replacement()
|
||||
{
|
||||
impl_->use_image_replacement_ = true;
|
||||
@ -305,11 +352,6 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
impl_->object_description_.descriptor_ = progId;
|
||||
}
|
||||
void xlsx_drawing_context::set_control(const std::wstring & ctrlPropId)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
@ -446,7 +488,10 @@ bool xlsx_drawing_context::empty() const
|
||||
{
|
||||
return impl_->empty();
|
||||
}
|
||||
|
||||
bool xlsx_drawing_context::vml_empty() const
|
||||
{
|
||||
return impl_->vml_empty();
|
||||
}
|
||||
void xlsx_drawing_context::process_common_properties(drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics)
|
||||
{
|
||||
if (obj.anchor_.empty())
|
||||
@ -585,7 +630,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, false, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
@ -597,7 +642,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.fill.bitmap->rId , ref, typeImage);//объект
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
}
|
||||
|
||||
@ -610,8 +655,9 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -637,10 +683,11 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
}
|
||||
|
||||
if (obj.type_ == typeControl)
|
||||
if (obj.type_ == typeControl || obj.type_ == typeComment)
|
||||
{
|
||||
drawing.objectId = obj.xlink_href_;
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -651,14 +698,14 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
}
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
@ -702,7 +749,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
drawing.lined = obj.lined_;
|
||||
drawing.connector = obj.connector_;
|
||||
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
@ -712,7 +759,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet);//собственно это не объект, а доп рел и ref объекта
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
//object dumps in sheet rels !!
|
||||
}
|
||||
@ -727,8 +774,8 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject:
|
||||
case typeControl:
|
||||
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeControl:
|
||||
case typeComment: process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -737,6 +784,10 @@ void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& n
|
||||
{
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
void xlsx_drawing_context::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
|
||||
{
|
||||
|
||||
@ -63,10 +63,20 @@ public:
|
||||
~xlsx_drawing_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
const std::vector<drawing_elm> & content_vml() const;
|
||||
|
||||
friend class xlsx_drawing_context;
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return next_rId_++;
|
||||
}
|
||||
private:
|
||||
size_t next_rId_;
|
||||
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
};
|
||||
@ -90,7 +100,6 @@ public:
|
||||
void end_group ();
|
||||
|
||||
void start_shape(int type);
|
||||
//...пока тока общие свойства ... частные для каждого объекта пооозже
|
||||
void end_shape();
|
||||
|
||||
void start_frame();
|
||||
@ -98,10 +107,15 @@ public:
|
||||
void set_chart (const std::wstring & path);
|
||||
void set_ole_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_ms_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_control (const std::wstring & ctrlPropId);
|
||||
void set_text_box ();
|
||||
void end_frame();
|
||||
|
||||
void start_control(const std::wstring & ctrlPropId, int type);
|
||||
void end_control();
|
||||
|
||||
void start_comment(int base_col, int base_row);
|
||||
void end_comment();
|
||||
|
||||
void set_rect(double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
@ -110,13 +124,13 @@ public:
|
||||
|
||||
void set_rel_anchor (_INT32 owner_cx, _INT32 owner_cy);
|
||||
void set_anchor (std::wstring anchor, double x_pt, double y_pt, bool group = false);
|
||||
void set_property (odf_reader::_property p);
|
||||
void set_clipping (const std::wstring & str );
|
||||
void set_fill (_oox_fill & fill);
|
||||
|
||||
void set_is_line_shape(bool val);
|
||||
void set_is_connector_shape(bool val);
|
||||
|
||||
void set_property (odf_reader::_property p);
|
||||
std::vector<odf_reader::_property> & get_properties();
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
@ -124,9 +138,12 @@ public:
|
||||
void set_use_image_replacement();
|
||||
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
void clear();
|
||||
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
|
||||
void serialize_vml(std::wostream & strm);
|
||||
|
||||
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
|
||||
|
||||
|
||||
@ -46,18 +46,25 @@ class xlsx_drawings::Impl
|
||||
public:
|
||||
void add(_xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
|
||||
{
|
||||
xlsx_drawings_.push_back(d);
|
||||
|
||||
add (isInternal, rid, ref, type, sheet_rel);
|
||||
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
if (type == typeControl || type == typeControlProps || type == typeComment)
|
||||
{
|
||||
vml_drawings_.push_back(d);
|
||||
add (isInternal, rid, ref, type, sheet_rel, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawings_.push_back(d);
|
||||
add (isInternal, rid, ref, type, sheet_rel, false);
|
||||
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
xlsx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel) //не объект
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel) //не объект
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
@ -73,25 +80,37 @@ public:
|
||||
if (!present)
|
||||
xlsx_sheet_rels_.push_back (_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
else
|
||||
else if (vml_rel)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < vml_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
|
||||
if (vml_drawing_rels_[i].rid == rid && vml_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
}
|
||||
if (!present)
|
||||
xlsx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
vml_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0 ; i < drawing_rels_.size(); i++)
|
||||
{
|
||||
if (drawing_rels_[i].rid == rid && drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
}
|
||||
if (!present)
|
||||
drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
}
|
||||
|
||||
void serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (drawings_.empty()) return;
|
||||
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(strm, ns);
|
||||
drawings_[i].serialize(strm, ns);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -111,9 +130,74 @@ public:
|
||||
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
if (vml_drawings_.empty()) return;
|
||||
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
vml_drawings_[i].serialize_vml(strm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xml")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
|
||||
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_t201");
|
||||
CP_XML_ATTR(L"o:spt", L"201"); // sptHostControl = 201
|
||||
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600r21600,l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_t202");
|
||||
CP_XML_ATTR(L"o:spt", L"202"); // sptTextBox = 202
|
||||
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600l21600,21600l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
vml_drawings_[i].serialize_vml(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,41 +205,62 @@ public:
|
||||
}
|
||||
void serialize_objects(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
|
||||
if (drawings_[i].type != typeOleObject && drawings_[i].type != typeMsObject) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_object(strm);
|
||||
drawings_[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
void serialize_controls(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeControl) continue;
|
||||
if (vml_drawings_[i].type != typeControl) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_control(strm);
|
||||
vml_drawings_[i].serialize_control(strm);
|
||||
}
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return (xlsx_drawings_.empty());
|
||||
return (drawings_.empty());
|
||||
}
|
||||
bool vml_empty() const
|
||||
{
|
||||
return (vml_drawings_.empty());
|
||||
}
|
||||
|
||||
void dump_rels_drawing(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].type == typeImage ||
|
||||
xlsx_drawing_rels_[i].type == typeMedia ||
|
||||
xlsx_drawing_rels_[i].type == typeChart ||
|
||||
xlsx_drawing_rels_[i].type == typeHyperlink )
|
||||
if (drawing_rels_[i].type == typeImage ||
|
||||
drawing_rels_[i].type == typeMedia ||
|
||||
drawing_rels_[i].type == typeChart ||
|
||||
drawing_rels_[i].type == typeHyperlink )
|
||||
{
|
||||
|
||||
Rels.add(relationship( xlsx_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(xlsx_drawing_rels_[i].type),
|
||||
(xlsx_drawing_rels_[i].is_internal ? std::wstring(L"../") + xlsx_drawing_rels_[i].ref : xlsx_drawing_rels_[i].ref),
|
||||
(xlsx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
Rels.add(relationship( drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(drawing_rels_[i].type),
|
||||
(drawing_rels_[i].is_internal ? std::wstring(L"../") + drawing_rels_[i].ref : drawing_rels_[i].ref),
|
||||
(drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
void dump_rels_vml_drawing(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0 ; i < vml_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (vml_drawing_rels_[i].type == typeImage ||
|
||||
vml_drawing_rels_[i].type == typeMedia ||
|
||||
vml_drawing_rels_[i].type == typeChart ||
|
||||
vml_drawing_rels_[i].type == typeHyperlink )
|
||||
{
|
||||
|
||||
Rels.add(relationship( vml_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(vml_drawing_rels_[i].type),
|
||||
(vml_drawing_rels_[i].is_internal ? std::wstring(L"../") + vml_drawing_rels_[i].ref : vml_drawing_rels_[i].ref),
|
||||
(vml_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -173,9 +278,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
std::vector<_xlsx_drawing> xlsx_drawings_;
|
||||
std::vector<_xlsx_drawing> drawings_;
|
||||
std::vector<_xlsx_drawing> vml_drawings_;
|
||||
|
||||
std::vector<_rel> xlsx_drawing_rels_;
|
||||
std::vector<_rel> drawing_rels_;
|
||||
std::vector<_rel> vml_drawing_rels_;
|
||||
std::vector<_rel> xlsx_sheet_rels_;
|
||||
};
|
||||
|
||||
@ -194,15 +301,19 @@ void xlsx_drawings::add(_xlsx_drawing const & d, bool isInternal, std::wstring c
|
||||
impl_->add(d, isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel)
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel);
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
void xlsx_drawings::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
{
|
||||
@ -217,12 +328,18 @@ bool xlsx_drawings::empty() const
|
||||
{
|
||||
return impl_->empty();
|
||||
}
|
||||
|
||||
bool xlsx_drawings::vml_empty() const
|
||||
{
|
||||
return impl_->vml_empty();
|
||||
}
|
||||
void xlsx_drawings::dump_rels_drawing(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_drawing(Rels);
|
||||
}
|
||||
|
||||
void xlsx_drawings::dump_rels_vml_drawing(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_vml_drawing(Rels);
|
||||
}
|
||||
void xlsx_drawings::dump_rels_sheet(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_sheet(Rels);
|
||||
|
||||
@ -66,13 +66,17 @@ public:
|
||||
static xlsx_drawings_ptr create(bool inGroup);
|
||||
|
||||
void add ( _xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
|
||||
|
||||
bool empty () const;
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
void dump_rels_vml_drawing (rels & Rels);
|
||||
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns);
|
||||
void serialize_vml (std::wostream & _Wostream);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
std::wstringstream sheetFormat_;
|
||||
std::wstringstream sheetData_;
|
||||
std::wstringstream mergeCells_;
|
||||
std::wstringstream drawing_;
|
||||
std::wstringstream hyperlinks_;
|
||||
std::wstringstream comments_;
|
||||
std::wstringstream sort_;
|
||||
@ -130,10 +129,6 @@ std::wostream & xlsx_xml_worksheet::autofilter()
|
||||
{
|
||||
return impl_->autofilter_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::drawing()
|
||||
{
|
||||
return impl_->drawing_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::comments()
|
||||
{
|
||||
return impl_->comments_;
|
||||
@ -217,35 +212,40 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->page_props_.str().empty())
|
||||
if (false == impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (!impl_->commentsId_.empty())
|
||||
if (false == impl_->drawingId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"drawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", impl_->drawingId_);
|
||||
}
|
||||
}
|
||||
if (false == impl_->vml_drawingId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id",impl_->vml_drawingId_);
|
||||
CP_XML_ATTR(L"r:id", impl_->vml_drawingId_);
|
||||
}
|
||||
}
|
||||
if (!impl_->ole_objects_.str().empty())
|
||||
if (false == impl_->ole_objects_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"oleObjects")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->controls_.str().empty())
|
||||
if (false == impl_->controls_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"controls")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->tableParts_.str().empty())
|
||||
if (false == impl_->tableParts_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"tableParts")
|
||||
{
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
std::wostream & sheetData();
|
||||
std::wostream & hyperlinks();
|
||||
std::wostream & mergeCells();
|
||||
std::wostream & drawing();
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & tableParts();
|
||||
|
||||
@ -558,18 +558,20 @@ void xl_control_props_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms)
|
||||
{
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms));
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms), boost::ref(vml_elms));
|
||||
}
|
||||
|
||||
void xl_drawings::write(const std::wstring & RootPath)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
if (drawings_.empty() && vml_drawings_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
pptx_document *pptx = dynamic_cast<pptx_document*>(this->get_main_document());
|
||||
xlsx_document *xlsx = dynamic_cast<xlsx_document*>(this->get_main_document());
|
||||
docx_document *docx = dynamic_cast<docx_document*>(this->get_main_document());
|
||||
@ -594,6 +596,20 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
|
||||
contentTypes->add_override(override_str + drawings_[i].filename, kDrawingCT);
|
||||
}
|
||||
for (size_t i = 0; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(vml_drawings_[i].filename, vml_drawings_[i].content).write(path);
|
||||
|
||||
rels_files relFiles;
|
||||
rels_file_ptr r = rels_file::create(vml_drawings_[i].filename + L".rels");
|
||||
|
||||
vml_drawings_[i].drawings->dump_rels_vml_drawing(r->get_rels());
|
||||
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
//content types - default
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@ -604,9 +620,6 @@ xl_comments_ptr xl_comments::create(const std::vector<comment_elm> & elms)
|
||||
|
||||
void xl_comments::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring vml_path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(vml_path.c_str());
|
||||
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
@ -615,7 +628,6 @@ void xl_comments::write(const std::wstring & RootPath)
|
||||
contentTypes->add_override(std::wstring(L"/xl/") + comments_[i].filename, kWSConType);
|
||||
|
||||
package::simple_element(comments_[i].filename, comments_[i].content).write(RootPath);
|
||||
package::simple_element(comments_[i].vml_filename, comments_[i].vml_content).write(vml_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -244,20 +244,27 @@ class xl_drawings: public element
|
||||
{
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
|
||||
xl_drawings(const std::vector<drawing_elm> & elms) : drawings_ ( elms )
|
||||
|
||||
//void set_rels(rels_files * rels)
|
||||
// {
|
||||
// rels_ = rels;
|
||||
// }
|
||||
//void set_vml_rels(rels_files * rels)
|
||||
// {
|
||||
// vml_rels_ = rels;
|
||||
// }
|
||||
xl_drawings(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms) : drawings_(elms), vml_drawings_(vml_elms)
|
||||
{
|
||||
}
|
||||
|
||||
static xl_drawings_ptr create(const std::vector<drawing_elm> & elms);
|
||||
static xl_drawings_ptr create(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms);
|
||||
|
||||
private:
|
||||
const std::vector<drawing_elm> & drawings_;
|
||||
rels_files * rels_;
|
||||
const std::vector<drawing_elm> & vml_drawings_;
|
||||
|
||||
//rels_files * rels_;
|
||||
//rels_files * vml_rels_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
class xl_control_props_files : public element
|
||||
|
||||
@ -340,6 +340,12 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
|
||||
|
||||
// из за дебелизма мсофис которому ОБЯЗАТЕЛЬНО нужно прописывать имена колонок таблицы (и они должны быть еще
|
||||
// прописаны и в самих данных таблицы !!
|
||||
|
||||
while (xlsx_data_ranges_[it->second]->header_values.size() > xlsx_data_ranges_[it->second]->cell_end.first -
|
||||
xlsx_data_ranges_[it->second]->cell_start.first + 1)
|
||||
{
|
||||
xlsx_data_ranges_[it->second]->header_values.pop_back();
|
||||
}
|
||||
int i = xlsx_data_ranges_[it->second]->header_values.size() - 1;
|
||||
for (; i >= 0; i--)
|
||||
{
|
||||
|
||||
@ -74,7 +74,10 @@ public:
|
||||
void start_drawing_content();
|
||||
std::wstring end_drawing_content();
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
void start_only_text();
|
||||
std::wstring end_only_text();
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
@ -94,6 +97,7 @@ private:
|
||||
bool in_span;
|
||||
bool in_paragraph;
|
||||
bool in_cell_content;
|
||||
bool only_text;
|
||||
|
||||
odf_reader::styles_container & styles_;
|
||||
odf_reader::text_format_properties_content * text_properties_cell_;
|
||||
@ -126,7 +130,7 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm)
|
||||
|
||||
|
||||
xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles),
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false)
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false),only_text(false)
|
||||
{
|
||||
local_styles_ptr_ = NULL;
|
||||
text_properties_cell_ = NULL;
|
||||
@ -136,7 +140,7 @@ void xlsx_text_context::Impl::add_text(const std::wstring & text)
|
||||
{
|
||||
text_ << text;
|
||||
|
||||
if (!in_comment && !in_draw)
|
||||
if (!in_comment && !in_draw && !only_text)
|
||||
dump_run();
|
||||
}
|
||||
|
||||
@ -149,7 +153,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
|
||||
{
|
||||
if (paragraphs_cout_++ > 0)
|
||||
{
|
||||
if ( in_comment == true )
|
||||
if ( in_comment || only_text)
|
||||
{
|
||||
// конец предыдущего абзаца и начало следующего
|
||||
//text_ << L" ";
|
||||
@ -169,7 +173,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
|
||||
|
||||
void xlsx_text_context::Impl::end_paragraph()
|
||||
{
|
||||
if (!in_comment && !in_draw)
|
||||
if (!in_comment && !in_draw && !only_text)
|
||||
{
|
||||
dump_run();
|
||||
paragraph_style_name_ = L"";
|
||||
@ -181,7 +185,7 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кус
|
||||
{
|
||||
int text_size = text_.str().length();
|
||||
|
||||
if (in_comment || in_draw)
|
||||
if (in_comment || in_draw || only_text)
|
||||
{
|
||||
if (( span_style_name_ != styleName && text_size > 0 ) || in_span)
|
||||
{
|
||||
@ -202,12 +206,12 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кус
|
||||
void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста
|
||||
//пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом
|
||||
{
|
||||
if (!in_comment)
|
||||
if (!in_comment && !only_text)
|
||||
{
|
||||
dump_run();
|
||||
span_style_name_=L"";
|
||||
span_style_name_ = L"";
|
||||
}
|
||||
in_span=false;
|
||||
in_span = false;
|
||||
}
|
||||
|
||||
std::wstring xlsx_text_context::Impl::end_span2()
|
||||
@ -375,7 +379,9 @@ std::wstring xlsx_text_context::Impl::dump_paragraph(/*bool last*/)
|
||||
|
||||
std::wstring str_run = run_.str();
|
||||
|
||||
if (str_run.length() > 0 || paragraph_style_name_.length() > 0)
|
||||
if (only_text) return str_run;
|
||||
|
||||
if (false == str_run.empty() || false == paragraph_style_name_.empty())
|
||||
{
|
||||
CP_XML_WRITER(paragraph_)
|
||||
{
|
||||
@ -402,8 +408,7 @@ std::wstring xlsx_text_context::Impl::dump_run()
|
||||
{
|
||||
const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
|
||||
|
||||
if (content.empty())
|
||||
return L"";
|
||||
if (content.empty()) return L"";
|
||||
|
||||
std::wstring prefix_draw;
|
||||
if (in_draw) prefix_draw = L"a:";
|
||||
@ -449,7 +454,35 @@ void xlsx_text_context::Impl::start_cell_content()
|
||||
|
||||
text_properties_cell_ = NULL;
|
||||
}
|
||||
void xlsx_text_context::Impl::start_only_text()
|
||||
{
|
||||
paragraphs_cout_ = 0;
|
||||
|
||||
run_.str(std::wstring());
|
||||
paragraph_.str(std::wstring());
|
||||
text_.str(std::wstring());
|
||||
|
||||
paragraph_style_name_ = L"";
|
||||
span_style_name_ = L"";
|
||||
|
||||
only_text = true;
|
||||
}
|
||||
std::wstring xlsx_text_context::Impl::end_only_text()
|
||||
{
|
||||
std::wstring message = dump_run();
|
||||
|
||||
paragraphs_cout_ = 0;
|
||||
|
||||
run_.str(std::wstring());
|
||||
paragraph_.str(std::wstring());
|
||||
text_.str(std::wstring());
|
||||
|
||||
paragraph_style_name_ = L"";
|
||||
span_style_name_ = L"";
|
||||
|
||||
only_text = false;
|
||||
return message;
|
||||
}
|
||||
void xlsx_text_context::Impl::start_comment_content()
|
||||
{
|
||||
paragraphs_cout_ = 0;
|
||||
@ -585,26 +618,30 @@ bool xlsx_text_context::is_drawing_context()
|
||||
{
|
||||
return impl_->is_drawing_context();
|
||||
}
|
||||
|
||||
void xlsx_text_context::start_cell_content()
|
||||
{
|
||||
return impl_->start_cell_content();
|
||||
}
|
||||
|
||||
int xlsx_text_context::end_cell_content()
|
||||
{
|
||||
return impl_->end_cell_content();
|
||||
}
|
||||
|
||||
void xlsx_text_context::start_comment_content()
|
||||
{
|
||||
return impl_->start_comment_content();
|
||||
}
|
||||
|
||||
std::wstring xlsx_text_context::end_comment_content()
|
||||
{
|
||||
return impl_->end_comment_content();
|
||||
}
|
||||
void xlsx_text_context::start_only_text()
|
||||
{
|
||||
return impl_->start_only_text();
|
||||
}
|
||||
std::wstring xlsx_text_context::end_only_text()
|
||||
{
|
||||
return impl_->end_only_text();
|
||||
}
|
||||
void xlsx_text_context::start_drawing_content()
|
||||
{
|
||||
return impl_->start_drawing_content();
|
||||
|
||||
@ -70,6 +70,9 @@ public:
|
||||
void start_cell_content();
|
||||
int end_cell_content();
|
||||
|
||||
void start_only_text();
|
||||
std::wstring end_only_text();
|
||||
|
||||
void start_comment_content();
|
||||
std::wstring end_comment_content();
|
||||
|
||||
|
||||
@ -332,8 +332,8 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
output_document_->get_xl_files().set_media(get_mediaitems());
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content(), drawing_context_handle_->content_vml());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
|
||||
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
|
||||
output_document_->get_xl_files().set_comments(comments);
|
||||
@ -514,33 +514,28 @@ void xlsx_conversion_context::end_table()
|
||||
= drawing_context_handle_->add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
current_sheet().set_drawing_link(drawingName.first, drawingName.second);
|
||||
|
||||
CP_XML_WRITER(current_sheet().drawing())
|
||||
{
|
||||
CP_XML_NODE(L"drawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", drawingName.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
get_table_context().serialize_background (current_sheet().drawing());
|
||||
if (false == get_drawing_context().vml_empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize_vml(strm);
|
||||
|
||||
const std::pair<std::wstring, std::wstring> vml_drawingName
|
||||
= drawing_context_handle_->add_drawing_vml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
if (!get_comments_context().empty())
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
//get_table_context().serialize_background (current_sheet().picture());
|
||||
|
||||
if (false == get_comments_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_comments_context().serialize(strm);
|
||||
|
||||
std::wstringstream vml_strm;
|
||||
get_comments_context().serialize_vml(vml_strm);
|
||||
|
||||
|
||||
const std::pair<std::wstring, std::wstring> commentsName
|
||||
= xlsx_comments_context_handle_.add_comments_xml(strm.str(), vml_strm.str(),get_comments_context().get_comments() );
|
||||
|
||||
const std::pair<std::wstring, std::wstring> vml_drawingName
|
||||
=xlsx_comments_context_handle_.get_vml_drawing_xml();
|
||||
= xlsx_comments_context_handle_.add_comments_xml(strm.str(), get_comments_context().get_comments() );
|
||||
|
||||
current_sheet().set_comments_link(commentsName.first, commentsName.second);
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
|
||||
@ -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_;
|
||||
};
|
||||
|
||||
|
||||
@ -333,10 +333,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";
|
||||
|
||||
@ -273,7 +273,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);
|
||||
|
||||
@ -1477,7 +1477,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){}
|
||||
|
||||
@ -712,11 +712,11 @@ public:
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
private:
|
||||
|
||||
@ -112,7 +112,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* styleInst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
|
||||
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
|
||||
if (styleInst)
|
||||
{
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
|
||||
@ -396,28 +396,75 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
oox::forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
form_element* control = dynamic_cast<form_element*>(state.element);
|
||||
if (!control) return;
|
||||
|
||||
if (state.ctrlPropId.empty())
|
||||
{
|
||||
std::wstring target;
|
||||
state.ctrlPropId = Context.get_mediaitems()->add_control_props(target);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
form_element* control = dynamic_cast<form_element*>(state.element);
|
||||
if (control)
|
||||
{
|
||||
control->serialize_control_props(strm);
|
||||
}
|
||||
control->serialize_control_props(strm);
|
||||
|
||||
Context.add_control_props(state.ctrlPropId, target, strm.str());
|
||||
}
|
||||
|
||||
Context.get_drawing_context().start_frame();
|
||||
Context.get_drawing_context().set_control(state.ctrlPropId);
|
||||
Context.get_drawing_context().start_control(state.ctrlPropId, control->object_type_);
|
||||
|
||||
common_xlsx_convert(Context);
|
||||
|
||||
if (control->linked_cell_)
|
||||
{
|
||||
|
||||
Context.get_drawing_context().end_frame();
|
||||
Context.get_drawing_context().set_property(_property(L"linked_cell", control->linked_cell_.get()));
|
||||
}
|
||||
if (control->disabled_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"disabled", control->disabled_->get()));
|
||||
}
|
||||
if (control->value_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"value", control->value_.get()));
|
||||
}
|
||||
else if (control->current_value_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"value", control->current_value_.get()));
|
||||
}
|
||||
//if (control->name_)
|
||||
//{
|
||||
// Context.get_drawing_context().set_name(control->name_.get());
|
||||
//}
|
||||
form_value_range* value_range = dynamic_cast<form_value_range*>(control);
|
||||
|
||||
if (value_range)
|
||||
{
|
||||
if (value_range->min_value_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"min_value", value_range->min_value_.get()));
|
||||
}
|
||||
if (value_range->max_value_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"max_value", value_range->max_value_.get()));
|
||||
}
|
||||
if (value_range->step_size_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"step", value_range->step_size_.get()));
|
||||
}
|
||||
if (value_range->page_step_size_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"page_step", value_range->page_step_size_.get()));
|
||||
}
|
||||
if (value_range->orientation_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"orientation", value_range->orientation_.get()));
|
||||
}
|
||||
}
|
||||
//_CP_OPT(std::wstring) label_;
|
||||
//_CP_OPT(std::wstring) title_;
|
||||
//_CP_OPT(odf_types::Bool) dropdown_;
|
||||
|
||||
Context.get_drawing_context().end_control();
|
||||
Context.get_drawing_context().clear();
|
||||
|
||||
}
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
#include <odf/odf_document.h>
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "draw_common.h"
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_utils.h"
|
||||
|
||||
@ -111,7 +111,7 @@ void office_annotation::add_child_element( xml::sax * Reader, const std::wstring
|
||||
|
||||
void office_annotation::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
office_annotation_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void office_annotation::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -159,19 +159,20 @@ void office_annotation::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
const _CP_OPT(length) svg_widthVal = office_annotation_attr_.svg_width_;
|
||||
const _CP_OPT(length) svg_widthVal = attr_.svg_width_;
|
||||
|
||||
const double width_cm = svg_widthVal.get_value_or(length(0)).get_value_unit(length::cm);
|
||||
const double width_pt = svg_widthVal.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
|
||||
const _CP_OPT(length) svg_heightVal =office_annotation_attr_.svg_height_;
|
||||
const _CP_OPT(length) svg_heightVal =attr_.svg_height_;
|
||||
|
||||
const double height_cm = svg_heightVal.get_value_or(length(0)).get_value_unit(length::cm);
|
||||
const double height_pt = svg_heightVal.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
|
||||
const double x_pt = office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double y_pt = office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
/////////////////////////////////
|
||||
const double x_pt = attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double y_pt = attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
|
||||
//-----------------------------------------------
|
||||
std::wstring date;
|
||||
std::wstring author;
|
||||
if (dc_date_)
|
||||
@ -182,11 +183,14 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
Context.get_comments_context().start_comment(width_pt, height_pt, x_pt, y_pt);
|
||||
if (office_annotation_attr_.display_)
|
||||
int col = Context.current_table_column(); if (col < 0) col = 0;
|
||||
int row = Context.current_table_row(); if (row < 0) row = 0;
|
||||
|
||||
std::wstring ref = oox::getCellAddress(col, row);
|
||||
//-----------------------------------------------
|
||||
Context.get_comments_context().start_comment(ref);
|
||||
if (attr_.display_)
|
||||
{
|
||||
Context.get_comments_context().set_visibly(office_annotation_attr_.display_.get());
|
||||
}
|
||||
|
||||
Context.get_text_context().start_comment_content();
|
||||
@ -196,13 +200,43 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
Context.get_comments_context().add_author(author);
|
||||
Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
|
||||
//----------- drawing part ---------------
|
||||
Context.get_drawing_context().start_comment(col, row);
|
||||
Context.get_drawing_context().start_drawing(L"");
|
||||
|
||||
Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt);
|
||||
if (attr_.display_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"visibly", attr_.display_.get()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/// Обрабатываем стиль draw
|
||||
if (attr_.draw_style_name_)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* styleInst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(*attr_.draw_style_name_, odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
|
||||
if (styleInst)
|
||||
{
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
instances.push_back(styleInst);
|
||||
}
|
||||
graphic_format_properties properties = calc_graphic_properties_content(instances);
|
||||
|
||||
//-----------------------------------------------
|
||||
properties.apply_to(Context.get_drawing_context().get_properties());
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
Context.get_drawing_context().set_fill(fill);
|
||||
}
|
||||
//-----------------------------------------------
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
|
||||
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
|
||||
attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
|
||||
if (styleInst)
|
||||
{
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
|
||||
@ -212,16 +246,13 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
graphic_format_properties graphicProperties = calc_graphic_properties_content(instances);
|
||||
|
||||
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
|
||||
|
||||
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
int col = Context.current_table_column(); if (col < 0) col = 0;
|
||||
int row = Context.current_table_row(); if (row < 0) row = 0;
|
||||
|
||||
std::wstring ref = oox::getCellAddress(col, row);
|
||||
|
||||
Context.get_comments_context().end_comment(ref, col, row);
|
||||
const std::wstring textStyleName = attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
Context.get_drawing_context().end_drawing();
|
||||
Context.get_drawing_context().end_comment();
|
||||
Context.get_drawing_context().clear();
|
||||
//-----------------------------------------------
|
||||
Context.get_comments_context().end_comment();
|
||||
}
|
||||
// officeooo:annotation
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -246,13 +277,13 @@ void officeooo_annotation::add_child_element( xml::sax * Reader, const std::wstr
|
||||
|
||||
void officeooo_annotation::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
office_annotation_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
const double x = 8 * office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double y = 8 * office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double x = 8 * attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double y = 8 * attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
/////////////////////////////////
|
||||
std::wstring date;
|
||||
std::wstring author;
|
||||
@ -283,7 +314,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
/// Обрабатываем стиль draw
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
|
||||
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
|
||||
attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
|
||||
if (styleInst)
|
||||
{
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
|
||||
@ -295,7 +326,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
|
||||
|
||||
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
|
||||
const std::wstring textStyleName = attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
Context.get_comments_context().end_comment();
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@ class office_annotation_attr
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::length) svg_y_;
|
||||
_CP_OPT(odf_types::length) svg_x_;
|
||||
_CP_OPT(odf_types::length) svg_width_;
|
||||
@ -123,9 +122,8 @@ 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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
office_annotation_attr office_annotation_attr_;
|
||||
office_annotation_attr attr_;
|
||||
|
||||
office_element_ptr dc_date_;
|
||||
office_element_ptr dc_creator_;
|
||||
@ -150,9 +148,8 @@ 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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
office_annotation_attr office_annotation_attr_;
|
||||
office_annotation_attr attr_;
|
||||
|
||||
office_element_ptr dc_date_;
|
||||
office_element_ptr dc_creator_;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -41,6 +41,30 @@
|
||||
#include "serialize_elements.h"
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#define OBJ_Group 0x0000
|
||||
#define OBJ_Line 0x0001
|
||||
#define OBJ_Rectangle 0x0002
|
||||
#define OBJ_Oval 0x0003
|
||||
#define OBJ_Arc 0x0004
|
||||
#define OBJ_Text 0x0006
|
||||
#define OBJ_OfficeArt 0x001E
|
||||
#define OBJ_Polygon 0x0009
|
||||
#define OBJ_Picture 0x0008
|
||||
#define OBJ_Chart 0x0005
|
||||
#define OBJ_Button 0x0007
|
||||
#define OBJ_CheckBox 0x000B
|
||||
#define OBJ_RadioButton 0x000C
|
||||
#define OBJ_EditBox 0x000D
|
||||
#define OBJ_Label 0x000E
|
||||
#define OBJ_DialogBox 0x000F
|
||||
#define OBJ_SpinControl 0x0010
|
||||
#define OBJ_Scrollbar 0x0011
|
||||
#define OBJ_List 0x0012
|
||||
#define OBJ_GroupBox 0x0013
|
||||
#define OBJ_DropdownList 0x0014
|
||||
#define OBJ_Note 0x0019
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
@ -207,7 +231,7 @@ const wchar_t * form_element::name = L"element";
|
||||
|
||||
void form_element::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"form:control_implementation", control_implementation_);
|
||||
CP_APPLY_ATTR(L"form:control-implementation", control_implementation_);
|
||||
CP_APPLY_ATTR(L"form:data-field", data_field_);
|
||||
CP_APPLY_ATTR(L"form:linked-cell", linked_cell_);
|
||||
CP_APPLY_ATTR(L"form:disabled", disabled_);
|
||||
@ -273,6 +297,7 @@ const wchar_t * form_button::name = L"button";
|
||||
|
||||
void form_button::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_Button;
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_button::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -302,7 +327,8 @@ void form_button::serialize_control_props(std::wostream & strm)
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
// form:text
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_text::ns = L"form";
|
||||
@ -310,6 +336,7 @@ const wchar_t * form_text::name = L"text";
|
||||
|
||||
void form_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_EditBox;
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_text::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -342,7 +369,8 @@ void form_text::serialize_control_props(std::wostream & strm)
|
||||
if (value_)
|
||||
CP_XML_ATTR(L"val", *value_);
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
void form_text::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
if (!draw) return;
|
||||
@ -397,6 +425,107 @@ void form_text::docx_convert_field(oox::docx_conversion_context & Context, draw_
|
||||
Context.finish_run();
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
// form:fixed-text
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_textarea::ns = L"form";
|
||||
const wchar_t * form_textarea::name = L"textarea";
|
||||
|
||||
// form:fixed-text
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_fixed_text::ns = L"form";
|
||||
const wchar_t * form_fixed_text::name = L"fixed-text";
|
||||
|
||||
void form_fixed_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_Label;
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_fixed_text::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(2);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_fixed_text::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(2);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_fixed_text::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", L"EditBox");
|
||||
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
|
||||
if (value_)
|
||||
CP_XML_ATTR(L"val", *value_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void form_fixed_text::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
if (!draw) return;
|
||||
|
||||
Context.output_stream() << L"<w:sdt>";
|
||||
Context.output_stream() << L"<w:sdtPr>";
|
||||
{
|
||||
if (name_)
|
||||
{
|
||||
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
|
||||
}
|
||||
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
|
||||
//<w:lock w:val="sdtLocked"/>
|
||||
//<w:placeholder>
|
||||
// <w:docPart w:val="DefaultPlaceholder_-1854013440"/>
|
||||
//</w:placeholder>
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtPr>";
|
||||
Context.output_stream() << L"<w:sdtContent>";
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
if (current_value_)
|
||||
{
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
|
||||
Context.output_stream() << L"</w:t>";
|
||||
}
|
||||
Context.finish_run();
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtContent>";
|
||||
Context.output_stream() << L"</w:sdt>";
|
||||
}
|
||||
void form_fixed_text::docx_convert_field(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
if (!draw) return;
|
||||
|
||||
XmlUtils::replace_all( *name_, L" ", L"_");
|
||||
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << *name_ << L"\"/><w:enabled/>";
|
||||
Context.output_stream() << L"</w:ffData></w:fldChar>";
|
||||
Context.finish_run();
|
||||
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:instrText>FORMTEXT</w:instrText>";
|
||||
Context.finish_run();
|
||||
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
|
||||
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t>" << *current_value_ << L"</w:t>";
|
||||
Context.finish_run();
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
// form:checkbox
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_checkbox::ns = L"form";
|
||||
@ -404,6 +533,8 @@ const wchar_t * form_checkbox::name = L"checkbox";
|
||||
|
||||
void form_checkbox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_CheckBox;
|
||||
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
CP_APPLY_ATTR(L"form:current-state", strVal);
|
||||
|
||||
@ -515,6 +646,7 @@ const wchar_t * form_combobox::name = L"combobox";
|
||||
|
||||
void form_combobox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_DropdownList;
|
||||
form_element::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"form:source-cell-range", source_cell_range_);
|
||||
@ -560,7 +692,7 @@ void form_combobox::serialize_control_props(std::wostream & strm)
|
||||
|
||||
if (linked_cell_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*linked_cell_);
|
||||
std::wstring fmla = converter.convert_named_ref(*linked_cell_);
|
||||
CP_XML_ATTR(L"fmlaLink", fmla);
|
||||
}
|
||||
if (source_cell_range_)
|
||||
@ -628,9 +760,6 @@ void form_combobox::docx_convert_sdt(oox::docx_conversion_context & Context, dra
|
||||
Context.finish_run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// form:listbox
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_listbox::ns = L"form";
|
||||
@ -638,6 +767,7 @@ const wchar_t * form_listbox::name = L"listbox";
|
||||
|
||||
void form_listbox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_List;
|
||||
form_element::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"form:source-cell-range", source_cell_range_);
|
||||
@ -678,7 +808,7 @@ void form_listbox::serialize_control_props(std::wostream & strm)
|
||||
|
||||
if (linked_cell_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*linked_cell_);
|
||||
std::wstring fmla = converter.convert_named_ref(*linked_cell_);
|
||||
CP_XML_ATTR(L"fmlaLink", fmla);
|
||||
}
|
||||
if (source_cell_range_)
|
||||
@ -693,13 +823,14 @@ void form_listbox::serialize_control_props(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
// form:button
|
||||
// form:date
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_date::ns = L"form";
|
||||
const wchar_t * form_date::name = L"date";
|
||||
|
||||
void form_date::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = 15;
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_date::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -767,6 +898,175 @@ void form_date::docx_convert_sdt(oox::docx_conversion_context & Context, draw_co
|
||||
Context.finish_run();
|
||||
}
|
||||
}
|
||||
// form:time
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_time::ns = L"form";
|
||||
const wchar_t * form_time::name = L"time";
|
||||
|
||||
void form_time::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = 16;
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_time::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(6);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_time::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(6);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_time::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
}
|
||||
void form_time::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
Context.finish_run();
|
||||
|
||||
Context.output_stream() << L"<w:sdt>";
|
||||
Context.output_stream() << L"<w:sdtPr>";
|
||||
{
|
||||
if (name_)
|
||||
{
|
||||
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
|
||||
}
|
||||
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
|
||||
|
||||
Context.output_stream() << L"<w:date>";
|
||||
Context.output_stream() << L"<w:dateFormat w:val=\"\"/>";
|
||||
Context.output_stream() << L"<w:lid w:val=\"en-US\"/>";
|
||||
Context.output_stream() << L"<w:storeMappedDataAs w:val=\"dateTime\"/>";
|
||||
Context.output_stream() << L"<w:calendar w:val=\"gregorian\"/>";
|
||||
Context.output_stream() << L"</w:date>";
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtPr>";
|
||||
Context.output_stream() << L"<w:sdtContent>";
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
if (current_value_)
|
||||
{
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.output_stream() << L"[Insert time]";
|
||||
}
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtContent>";
|
||||
Context.output_stream() << L"</w:sdt>";
|
||||
|
||||
if (label_)
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*label_ );
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
}
|
||||
// form:listbox
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_value_range::ns = L"form";
|
||||
const wchar_t * form_value_range::name = L"value-range";
|
||||
|
||||
void form_value_range::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
object_type_ = OBJ_Scrollbar;
|
||||
|
||||
form_element::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"form:min-value", min_value_);
|
||||
CP_APPLY_ATTR(L"form:max-value", max_value_);
|
||||
CP_APPLY_ATTR(L"form:step-size", step_size_);
|
||||
CP_APPLY_ATTR(L"form:page-step-size", page_step_size_);
|
||||
CP_APPLY_ATTR(L"form:orientation", orientation_);
|
||||
CP_APPLY_ATTR(L"form:delay-for-repeat", delay_for_repeat_);
|
||||
|
||||
if (control_implementation_)
|
||||
{
|
||||
if (control_implementation_->find(L"SpinButton") != std::wstring::npos)
|
||||
{
|
||||
object_type_ = OBJ_SpinControl;
|
||||
if (!orientation_) orientation_ = L"vertical";
|
||||
}
|
||||
else
|
||||
{
|
||||
object_type_ = OBJ_Scrollbar;
|
||||
if (!orientation_) orientation_ = L"horizontal";
|
||||
}
|
||||
}
|
||||
}
|
||||
void form_value_range::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!control_implementation_) return;
|
||||
|
||||
if (control_implementation_->find(L"SpinButton") != std::wstring::npos)
|
||||
Context.get_forms_context().start_element(7); //spin
|
||||
else
|
||||
Context.get_forms_context().start_element(8); //scroll
|
||||
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_value_range::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (!control_implementation_) return;
|
||||
|
||||
if (control_implementation_->find(L"SpinButton") != std::wstring::npos)
|
||||
Context.get_forms_context().start_element(7); //spin
|
||||
else
|
||||
Context.get_forms_context().start_element(8); //scroll
|
||||
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_value_range::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
if (!control_implementation_) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", object_type_ == OBJ_SpinControl ? L"Spin" : L"Scroll");
|
||||
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
|
||||
if (linked_cell_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_ref(*linked_cell_);
|
||||
CP_XML_ATTR(L"fmlaLink", fmla);
|
||||
}
|
||||
if (value_) CP_XML_ATTR(L"val", *value_);
|
||||
if (min_value_) CP_XML_ATTR(L"min", *min_value_);
|
||||
if (max_value_) CP_XML_ATTR(L"max", *max_value_);
|
||||
if (step_size_) CP_XML_ATTR(L"inc", *step_size_);
|
||||
if (page_step_size_)CP_XML_ATTR(L"page",*page_step_size_);
|
||||
if (orientation_)
|
||||
{
|
||||
if (*orientation_ == L"horizontal")
|
||||
CP_XML_ATTR(L"horiz", 1);
|
||||
else
|
||||
CP_XML_ATTR(L"verticalBar", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// form:item
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_item::ns = L"form";
|
||||
|
||||
@ -218,7 +218,7 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormElement;
|
||||
|
||||
form_element() {}
|
||||
form_element() : object_type_(0) {}
|
||||
|
||||
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);
|
||||
@ -253,6 +253,9 @@ public:
|
||||
_CP_OPT(std::wstring) xforms_bind_;
|
||||
_CP_OPT(std::wstring) current_value_;
|
||||
_CP_OPT(odf_types::Bool) dropdown_;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
int object_type_;
|
||||
};
|
||||
|
||||
// form:button
|
||||
@ -320,6 +323,43 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_text);
|
||||
|
||||
// form:fixed-text
|
||||
class form_fixed_text : public form_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormFixedText;
|
||||
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){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_fixed_text);
|
||||
|
||||
// form:textarea
|
||||
class form_textarea : public form_text
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormTextarea;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_textarea);
|
||||
|
||||
// form:checkbox
|
||||
class form_checkbox : public form_text
|
||||
{
|
||||
@ -352,6 +392,38 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_checkbox);
|
||||
|
||||
// form:value-range
|
||||
class form_value_range : public form_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormValueRange;
|
||||
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){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control *draw){}
|
||||
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw){}
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(int) min_value_;
|
||||
_CP_OPT(int) max_value_;
|
||||
_CP_OPT(int) step_size_;
|
||||
_CP_OPT(int) page_step_size_;
|
||||
_CP_OPT(std::wstring) orientation_;
|
||||
_CP_OPT(std::wstring) delay_for_repeat_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_value_range);
|
||||
|
||||
// form:combobox
|
||||
class form_combobox : public form_text
|
||||
{
|
||||
@ -442,10 +514,34 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_date);
|
||||
|
||||
// form:time
|
||||
class form_time : public form_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormTime;
|
||||
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){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_time);
|
||||
// form:item
|
||||
class form_item : public office_element_impl<form_item>
|
||||
{
|
||||
@ -470,7 +566,6 @@ CP_REGISTER_OFFICE_ELEMENT2(form_item);
|
||||
}
|
||||
//<form:connection-resource>7.6.2,
|
||||
//<form:file> 13.5.5,
|
||||
//<form:fixed-text> 13.5.10,
|
||||
//<form:form> 13.3,
|
||||
//<form:formatted-text> 13.5.6,
|
||||
//<form:frame> 13.5.19,
|
||||
@ -481,7 +576,3 @@ CP_REGISTER_OFFICE_ELEMENT2(form_item);
|
||||
//<form:image-frame> 13.5.20,
|
||||
//<form:number> 13.5.7,
|
||||
//<form:password> 13.5.4,
|
||||
//<form:radio> 13.5.18,
|
||||
//<form:textarea> 13.5.3,
|
||||
//<form:time>
|
||||
//<form:value-range> 13.5.24 and
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -1204,7 +1204,10 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
|
||||
double fontSizeVal = (fo_font_size_) ? process_font_size_impl(fo_font_size_, Context.get_styles_context().get_current_processed_style()) :
|
||||
process_font_size_impl(font_size(percent(100.0)), Context.get_styles_context().get_current_processed_style());
|
||||
|
||||
if (style_text_position_->get_type() == text_position::Percent)
|
||||
if (fontSizeVal <= 0)
|
||||
fontSizeVal = Context.get_current_fontSize();
|
||||
|
||||
if (style_text_position_->get_type() == text_position::Percent)
|
||||
{
|
||||
const double mul = style_text_position_->get_position().get_value() / 100.0;
|
||||
if (fontSizeVal > 0)
|
||||
|
||||
@ -90,11 +90,9 @@ public:
|
||||
|
||||
int process_font_size (const _CP_OPT(odf_types::font_size) & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
|
||||
|
||||
private:
|
||||
static double process_font_size_impl (const _CP_OPT(odf_types::font_size) & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
|
||||
static int process_font_weight (const _CP_OPT(odf_types::font_weight) & FontWeight);
|
||||
static int process_font_style (const _CP_OPT(odf_types::font_style) & FontStyle);
|
||||
public:
|
||||
|
||||
_CP_OPT(std::wstring) r_style_;
|
||||
_CP_OPT(odf_types::font_variant) fo_font_variant_;
|
||||
|
||||
@ -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";
|
||||
@ -1388,7 +1372,7 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true, false);
|
||||
}
|
||||
|
||||
Context.get_table_context().state()->set_background(fill.bitmap->rId);
|
||||
@ -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();
|
||||
|
||||
@ -775,7 +777,6 @@ public:
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_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);
|
||||
|
||||
@ -800,7 +801,6 @@ public:
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_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);
|
||||
|
||||
|
||||
@ -1249,11 +1249,31 @@ void table_content_validation::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
{
|
||||
if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_error_msg(name, true);
|
||||
table_error_message* error = dynamic_cast<table_error_message*>(content_[i].get());
|
||||
|
||||
Context.get_text_context().start_only_text();
|
||||
for (size_t j = 0 ; j < error->content_.size(); j++)
|
||||
{
|
||||
error->content_[j]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring content = Context.get_text_context().end_only_text();
|
||||
|
||||
Context.get_dataValidations_context().add_error_msg(name, error->table_title_.get_value_or(L""), content,
|
||||
error->table_display_ ? error->table_display_->get() : true);
|
||||
}
|
||||
else if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
else if (content_[i]->get_type() == typeTableHelpMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_help_msg(name, true);
|
||||
table_help_message* help = dynamic_cast<table_help_message*>(content_[i].get());
|
||||
|
||||
Context.get_text_context().start_only_text();
|
||||
for (size_t j = 0 ; j < help->content_.size(); j++)
|
||||
{
|
||||
help->content_[j]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring content = Context.get_text_context().end_only_text();
|
||||
|
||||
Context.get_dataValidations_context().add_help_msg(name, help->table_title_.get_value_or(L""), content,
|
||||
help->table_display_ ? help->table_display_->get() : true);
|
||||
}
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
|
||||
@ -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_);
|
||||
|
||||
@ -370,7 +377,9 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (textStyle > 0)
|
||||
{
|
||||
is_empty = false;
|
||||
if (textStyle==1) Context.pop_text_properties();
|
||||
if (textStyle == 1) Context.pop_text_properties();
|
||||
|
||||
Context.pop_current_fontSize();
|
||||
}
|
||||
|
||||
Context.finish_run();
|
||||
@ -394,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();
|
||||
}
|
||||
|
||||
@ -506,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)
|
||||
{
|
||||
@ -559,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,6 +39,7 @@ core_debug {
|
||||
SOURCES += \
|
||||
../source/utils.cpp \
|
||||
../source/OdfFormat/office_document.cpp \
|
||||
../source/OdfFormat/office_forms.cpp \
|
||||
../source/OdfFormat/abstract_xml.cpp \
|
||||
../source/OdfFormat/calcext_elements.cpp \
|
||||
../source/OdfFormat/draw_base.cpp \
|
||||
@ -64,6 +65,7 @@ SOURCES += \
|
||||
../source/OdfFormat/odf_table_context.cpp \
|
||||
../source/OdfFormat/odf_table_styles_context.cpp \
|
||||
../source/OdfFormat/odf_text_context.cpp \
|
||||
../source/OdfFormat/odf_controls_context.cpp \
|
||||
../source/OdfFormat/ods_conversion_context.cpp \
|
||||
../source/OdfFormat/ods_table_context.cpp \
|
||||
../source/OdfFormat/ods_table_state.cpp \
|
||||
@ -142,6 +144,7 @@ HEADERS += \
|
||||
../source/OdfFormat/odf_table_context.h \
|
||||
../source/OdfFormat/odf_table_styles_context.h \
|
||||
../source/OdfFormat/odf_text_context.h \
|
||||
../source/OdfFormat/odf_controls_context.h \
|
||||
../source/OdfFormat/ods_conversion_context.h \
|
||||
../source/OdfFormat/ods_table_context.h \
|
||||
../source/OdfFormat/ods_table_state.h \
|
||||
@ -149,6 +152,7 @@ HEADERS += \
|
||||
../source/OdfFormat/office_annotation.h \
|
||||
../source/OdfFormat/office_body.h \
|
||||
../source/OdfFormat/office_chart.h \
|
||||
../source/OdfFormat/office_forms.h \
|
||||
../source/OdfFormat/office_elements.h \
|
||||
../source/OdfFormat/office_elements_create.h \
|
||||
../source/OdfFormat/office_elements_type.h \
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "../source/OdfFormat/office_document.cpp"
|
||||
#include "../source/OdfFormat/office_forms.cpp"
|
||||
#include "../source/OdfFormat/calcext_elements.cpp"
|
||||
#include "../source/OdfFormat/draw_base.cpp"
|
||||
#include "../source/OdfFormat/draw_frame.cpp"
|
||||
@ -49,6 +50,7 @@
|
||||
#include "../source/OdfFormat/object_package.cpp"
|
||||
#include "../source/OdfFormat/odf_chart_context.cpp"
|
||||
#include "../source/OdfFormat/odf_comment_context.cpp"
|
||||
#include "../source/OdfFormat/odf_controls_context.cpp"
|
||||
#include "../source/OdfFormat/odf_notes_context.cpp"
|
||||
#include "../source/OdfFormat/odf_conversion_context.cpp"
|
||||
#include "../source/OdfFormat/odf_drawing_context.cpp"
|
||||
|
||||
@ -578,6 +578,55 @@ void draw_connector::reset_svg_path()
|
||||
//}
|
||||
}
|
||||
///////////////////////////////////////
|
||||
// draw:control
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
const wchar_t * draw_control::name = L"control";
|
||||
|
||||
void draw_control::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"xml:id", xml_id_);
|
||||
CP_XML_ATTR_OPT(L"draw:caption-id", caption_id_);
|
||||
CP_XML_ATTR_OPT(L"draw:control", control_id_);
|
||||
|
||||
draw_shape::serialize_attlist(CP_GET_XML_NODE());
|
||||
|
||||
draw_shape::serialize(CP_XML_STREAM());
|
||||
if (draw_glue_point_)
|
||||
draw_glue_point_->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
void draw_control::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"glue-point")
|
||||
{
|
||||
CP_CREATE_ELEMENT(draw_glue_point_);
|
||||
}
|
||||
else
|
||||
{
|
||||
//not_applicable_element(L"draw_enhanced_geometry", Reader, Ns, Name);
|
||||
}
|
||||
|
||||
}
|
||||
void draw_control::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDrawGluePoint)
|
||||
{
|
||||
draw_glue_point_ = child_element;
|
||||
}
|
||||
else
|
||||
{
|
||||
//not_applicable_element(L"draw_enhanced_geometry", Reader, Ns, Name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,13 +35,9 @@
|
||||
|
||||
#include "common_attlists.h"
|
||||
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
|
||||
class draw_shape : public draw_base
|
||||
{
|
||||
public:
|
||||
@ -64,8 +60,7 @@ public:
|
||||
int sub_type_;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_rect_attlist
|
||||
{
|
||||
public:
|
||||
@ -92,8 +87,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_rect);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_ellipse_attlist
|
||||
{
|
||||
public:
|
||||
@ -117,7 +111,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_ellipse);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_circle : public draw_shape
|
||||
{
|
||||
public:
|
||||
@ -131,7 +125,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_circle);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_line_attlist
|
||||
{
|
||||
public:
|
||||
@ -143,7 +137,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_line : public draw_shape
|
||||
{
|
||||
public:
|
||||
@ -160,7 +154,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_line);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_path_attlist
|
||||
{
|
||||
public:
|
||||
@ -169,7 +163,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_path : public draw_shape
|
||||
{
|
||||
public:
|
||||
@ -187,7 +181,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_path);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_polygon_attlist
|
||||
{
|
||||
public:
|
||||
@ -196,7 +190,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_polygon : public draw_shape
|
||||
{
|
||||
public:
|
||||
@ -214,9 +208,9 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_polygon);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_custom_shape : public draw_shape
|
||||
{
|
||||
public:
|
||||
@ -233,9 +227,9 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_custom_shape);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//draw:enhanced-geometry
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_equation_attlist//убрать стринги ... сделать парсинг см стр 378 оазис !!!!!!!!!!!
|
||||
{
|
||||
public:
|
||||
@ -244,7 +238,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_equation : public office_element_impl<draw_equation>
|
||||
{
|
||||
public:
|
||||
@ -265,13 +259,13 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_equation);
|
||||
////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
struct draw_handle_geometry
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
};
|
||||
//////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_handle_attlist//убрать стринги ... сделать парсинг см стр 378 оазис !!!!!!!!!!!
|
||||
{
|
||||
public:
|
||||
@ -290,7 +284,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_handle : public office_element_impl<draw_handle>
|
||||
{
|
||||
public:
|
||||
@ -312,7 +306,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_handle);
|
||||
/////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_enhanced_geometry_attlist
|
||||
{
|
||||
public:
|
||||
@ -336,7 +330,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_enhanced_geometry : public office_element_impl<draw_enhanced_geometry>
|
||||
{
|
||||
public:
|
||||
@ -371,7 +365,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_enhanced_geometry);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
class draw_caption : public draw_shape
|
||||
{
|
||||
@ -382,11 +376,11 @@ public:
|
||||
static const ElementType type = typeDrawCaption;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_caption);
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_connector_attlist
|
||||
{
|
||||
public:
|
||||
@ -396,7 +390,7 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_connector : public draw_line
|
||||
{
|
||||
public:
|
||||
@ -415,6 +409,30 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_connector);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDrawControl;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_control);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@ -43,19 +43,11 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
|
||||
_mediaitems::item::item(std::wstring const & _oox_ref,
|
||||
Type _type,
|
||||
std::wstring const & _odf_ref
|
||||
)
|
||||
: oox_ref(_oox_ref),
|
||||
type(_type),
|
||||
odf_ref(_odf_ref)
|
||||
_mediaitems::item::item(const std::wstring & _oox_ref, Type _type, const std::wstring & _odf_ref)
|
||||
: oox_ref(_oox_ref), type(_type), odf_ref(_odf_ref)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref)
|
||||
{
|
||||
std::wstring output_sub_path;
|
||||
@ -119,8 +111,9 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
|
||||
{
|
||||
count_image_object++;
|
||||
}
|
||||
item item_(input_path, type, xml::utils::replace_text_to_xml(output_path));
|
||||
|
||||
items_.push_back( item(input_path, type, xml::utils::replace_text_to_xml(output_path)) );
|
||||
items_.push_back(item_);
|
||||
}
|
||||
odf_ref = output_path;
|
||||
}
|
||||
|
||||
@ -44,39 +44,37 @@ class _mediaitems
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia, typeOleObject, typeObjectReplacement};
|
||||
|
||||
struct item
|
||||
{
|
||||
item(const std::wstring & _oox_ref, Type _type, const std::wstring & _odf_ref);
|
||||
|
||||
Type type = typeUnknown;
|
||||
|
||||
std::wstring oox_ref;
|
||||
std::wstring odf_ref;
|
||||
};
|
||||
_mediaitems()
|
||||
{
|
||||
count_image = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_image_object = 0;
|
||||
count_control = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
{
|
||||
item(
|
||||
std::wstring const & _oox_ref,
|
||||
Type _type,
|
||||
std::wstring const & _odf_ref);
|
||||
|
||||
std::wstring oox_ref;
|
||||
Type type;
|
||||
std::wstring odf_ref;
|
||||
};
|
||||
typedef std::vector< item > items_array;
|
||||
|
||||
size_t count_image;
|
||||
size_t count_media;
|
||||
size_t count_object;
|
||||
size_t count_image_object;
|
||||
size_t count_control;
|
||||
|
||||
void add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref);
|
||||
|
||||
void dump_rels(rels & Rels, std::wstring local_path = L"");
|
||||
items_array & items() { return items_; }
|
||||
std::vector<item> & items() { return items_; }
|
||||
|
||||
private:
|
||||
items_array items_;
|
||||
std::vector<item> items_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -385,7 +385,7 @@ void odf_chart_context::set_chart_size(_CP_OPT(double) width_pt, _CP_OPT(double)
|
||||
chart->chart_chart_attlist_.common_draw_size_attlist_.svg_width_ = length(length(*width_pt,length::pt).get_value_unit(length::cm), length::cm);
|
||||
chart->chart_chart_attlist_.common_draw_size_attlist_.svg_height_ = length(length(*height_pt,length::pt).get_value_unit(length::cm), length::cm);
|
||||
}
|
||||
void odf_chart_context::set_chart_type(std::wstring type)
|
||||
void odf_chart_context::set_chart_type(const std::wstring & type)
|
||||
{
|
||||
chart_chart *chart = impl_->get_current_chart();
|
||||
if (!chart)return;
|
||||
@ -610,7 +610,7 @@ void odf_chart_context::set_chart_scatter_type(int type)
|
||||
void odf_chart_context::start_group_series()
|
||||
{
|
||||
}
|
||||
void odf_chart_context::start_series(std::wstring type)
|
||||
void odf_chart_context::start_series(const std::wstring & type)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"chart", L"series", elm, impl_->odf_context_);
|
||||
@ -677,6 +677,15 @@ void odf_chart_context::set_label_show_leader_line(bool val)
|
||||
void odf_chart_context::set_label_show_legend_key(bool val)
|
||||
{
|
||||
}
|
||||
void odf_chart_context::set_label_formula(const std::wstring & oox_formula) //в odf не поддерживается
|
||||
{
|
||||
std::wstring odf_formula = impl_->convert_formula(oox_formula);
|
||||
|
||||
if (!odf_formula.empty())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void odf_chart_context::set_label_show_percent(bool val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
@ -721,7 +730,7 @@ void odf_chart_context::end_group_series()
|
||||
|
||||
if (countX < 1 && countY > 1)
|
||||
{
|
||||
impl_->axis_[0].dimension == 1;
|
||||
impl_->axis_[0].dimension = 1;
|
||||
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[0].elm.get());
|
||||
axis->chart_axis_attlist_.chart_dimension_ = L"x";
|
||||
countY--;
|
||||
@ -760,7 +769,7 @@ void odf_chart_context::end_group_series()
|
||||
impl_->axis_group_series_.clear();
|
||||
}
|
||||
|
||||
void odf_chart_context::add_domain(std::wstring formula)
|
||||
void odf_chart_context::add_domain(const std::wstring & formula)
|
||||
{
|
||||
size_t level = impl_->current_level_.size();
|
||||
if (level == 0)return;
|
||||
@ -779,7 +788,7 @@ void odf_chart_context::add_domain(std::wstring formula)
|
||||
impl_->current_chart_state_.elements_.push_back(state);
|
||||
}
|
||||
|
||||
void odf_chart_context::add_categories(std::wstring odf_formula, office_element_ptr & axis)
|
||||
void odf_chart_context::add_categories(const std::wstring & odf_formula, office_element_ptr & axis)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"chart", L"categories", elm, impl_->odf_context_);
|
||||
@ -942,26 +951,41 @@ void odf_chart_context::end_text()
|
||||
{
|
||||
odf_text_context *text_context_ = text_context();
|
||||
|
||||
if (text_context_ == NULL || impl_->current_level_.size() < 1 )return;
|
||||
if (text_context_ == NULL || impl_->current_level_.empty())return;
|
||||
|
||||
for (size_t i = 0; i < text_context_->text_elements_list_.size(); i++)
|
||||
{
|
||||
if (text_context_->text_elements_list_[i].level ==0)
|
||||
if (text_context_->text_elements_list_[i].level == 0)
|
||||
{
|
||||
impl_->current_level_.back().elm->add_child_element(text_context_->text_elements_list_[i].elm);
|
||||
}
|
||||
size_t level_root = impl_->current_level_.size() + 1;
|
||||
|
||||
odf_element_state state={text_context_->text_elements_list_[i].elm,
|
||||
text_context_->text_elements_list_[i].style_name,
|
||||
text_context_->text_elements_list_[i].style_elm,
|
||||
text_context_->text_elements_list_[i].level + level_root};
|
||||
odf_element_state state = { text_context_->text_elements_list_[i].elm,
|
||||
text_context_->text_elements_list_[i].style_name,
|
||||
text_context_->text_elements_list_[i].style_elm,
|
||||
text_context_->text_elements_list_[i].level + level_root};
|
||||
|
||||
impl_->current_chart_state_.elements_.push_back(state);
|
||||
}
|
||||
|
||||
impl_->odf_context_->end_text_context();
|
||||
}
|
||||
|
||||
void odf_chart_context::add_text(const std::wstring & val)
|
||||
{
|
||||
office_element_ptr paragr_elm;
|
||||
create_element(L"text", L"p", paragr_elm, impl_->odf_context_);
|
||||
|
||||
text_p* p = dynamic_cast<text_p*>(paragr_elm.get());
|
||||
if (p)
|
||||
p->add_text(val);
|
||||
|
||||
impl_->current_level_.back().elm->add_child_element(paragr_elm);
|
||||
|
||||
odf_element_state state = {paragr_elm, L"", office_element_ptr(), impl_->current_level_.size() + 1};
|
||||
impl_->current_chart_state_.elements_.push_back(state);
|
||||
}
|
||||
void odf_chart_context::set_textarea_vertical_align(int align)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
@ -1303,6 +1327,11 @@ void odf_chart_context::set_axis_id(unsigned int id)
|
||||
{
|
||||
if (impl_->axis_.size()>0)impl_->axis_.back().oox_id = id;
|
||||
}
|
||||
void odf_chart_context::set_axis_visible(bool val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_visible_ = val;
|
||||
}
|
||||
void odf_chart_context::set_axis_dimension(int type)
|
||||
{
|
||||
chart_axis *axis = impl_->get_current_axis();
|
||||
@ -1394,7 +1423,7 @@ void odf_chart_context::set_layout_h(double *val,int mode)
|
||||
if (plot_area)plot_area->chart_plot_area_attlist_.common_draw_size_attlist_.svg_height_ = height_cm;
|
||||
}
|
||||
|
||||
void odf_chart_context::start_element(office_element_ptr & elm, office_element_ptr & style_elm, std::wstring style_name)
|
||||
void odf_chart_context::start_element(office_element_ptr & elm, office_element_ptr & style_elm, const std::wstring & style_name)
|
||||
{
|
||||
size_t level = impl_->current_level_.size();
|
||||
|
||||
@ -1402,14 +1431,13 @@ void odf_chart_context::start_element(office_element_ptr & elm, office_element_p
|
||||
//if (impl_->current_level_.size()>0) impl_->current_level_.back()->add_child_element(elm); не надо...наследование через start_element в drawing
|
||||
|
||||
odf_element_state state={elm, style_name, style_elm, level};
|
||||
odf_chart_level_state level_state = {NULL,NULL,NULL,NULL,elm};
|
||||
odf_chart_level_state level_state = {NULL, NULL, NULL, NULL, elm};
|
||||
|
||||
impl_->current_chart_state_.elements_.push_back(state);
|
||||
|
||||
style* style_ = dynamic_cast<style*>(style_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
style_name = style_->style_name_;
|
||||
level_state.chart_properties_ = style_->content_.get_style_chart_properties();
|
||||
}
|
||||
impl_->current_level_.push_back(level_state);//стоит ли сюда перенести и current_chart_properties ????
|
||||
@ -1485,7 +1513,7 @@ void odf_chart_context::end_chart()
|
||||
impl_->clear_current();
|
||||
}
|
||||
|
||||
void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
|
||||
void odf_chart_context::set_series_value_formula(const std::wstring & oox_formula)
|
||||
{
|
||||
std::wstring odf_formula = impl_->convert_formula(oox_formula);
|
||||
|
||||
@ -1502,7 +1530,7 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
|
||||
}
|
||||
}
|
||||
|
||||
void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
|
||||
void odf_chart_context::set_series_label_formula(const std::wstring & oox_formula)
|
||||
{
|
||||
std::wstring odf_formula = impl_->convert_formula(oox_formula);
|
||||
|
||||
@ -1518,7 +1546,7 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
|
||||
}
|
||||
}
|
||||
|
||||
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula, int type)
|
||||
void odf_chart_context::set_category_axis_formula(const std::wstring & oox_formula, int type)
|
||||
{
|
||||
std::wstring odf_formula = impl_->convert_formula(oox_formula);
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
odf_text_context *text_context();
|
||||
|
||||
void start_chart (office_element_ptr & root);
|
||||
void set_chart_type (std::wstring type);
|
||||
void set_chart_type (const std::wstring & type);
|
||||
void set_chart_3D (bool Val);
|
||||
void set_chart_size (_CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
|
||||
void set_chart_colored (bool val);
|
||||
@ -81,10 +81,10 @@ public:
|
||||
|
||||
void start_group_series();
|
||||
void add_axis_group_series(unsigned int id);
|
||||
void start_series (std::wstring type);
|
||||
void set_series_value_formula (std::wstring oox_formula);
|
||||
void set_series_label_formula (std::wstring oox_formula);
|
||||
void set_category_axis_formula (std::wstring oox_formula,int type);
|
||||
void start_series (const std::wstring & type);
|
||||
void set_series_value_formula (const std::wstring & oox_formula);
|
||||
void set_series_label_formula (const std::wstring & oox_formula);
|
||||
void set_category_axis_formula (const std::wstring & oox_formula, int type);
|
||||
void start_data_point_series (int count);
|
||||
long get_count_data_points_series();
|
||||
|
||||
@ -93,7 +93,8 @@ public:
|
||||
void end_series();
|
||||
void end_group_series();
|
||||
|
||||
void set_label_name (std::wstring name);
|
||||
void set_label_formula (const std::wstring & oox_formula);
|
||||
void set_label_name (const std::wstring & name);
|
||||
void set_label_delete (bool val);
|
||||
void set_label_show_bubble_size (bool val);
|
||||
void set_label_show_cat_name (bool val);
|
||||
@ -116,6 +117,7 @@ public:
|
||||
void set_axis_min(double val);
|
||||
void set_axis_tick_minor(int type);
|
||||
void set_axis_tick_major(int type);
|
||||
void set_axis_visible(bool val);
|
||||
void start_title();
|
||||
void start_grid(int type);
|
||||
void start_legend();
|
||||
@ -131,9 +133,11 @@ public:
|
||||
void set_stock_loss_marker_width(std::wstring val);
|
||||
void start_stock_range_line();
|
||||
|
||||
void start_element(office_element_ptr & elm, office_element_ptr & style_elm, std::wstring style_name);
|
||||
void start_element(office_element_ptr & elm, office_element_ptr & style_elm, const std::wstring & style_name);
|
||||
void end_element();
|
||||
|
||||
void add_text(const std::wstring & val);
|
||||
|
||||
void start_text();
|
||||
void end_text();
|
||||
|
||||
@ -141,8 +145,8 @@ public:
|
||||
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
|
||||
void set_textarea_rotation (double val);
|
||||
|
||||
void add_domain(std::wstring formula);
|
||||
void add_categories(std::wstring formula, office_element_ptr & axis);
|
||||
void add_domain(const std::wstring & formula);
|
||||
void add_categories(const std::wstring & formula, office_element_ptr & axis);
|
||||
|
||||
void set_layout_x(double *val,int mode);
|
||||
void set_layout_y(double *val,int mode);
|
||||
|
||||
@ -104,7 +104,7 @@ void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
|
||||
office_annotation* comm = dynamic_cast<office_annotation*>(elm.get());
|
||||
if (!comm)return;
|
||||
|
||||
comm->office_annotation_attr_.name_ = impl_->comments_.back().odf_name;
|
||||
comm->attr_.name_ = impl_->comments_.back().odf_name;
|
||||
|
||||
|
||||
}
|
||||
@ -117,7 +117,7 @@ void odf_comment_context::end_comment(office_element_ptr &elm, int oox_id)
|
||||
office_annotation_end* comm = dynamic_cast<office_annotation_end*>(elm.get());
|
||||
if (!comm)return;
|
||||
|
||||
comm->office_annotation_attr_.name_ = impl_->comments_[i].odf_name;
|
||||
comm->attr_.name_ = impl_->comments_[i].odf_name;
|
||||
|
||||
impl_->comments_[i].state = 2;//stoped
|
||||
|
||||
@ -206,8 +206,8 @@ void odf_comment_context::set_position (double x, double y)
|
||||
|
||||
if (comm)
|
||||
{
|
||||
comm->office_annotation_attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
|
||||
comm->office_annotation_attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
|
||||
comm->attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
|
||||
comm->attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user