mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
4 Commits
v5.3.0.236
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c1b107998 | |||
| f2e003b12c | |||
| ee43592691 | |||
| 00328e88b2 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -64,4 +64,3 @@ X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
*.tar.gz
|
||||
**/*.build/
|
||||
|
||||
*.log
|
||||
|
||||
@ -769,18 +769,12 @@ namespace DocFileFormat
|
||||
|
||||
return bytes;
|
||||
}
|
||||
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));
|
||||
}
|
||||
static inline std::wstring SizeTToWideString(size_t value)
|
||||
{
|
||||
return (std::to_wstring((unsigned int)value));
|
||||
}
|
||||
|
||||
static inline std::wstring DoubleToWideString(double value)
|
||||
{
|
||||
std::wstringstream src;
|
||||
|
||||
@ -87,14 +87,15 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nDTTM = DateAndTime(reader->ReadUInt32());
|
||||
m_nDTTM = reader->ReadUInt32();
|
||||
reader->ReadUInt16(); //padding1
|
||||
m_nDepth = reader->ReadUInt32();
|
||||
m_nDiatrdParent = reader->ReadUInt32();
|
||||
unsigned int flag = reader->ReadUInt32();
|
||||
|
||||
m_fInkAtn = GETBIT(flag, 1);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "ByteStructure.h"
|
||||
#include "DateAndTime.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -73,7 +72,7 @@ namespace DocFileFormat
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
AnnotationReferenceExDescriptor() : m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -83,7 +82,7 @@ namespace DocFileFormat
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
DateAndTime m_nDTTM;
|
||||
unsigned int m_nDTTM;
|
||||
unsigned int m_nDepth;
|
||||
unsigned int m_nDiatrdParent;
|
||||
bool m_fInkAtn;
|
||||
|
||||
@ -85,11 +85,9 @@ namespace DocFileFormat
|
||||
|
||||
if (author_str)
|
||||
{
|
||||
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
|
||||
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
|
||||
rPrChange.AppendAttribute( author );
|
||||
}
|
||||
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
|
||||
rPrChange.AppendAttribute( date );
|
||||
|
||||
//convert revision stack
|
||||
convertSprms( _revisionData->Changes, &rPrChange );
|
||||
|
||||
@ -85,31 +85,34 @@ namespace DocFileFormat
|
||||
for (size_t index = 0; index < count; ++index)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = NULL;
|
||||
if ((m_document->AnnotationsReferenceExPlex) && (index < m_document->AnnotationsReferenceExPlex->Elements.size()))
|
||||
{
|
||||
atrdPost10 = static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]);
|
||||
}
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
}
|
||||
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", FormatUtils::XmlEncode(atrdPre10->m_UserInitials));
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -83,14 +83,6 @@ namespace DocFileFormat
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
std::wstring getString()
|
||||
{
|
||||
return std::to_wstring(yr) + L"-" + (mon < 9 ? L"0" : L"" ) + std::to_wstring(mon) + L"-" +
|
||||
(dom < 9 ? L"0" : L"" ) + std::to_wstring(dom) + L"T" +
|
||||
(hr < 9 ? L"0" : L"" ) + std::to_wstring(hr) + L":" +
|
||||
(mint < 9 ? L"0" : L"" )+ std::to_wstring(mint) + L"Z";
|
||||
|
||||
}
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
SYSTEMTIME ToSYSTEMTIME()
|
||||
{
|
||||
|
||||
@ -406,8 +406,8 @@ namespace DocFileFormat
|
||||
//if it's a inserted run
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
|
||||
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
|
||||
}
|
||||
|
||||
//start run
|
||||
@ -1079,15 +1079,7 @@ namespace DocFileFormat
|
||||
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
|
||||
|
||||
int index = _commentNr++;
|
||||
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
|
||||
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
}
|
||||
@ -1800,7 +1792,7 @@ namespace DocFileFormat
|
||||
if (m_document->AnnotStartEndCPs[i].second == cp)
|
||||
{
|
||||
result = writeAnnotationEnd(i + 1);
|
||||
//_commentNr = i + 1;
|
||||
_commentNr = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( 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::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( 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::SizeTToWideString(i + 1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(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::SizeTToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( 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::SizeTToWideString(*result + 1);
|
||||
ret += FormatUtils::IntToWideString(*result + 1);
|
||||
ret += std::wstring((result + 1), newResult);
|
||||
result = newResult;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
|
||||
if (group)
|
||||
{
|
||||
group->Index = (int)i;
|
||||
group->Index = i;
|
||||
}
|
||||
}
|
||||
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
|
||||
|
||||
@ -85,19 +85,19 @@ namespace DocFileFormat
|
||||
|
||||
struct 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()
|
||||
{
|
||||
|
||||
}
|
||||
ImageFileStructure(const std::wstring& _ext, unsigned char* _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), 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)
|
||||
{
|
||||
data = boost::shared_array<unsigned char>(new unsigned char[size]);
|
||||
memcpy(data.get(), _data, size);
|
||||
|
||||
}
|
||||
std::wstring ext;
|
||||
boost::shared_array<unsigned char> data;
|
||||
unsigned int size;
|
||||
Global::BlipType blipType;
|
||||
|
||||
std::wstring ext;
|
||||
std::vector<unsigned char> data;
|
||||
Global::BlipType blipType;
|
||||
};
|
||||
|
||||
struct OleObjectFileStructure
|
||||
|
||||
@ -33,8 +33,6 @@
|
||||
#include "PictureDescriptor.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#ifndef MM_ISOTROPIC
|
||||
#define MM_ISOTROPIC 7
|
||||
#endif
|
||||
@ -43,111 +41,6 @@
|
||||
#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,34 +134,3 @@ 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;
|
||||
|
||||
_CP_OPT(short) tblIndent;
|
||||
short tblIndent = 0;
|
||||
short gabHalf = 0;
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
@ -98,7 +98,8 @@ 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 = gabHalf + FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
tblIndent += gabHalf;
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
@ -403,11 +404,11 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//indent
|
||||
if ( tblIndent )
|
||||
if ( tblIndent != 0 )
|
||||
{
|
||||
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),
|
||||
pict->embeddedData, pict->embeddedDataSize, Global::msoblipDIB));
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
@ -577,44 +577,26 @@ namespace DocFileFormat
|
||||
if (metaBlip)
|
||||
{//decompress inside MetafilePictBlip
|
||||
unsigned char *newData = NULL;
|
||||
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));
|
||||
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;
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
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),
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlipEntry->btWin32));
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (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(BlipStoreEntry* oBlip)
|
||||
bool VMLShapeMapping::copyPicture(const 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,53 +1314,38 @@ namespace DocFileFormat
|
||||
{
|
||||
//meta images can be compressed
|
||||
unsigned char* decompressed = NULL;
|
||||
unsigned int decompressedSize = 0;
|
||||
int decompressedSize = 0;
|
||||
|
||||
decompressedSize = metaBlip->Decompress(&decompressed);
|
||||
|
||||
if (0 != decompressedSize && NULL != decompressed)
|
||||
{
|
||||
boost::shared_array<unsigned char> arDecompressed(decompressed);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), arDecompressed, decompressedSize));
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), std::vector<unsigned char>(decompressed, (decompressed + decompressedSize))));
|
||||
RELEASEARRAYOBJECTS(decompressed);
|
||||
}
|
||||
|
||||
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),
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlip->btWin32));
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32));
|
||||
RELEASEOBJECT (bitBlip);
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
result = false;
|
||||
return result;
|
||||
@ -1446,7 +1431,8 @@ namespace DocFileFormat
|
||||
{
|
||||
//append size and position ...
|
||||
|
||||
if (m_isInlineShape)
|
||||
//if (pSpa->fAnchorLock )
|
||||
if (pSpa->bx == TEXT && pSpa->by == TEXT)
|
||||
{
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
}
|
||||
@ -1703,17 +1689,21 @@ namespace DocFileFormat
|
||||
m_pSpa->bx = PAGE;
|
||||
}
|
||||
else
|
||||
{//rel column
|
||||
{
|
||||
nRelH = m_pSpa->bx;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(m_pSpa->bx));
|
||||
}
|
||||
}
|
||||
if (nRelV < 0 && m_pSpa)
|
||||
{
|
||||
if (m_pSpa->by == TEXT && bZIndex)
|
||||
if (m_pSpa->by == TEXT && bZIndex)
|
||||
{
|
||||
m_pSpa->by = PAGE;
|
||||
}
|
||||
else
|
||||
{//rel paragraph
|
||||
{
|
||||
nRelV = m_pSpa->by;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
|
||||
}
|
||||
}
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
@ -1824,7 +1814,7 @@ namespace DocFileFormat
|
||||
//append size and position ...
|
||||
//if (m_pSpa->fAnchorLock)//это возможность смены привязки , а не ее тип
|
||||
|
||||
if (m_isInlineShape)/*m_pSpa->bx == TEXT && m_pSpa->by == TEXT*/
|
||||
if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
|
||||
{
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ namespace DocFileFormat
|
||||
void WriteShape (const ShapeContainer* pContainer);
|
||||
|
||||
std::wstring GenShapeId(const Shape* pShape) const;
|
||||
bool copyPicture( BlipStoreEntry* bse );
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
void AppendDimensionToStyle ( std::wstring& style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
|
||||
@ -173,16 +173,12 @@ namespace DocFileFormat
|
||||
|
||||
//Lock ???
|
||||
ODRAW::ProtectionBooleanProperties *prot = dynamic_cast<ODRAW::ProtectionBooleanProperties*>(pShape->Lock.get());
|
||||
if ((prot) && (prot->fUsefLockAspectRatio))
|
||||
if ((prot) && (prot->fUsefLockAspectRatio && prot->fLockAspectRatio))
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", prot->fLockAspectRatio ? L"t" : L"f" );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t");
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t" );
|
||||
}
|
||||
|
||||
if ( _lock->GetAttributeCount() > 0 )
|
||||
if ( _lock->GetAttributeCount() > 1 )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _lock->GetXMLString() );
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace DocFileFormat
|
||||
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), AnnotationsFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
@ -353,7 +353,7 @@ namespace DocFileFormat
|
||||
|
||||
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
|
||||
|
||||
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed,FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
|
||||
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
|
||||
|
||||
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
|
||||
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
|
||||
@ -387,13 +387,10 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
|
||||
|
||||
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
|
||||
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
|
||||
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
|
||||
AnnotationsFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldAtn, FIB->m_FibWord97.lcbPlcfFldAtn, nWordVersion);
|
||||
|
||||
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
|
||||
|
||||
if (m_pCallFunc)
|
||||
@ -875,7 +872,6 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(FootnoteDocumentFieldsPlex);
|
||||
RELEASEOBJECT(EndnoteDocumentFieldsPlex);
|
||||
RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex);
|
||||
RELEASEOBJECT(AnnotationsFieldsPlex);
|
||||
RELEASEOBJECT(HeaderStoriesPlex);
|
||||
RELEASEOBJECT(IndividualCommentsPlex);
|
||||
RELEASEOBJECT(AnnotationsReferencePlex);
|
||||
|
||||
@ -224,7 +224,6 @@ namespace DocFileFormat
|
||||
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *AnnotationsFieldsPlex;
|
||||
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
|
||||
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
|
||||
Plex<EmptyStructure> *AutoTextPlex;
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
#include "WordprocessingDocument.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
@ -39,6 +40,136 @@
|
||||
#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) :
|
||||
@ -144,7 +275,24 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<ImageFileStructure>::iterator iter = ImagesList.begin(); iter != ImagesList.end(); ++iter)
|
||||
{
|
||||
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)iter->data.get(), iter->size);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,17 +2,20 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
|
||||
|
||||
@ -2624,7 +2624,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::trPrChange == type)
|
||||
else if (c_oSerProp_RevisionType::tblPrChange == type)
|
||||
{
|
||||
pTrackRevision->trPr = new NSStringUtils::CStringBuilder();
|
||||
READ2_DEF(length, res, this->Read_RowPr, pTrackRevision->trPr);
|
||||
@ -4080,30 +4080,6 @@ 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);
|
||||
@ -4946,30 +4922,6 @@ 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;
|
||||
@ -7209,7 +7161,7 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR
|
||||
if(NULL != m_pComments)
|
||||
{
|
||||
CComment* pComment = m_pComments->get(nId);
|
||||
if(NULL != pComment) // могут быть и без start/end
|
||||
if(NULL != pComment && pComment->bIdFormat)
|
||||
{
|
||||
GetRunStringWriter().WriteString(pComment->writeRef(std::wstring(_T("")), std::wstring(_T("w:commentReference")), std::wstring(_T(""))));
|
||||
}
|
||||
@ -7455,30 +7407,6 @@ 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;
|
||||
@ -7528,30 +7456,6 @@ 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;
|
||||
|
||||
@ -524,11 +524,7 @@ extern int g_nCurFormatVersion;
|
||||
Sdt = 10,
|
||||
BookmarkStart = 11,
|
||||
BookmarkEnd = 12,
|
||||
tblGrid_ItemTwips = 13,
|
||||
MoveFromRangeStart = 14,
|
||||
MoveFromRangeEnd = 15,
|
||||
MoveToRangeStart = 16,
|
||||
MoveToRangeEnd = 17
|
||||
tblGrid_ItemTwips = 13
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -983,11 +979,7 @@ extern int g_nCurFormatVersion;
|
||||
columnbreak = 64,
|
||||
ARPr = 65,
|
||||
BookmarkStart = 66,
|
||||
BookmarkEnd = 67,
|
||||
MoveFromRangeStart = 68,
|
||||
MoveFromRangeEnd = 69,
|
||||
MoveToRangeStart = 70,
|
||||
MoveToRangeEnd = 71
|
||||
BookmarkEnd = 67
|
||||
};}
|
||||
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
|
||||
{
|
||||
|
||||
@ -3082,34 +3082,6 @@ 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;
|
||||
}
|
||||
@ -3313,38 +3285,39 @@ void BinaryDocumentTableWriter::WriteParagraphContent(const std::vector<OOX::Wri
|
||||
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;
|
||||
}
|
||||
//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_m_oMathPara:
|
||||
{
|
||||
OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item);
|
||||
@ -4249,38 +4222,6 @@ 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;
|
||||
}
|
||||
@ -6865,34 +6806,6 @@ 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)
|
||||
@ -6967,34 +6880,6 @@ 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)
|
||||
|
||||
@ -210,41 +210,25 @@ namespace formulasconvert {
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
std::vector< std::wstring > splitted;
|
||||
|
||||
boost::algorithm::split(splitted, workstr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
bool res = false;
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[1];
|
||||
res = true;
|
||||
}
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size() == 3)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[2];
|
||||
res = true;
|
||||
return true;
|
||||
}
|
||||
if (splitted.size() == 4)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[3];
|
||||
res = true;
|
||||
return true;
|
||||
}
|
||||
replace_tmp_back( table );
|
||||
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
|
||||
@ -188,7 +188,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
|
||||
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
|
||||
return;
|
||||
|
||||
boost::wregex re(L"(([:$!])+)|(\\S+\\d+)");
|
||||
boost::wregex re(L"([:$!])+");
|
||||
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(expr, result, re);
|
||||
|
||||
@ -63,9 +63,8 @@ public:
|
||||
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
private:
|
||||
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -82,11 +82,6 @@ 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();
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "../odf/style_graphic_properties.h"
|
||||
|
||||
#include "docx_package.h"
|
||||
#include "xlsx_package.h"
|
||||
#include "oox_rels.h"
|
||||
#include "logging.h"
|
||||
|
||||
@ -130,7 +131,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf_document) :
|
||||
last_dump_page_properties_ (true),
|
||||
next_dump_page_properties_ (false),
|
||||
page_break_ (false),
|
||||
@ -143,7 +144,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
text_tracked_context_ (*this),
|
||||
table_context_ (*this),
|
||||
output_document_ (NULL),
|
||||
current_process_note_ (noNote),
|
||||
process_note_ (noNote),
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
current_outline_level_ (-1),
|
||||
@ -151,12 +152,14 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
current_process_comment_ (false),
|
||||
mediaitems_ (OdfDocument->get_folder() ),
|
||||
math_context_ (OdfDocument->odf_context().fontContainer(), false),
|
||||
odf_document_ (OdfDocument)
|
||||
process_comment_ (false),
|
||||
odf_document_ (_odf_document),
|
||||
math_context_ (_odf_document->odf_context().fontContainer(), false)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
chart_drawing_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
}
|
||||
docx_conversion_context::~docx_conversion_context()
|
||||
{
|
||||
@ -167,7 +170,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
|
||||
}
|
||||
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
|
||||
{
|
||||
@ -619,9 +622,9 @@ std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, b
|
||||
{
|
||||
hyperlinks::_type_place type = hyperlinks::document_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;
|
||||
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;
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
@ -685,11 +688,14 @@ void docx_conversion_context::end_document()
|
||||
{
|
||||
output_stream() << L"</w:document>";
|
||||
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
|
||||
output_document_->get_word_files().set_media ( mediaitems_);
|
||||
output_document_->get_word_files().set_comments ( comments_context_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content());
|
||||
output_document_->get_word_files().set_drawings(drawings);
|
||||
|
||||
package::content_types_file & content_file_ = output_document_->get_content_types_file();
|
||||
content_file_.set_media( mediaitems_);
|
||||
@ -1071,7 +1077,7 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\"/>";
|
||||
|
||||
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
|
||||
{
|
||||
@ -1464,7 +1470,7 @@ void docx_conversion_context::end_text_list_style()
|
||||
text_list_style_name_ = L"";
|
||||
}
|
||||
|
||||
std::wstring docx_conversion_context::get_text_list_style_name()
|
||||
const std::wstring & docx_conversion_context::get_text_list_style_name()
|
||||
{
|
||||
return text_list_style_name_;
|
||||
}
|
||||
@ -1490,9 +1496,9 @@ void docx_conversion_context::end_list()
|
||||
list_style_stack_.pop_back();
|
||||
}
|
||||
|
||||
std::wstring docx_conversion_context::current_list_style()
|
||||
const std::wstring docx_conversion_context::current_list_style() const
|
||||
{
|
||||
if (false == list_style_stack_.empty())
|
||||
if (!list_style_stack_.empty())
|
||||
return list_style_stack_.back();
|
||||
else
|
||||
return L"";
|
||||
@ -1545,93 +1551,6 @@ 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;
|
||||
@ -1652,22 +1571,19 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
if (odf_reader::style_instance * styleInst =
|
||||
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
|
||||
)
|
||||
{
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
{
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
//office_element_ptr parent_tab_stops_;
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
{
|
||||
std::wstring parent_name = parentStyleContent->name();
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
|
||||
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
|
||||
{
|
||||
@ -1675,7 +1591,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());
|
||||
|
||||
@ -1701,10 +1617,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()
|
||||
@ -1720,8 +1636,6 @@ 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>";
|
||||
@ -1741,58 +1655,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)
|
||||
{
|
||||
if (is_paragraph_header() )
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
if (is_paragraph_header() )
|
||||
{
|
||||
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:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
output_stream() << L"<w:pPr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
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().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>";
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1843,27 +1757,28 @@ 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()) return;
|
||||
|
||||
if (first_element_list_item_)
|
||||
if (!list_style_stack_.empty())
|
||||
{
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
if (first_element_list_item_)
|
||||
{
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:ilvl")
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
{
|
||||
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_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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
first_element_list_item_ = false;
|
||||
first_element_list_item_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1919,7 +1834,7 @@ namespace
|
||||
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
|
||||
rels internal_rels;
|
||||
|
||||
Context.get_mediaitems().dump_rels(internal_rels);
|
||||
Context.get_mediaitems()->dump_rels(internal_rels);
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
@ -2029,12 +1944,12 @@ void notes_context::dump_rels(rels & Rels) const
|
||||
|
||||
void docx_conversion_context::add_note_reference ()
|
||||
{
|
||||
if (current_process_note_ == footNote || current_process_note_ == endNote)
|
||||
if (process_note_ == footNote || process_note_ == endNote)
|
||||
{
|
||||
add_element_to_run(_T(""));
|
||||
output_stream() << ((current_process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
output_stream() << ((process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
finish_run();
|
||||
current_process_note_ = (NoteType) (current_process_note_ + 1); //add ref set
|
||||
process_note_ = (NoteType) (process_note_ + 1); //add ref set
|
||||
}
|
||||
}
|
||||
|
||||
@ -2083,7 +1998,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 (current_process_comment_) return;
|
||||
if (process_comment_) return;
|
||||
|
||||
text_tracked_context_.dumpPPr_.clear();
|
||||
text_tracked_context_.dumpRPr_.clear();
|
||||
@ -2182,7 +2097,7 @@ void docx_conversion_context::start_changes()
|
||||
|
||||
void docx_conversion_context::end_changes()
|
||||
{
|
||||
if (current_process_comment_) return;
|
||||
if (process_comment_) return;
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "docx_table_context.h"
|
||||
#include "oox_conversion_context.h"
|
||||
#include "oox_chart_context.h"
|
||||
#include "xlsx_drawing_context.h"
|
||||
|
||||
#include "headers_footers.h"
|
||||
#include "hyperlinks.h"
|
||||
@ -734,7 +735,7 @@ class docx_conversion_context : boost::noncopyable
|
||||
public:
|
||||
enum NoteType { noNote, footNote, footNoteRefSet, endNote, endNoteRefSet };
|
||||
|
||||
docx_conversion_context(odf_reader::odf_document * OdfDocument);
|
||||
docx_conversion_context(odf_reader::odf_document * _odf_document);
|
||||
~docx_conversion_context();
|
||||
|
||||
void set_output_document (package::docx_document * document);
|
||||
@ -829,7 +830,6 @@ 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 +873,8 @@ public:
|
||||
void start_text_list_style (const std::wstring & StyleName);
|
||||
void end_text_list_style ();
|
||||
|
||||
std::wstring get_text_list_style_name();
|
||||
std::wstring current_list_style();
|
||||
const std::wstring & get_text_list_style_name();
|
||||
const std::wstring current_list_style () const;
|
||||
|
||||
void start_list (const std::wstring & StyleName, bool Continue = false);
|
||||
void end_list ();
|
||||
@ -888,7 +888,7 @@ public:
|
||||
|
||||
styles_map * get_style_map() { return &styles_map_; }
|
||||
|
||||
mediaitems & get_mediaitems() {return mediaitems_;}
|
||||
mediaitems_ptr & get_mediaitems() {return mediaitems_;}
|
||||
styles_context & get_styles_context() { return styles_context_; }
|
||||
drawing_context & get_drawing_context() { return drawing_context_; }
|
||||
comments_context & get_comments_context() { return comments_context_; }
|
||||
@ -898,8 +898,9 @@ public:
|
||||
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
tabs_context & get_tabs_context() { return tabs_context_;}
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
xlsx_drawing_context_handle_ptr & get_chart_drawing_handle() { return chart_drawing_handle_;}
|
||||
|
||||
void set_drawing_text_props (const std::wstring &props);
|
||||
|
||||
@ -911,32 +912,26 @@ 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) { current_process_note_ = Val; }
|
||||
NoteType get_process_note () const { return current_process_note_; }
|
||||
void set_process_note (NoteType Val) { process_note_ = Val; }
|
||||
NoteType get_process_note () const { return 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 () {current_process_comment_ = true;}
|
||||
void end_comment () {current_process_comment_ = false;}
|
||||
void start_comment () {process_comment_ = true;}
|
||||
void end_comment () {process_comment_ = false;}
|
||||
bool process_comment_;
|
||||
|
||||
void start_math_formula ();
|
||||
void end_math_formula ();
|
||||
@ -955,7 +950,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_;
|
||||
@ -966,7 +961,6 @@ public:
|
||||
void end_changes();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
@ -993,6 +987,8 @@ private:
|
||||
std::wstringstream settings_xml_;
|
||||
std::wstringstream meta_xml_;
|
||||
|
||||
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
|
||||
|
||||
styles_context styles_context_;
|
||||
math_context math_context_;
|
||||
drawing_context drawing_context_;
|
||||
@ -1015,18 +1011,18 @@ private:
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
hyperlinks hyperlinks_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
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> paragraph_style_stack_;
|
||||
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> 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_;
|
||||
@ -1040,13 +1036,11 @@ private:
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
|
||||
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::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
int current_outline_level_;
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
NoteType process_note_;
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
|
||||
@ -151,6 +151,7 @@ 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:
|
||||
@ -159,7 +160,6 @@ 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;
|
||||
|
||||
@ -102,7 +102,11 @@ void word_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
embeddings_->write( path );
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
drawings_->set_main_document(get_main_document());
|
||||
drawings_->write( path );
|
||||
}
|
||||
if (headers_footers_)
|
||||
{
|
||||
headers_footers_->write( path );
|
||||
@ -140,22 +144,22 @@ void word_files::write(const std::wstring & RootPath)
|
||||
|
||||
void word_files::update_rels(docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_mediaitems().dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
|
||||
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
void word_files::set_media(mediaitems & _Mediaitems)
|
||||
void word_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
embeddings_->set_main_document( get_main_document() );
|
||||
}
|
||||
}
|
||||
@ -195,6 +199,10 @@ void word_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void word_files::set_drawings(element_ptr Element)
|
||||
{
|
||||
drawings_ = Element;
|
||||
}
|
||||
void word_files::set_headers_footers(headers_footers & HeadersFooters)
|
||||
{
|
||||
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
|
||||
|
||||
@ -137,10 +137,11 @@ public:
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems & mediaitems_);
|
||||
void set_media (mediaitems_ptr & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
void set_comments (comments_context & commentsContext);
|
||||
void set_drawings (element_ptr Element);
|
||||
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_jsaProject(const std::string &content);
|
||||
@ -163,6 +164,7 @@ private:
|
||||
element_ptr settings_;
|
||||
element_ptr comments_;
|
||||
element_ptr jsaProject_;
|
||||
element_ptr drawings_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -62,6 +62,9 @@ struct drawing_object_description
|
||||
double anchor_x_;
|
||||
double anchor_y_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
_action_desc action_;
|
||||
std::vector<_hlink_desc> hlinks_;
|
||||
|
||||
|
||||
@ -101,6 +101,7 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -193,14 +194,7 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
CImageFileFormatChecker image_checker;
|
||||
sExt = image_checker.DetectFormatByData(buffer, buffer_size);
|
||||
|
||||
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;
|
||||
if (!sExt.empty()) sExt = std::wstring(L".") + sExt;
|
||||
}
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
@ -336,6 +330,10 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ( items_[i].type == typeUnknown ) continue;
|
||||
if ( items_[i].type == typeShape ) continue;
|
||||
if ( items_[i].type == typeGroupShape ) continue;
|
||||
|
||||
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
|
||||
|
||||
Rels.add( relationship(
|
||||
@ -345,7 +343,7 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
items_[i].mediaInternal ? L"" : L"External" )
|
||||
);
|
||||
items_[i].count_used++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -137,6 +137,7 @@ public:
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
@ -147,6 +148,7 @@ private:
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
};
|
||||
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -150,18 +150,12 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_NODE(L"c:max")
|
||||
{
|
||||
CP_XML_ATTR(L"val", *doubleVal);
|
||||
}
|
||||
CP_XML_ATTR(L"c:max", *doubleVal);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"minimum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_NODE(L"c:min")
|
||||
{
|
||||
CP_XML_ATTR(L"val", *doubleVal);
|
||||
}
|
||||
CP_XML_ATTR(L"c:min", *doubleVal);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"logarithmic", boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
std::wstring drawingId_;
|
||||
};
|
||||
|
||||
oox_chart_context::oox_chart_context(mediaitems & m, std::wstring name) :
|
||||
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
|
||||
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
|
||||
{
|
||||
bool isInternal = true;
|
||||
std::wstring ref;
|
||||
f.bitmap->rId = mediaitems_.add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
|
||||
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
|
||||
}
|
||||
@ -75,9 +75,15 @@ void oox_chart_context::set_externalData(const std::wstring & href)
|
||||
bool isInternal = true;
|
||||
std::wstring href_out;
|
||||
|
||||
externalDataId_ = mediaitems_.add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
|
||||
}
|
||||
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
|
||||
{
|
||||
bool isInternal = true;
|
||||
userShapesId_ = link.second;
|
||||
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
|
||||
}
|
||||
std::wostream & oox_chart_context::chartData()
|
||||
{
|
||||
return impl_->chartData_;
|
||||
@ -116,6 +122,15 @@ void oox_chart_context::dump_rels(rels & Rels)
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
else if (r.type == typeChartUserShapes)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
r.rid,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes",
|
||||
r.is_internal ? std::wstring(L"../drawings/") + r.ref : r.ref,
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +241,13 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userShapesId_.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"c:userShapes")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", userShapesId_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
|
||||
class oox_chart_context
|
||||
{
|
||||
public:
|
||||
oox_chart_context(mediaitems & mediaitems_, std::wstring name);
|
||||
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
|
||||
~oox_chart_context();
|
||||
|
||||
std::wostream & chartData();
|
||||
@ -83,6 +83,8 @@ public:
|
||||
}
|
||||
}
|
||||
void set_externalData(const std::wstring & href);
|
||||
void set_userShapes(std::pair<std::wstring, std::wstring> &link);
|
||||
|
||||
void add_chart(int type)
|
||||
{
|
||||
plot_area_.add_chart(type);
|
||||
@ -128,7 +130,7 @@ private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
mediaitems &mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::vector<_rel> rels_;
|
||||
|
||||
cpdoccore::oox::oox_title title_;
|
||||
@ -137,6 +139,7 @@ private:
|
||||
|
||||
std::wstring pivot_source_;
|
||||
std::wstring externalDataId_;
|
||||
std::wstring userShapesId_;
|
||||
|
||||
std::vector<odf_reader::_property> graphic_properties_;
|
||||
_oox_fill fill_;
|
||||
|
||||
@ -59,19 +59,12 @@ oox_chart_series::oox_chart_series()
|
||||
bLocalTable_ = false;
|
||||
labelPosEnabled_ = true;
|
||||
}
|
||||
void oox_chart_series::setName(const std::wstring &value)
|
||||
void oox_chart_series::setName(std::wstring &value)
|
||||
{
|
||||
name_ = value;
|
||||
name_=value;
|
||||
}
|
||||
void oox_chart_series::setLabels(const std::wstring &formula, std::vector<std::wstring> & cash)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
label_.present = true;
|
||||
label_.formula = converter.convert_chart_distance(formula);
|
||||
label_.str_cache = cash;
|
||||
}
|
||||
void oox_chart_series::setFormula(int ind, const std::wstring &value, const std::wstring & formatCode, bool link_to_source)
|
||||
void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & formatCode, bool link_to_source)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
@ -144,7 +137,6 @@ void oox_chart_series::parse_properties()
|
||||
data_labels_->set_position(*intVal);
|
||||
}
|
||||
}
|
||||
|
||||
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
|
||||
{
|
||||
values_[ind].present = true;
|
||||
@ -223,44 +215,6 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
shape.set(content_.graphic_properties_, content_.fill_);
|
||||
shape.oox_serialize(_Wostream);
|
||||
|
||||
if (label_.present)
|
||||
{
|
||||
CP_XML_NODE(L"c:tx")
|
||||
{
|
||||
CP_XML_NODE(L"c:strRef")
|
||||
{
|
||||
if (!label_.formula.empty())
|
||||
{
|
||||
CP_XML_NODE(L"c:f")
|
||||
{
|
||||
CP_XML_STREAM() << label_.formula;
|
||||
}
|
||||
}
|
||||
if (false == label_.str_cache.empty())
|
||||
{
|
||||
CP_XML_NODE(L"c:strCache")
|
||||
{
|
||||
CP_XML_NODE(L"c:ptCount")
|
||||
{
|
||||
CP_XML_ATTR(L"val", label_.str_cache.size());
|
||||
}
|
||||
for (size_t i = 0; i < label_.str_cache.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:pt")
|
||||
{
|
||||
CP_XML_ATTR(L"idx", i);
|
||||
CP_XML_NODE(L"c:v")
|
||||
{
|
||||
CP_XML_STREAM() << label_.str_cache[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (values_[i].present)
|
||||
|
||||
@ -56,20 +56,17 @@ public:
|
||||
virtual void oox_serialize(std::wostream & _Wostream) = 0;
|
||||
|
||||
bool labelPosEnabled_;
|
||||
_oox_chart_values values_[5]; //cat, common, x, y, bubble,
|
||||
|
||||
_oox_strRef label_; //tx (Series Text) §21.2.2.215
|
||||
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
|
||||
int id_;
|
||||
std::wstring name_;
|
||||
std::wstring name_; //tx (Series Text) §21.2.2.215
|
||||
int iSymbolMarkerType_;
|
||||
bool bLocalTable_;
|
||||
_CP_OPT(oox_data_labels) data_labels_;
|
||||
|
||||
void setName(const std::wstring &value);
|
||||
void setName(std::wstring &value);
|
||||
|
||||
void setFormula (int ind, const std::wstring & value, const std::wstring & formatCode, bool link_to_source);
|
||||
void setFormula (int ind, std::wstring & value, std::wstring & formatCode, bool link_to_source);
|
||||
void setValues (int ind, std::vector<std::wstring> & values);
|
||||
void setLabels (const std::wstring &formula, std::vector<std::wstring> & values);
|
||||
void parse_properties();
|
||||
|
||||
void set_cache_only (bool val);
|
||||
|
||||
@ -55,21 +55,21 @@ struct _oox_numLit
|
||||
|
||||
struct _oox_strRef
|
||||
{
|
||||
bool present = false;
|
||||
bool present;
|
||||
|
||||
std::wstring formula;
|
||||
int str_cache_count = 0;
|
||||
int str_cache_count;
|
||||
std::vector<std::wstring> str_cache;
|
||||
|
||||
};
|
||||
struct _oox_numRef
|
||||
{
|
||||
bool present = false;
|
||||
bool present;
|
||||
|
||||
std::wstring formula;
|
||||
std::wstring formatCode;
|
||||
bool link_to_source = false;
|
||||
int num_cache_count = 0;
|
||||
bool link_to_source;
|
||||
int num_cache_count;
|
||||
std::vector<std::wstring> num_cache;
|
||||
|
||||
};
|
||||
|
||||
@ -173,6 +173,26 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
|
||||
return true;
|
||||
}
|
||||
void content_types_file::set_media(mediaitems_ptr & _Mediaitems)
|
||||
{
|
||||
std::vector<mediaitems::item> & items_ = _Mediaitems->items();
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ((items_[i].type == typeImage ||
|
||||
items_[i].type == typeMedia ||
|
||||
items_[i].type == typeVideo ||
|
||||
items_[i].type == typeAudio) && items_[i].mediaInternal)
|
||||
{
|
||||
int n = items_[i].outputName.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
@ -349,7 +369,7 @@ void docProps_files::write(const std::wstring & RootPath)
|
||||
////////////
|
||||
|
||||
|
||||
media::media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
|
||||
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
|
||||
{
|
||||
}
|
||||
|
||||
@ -358,7 +378,8 @@ void media::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
mediaitems::items_array & items = mediaitems_.items();
|
||||
mediaitems::items_array & items = mediaItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
|
||||
@ -381,7 +402,7 @@ void media::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
charts::charts(mediaitems & _ChartsItems) : chartsitems_(_ChartsItems)
|
||||
charts::charts(mediaitems_ptr & _chartsItems) : chartsItems_(_chartsItems)
|
||||
{
|
||||
}
|
||||
|
||||
@ -390,7 +411,7 @@ void charts::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
embeddings::embeddings(mediaitems & _EmbeddingsItems) : embeddingsitems_(_EmbeddingsItems)
|
||||
embeddings::embeddings(mediaitems_ptr & _EmbeddingsItems) : embeddingsItems_(_EmbeddingsItems)
|
||||
{
|
||||
}
|
||||
void embeddings::write(const std::wstring & RootPath)
|
||||
@ -400,7 +421,8 @@ void embeddings::write(const std::wstring & RootPath)
|
||||
|
||||
content_types_file & content_types = get_main_document()->get_content_types_file();
|
||||
|
||||
mediaitems::items_array & items = embeddingsitems_.items();
|
||||
mediaitems::items_array & items = embeddingsItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if ( items[i].mediaInternal && items[i].valid &&
|
||||
|
||||
@ -51,6 +51,7 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class mediaitems;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
|
||||
namespace package {
|
||||
|
||||
@ -81,16 +82,17 @@ inline element::~element()
|
||||
class content_types_file : public element
|
||||
{
|
||||
public:
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
content_type * content ();
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
content_type* content ();
|
||||
|
||||
private:
|
||||
content_type content_type_content_;
|
||||
std::wstring filename_;
|
||||
std::wstring filename_;
|
||||
};
|
||||
|
||||
class simple_element;
|
||||
@ -189,8 +191,8 @@ public:
|
||||
std::wstring str() { return content_.str(); }
|
||||
static _CP_PTR(chart_content) create();
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class document : public element
|
||||
@ -228,39 +230,39 @@ private:
|
||||
class media : public element
|
||||
{
|
||||
public:
|
||||
media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
media(mediaitems_ptr & _mediaItems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & mediaitems_;
|
||||
NSFonts::IApplicationFonts * appFonts_;
|
||||
mediaitems_ptr mediaItems_;
|
||||
NSFonts::IApplicationFonts* appFonts_;
|
||||
|
||||
};
|
||||
|
||||
class charts : public element
|
||||
{
|
||||
public:
|
||||
charts(mediaitems & _ChartsItems);
|
||||
charts(mediaitems_ptr & _chartsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & chartsitems_;
|
||||
mediaitems_ptr chartsItems_;
|
||||
|
||||
};
|
||||
class embeddings : public element
|
||||
{
|
||||
public:
|
||||
embeddings(mediaitems & _EmbeddingsItems);
|
||||
embeddings(mediaitems_ptr & _embeddingsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & embeddingsitems_;
|
||||
mediaitems_ptr embeddingsItems_;
|
||||
|
||||
};
|
||||
} // namespace package
|
||||
|
||||
@ -43,6 +43,7 @@ namespace oox {
|
||||
enum RelsType
|
||||
{
|
||||
typeUnknown = 0,
|
||||
typeDefault,
|
||||
typeImage,
|
||||
typeChart,
|
||||
typeShape,
|
||||
@ -59,7 +60,8 @@ enum RelsType
|
||||
typeExternalLink,
|
||||
typeActiveX,
|
||||
typeControl,
|
||||
typeControlProps
|
||||
typeControlProps,
|
||||
typeChartUserShapes
|
||||
};
|
||||
|
||||
struct _rel
|
||||
@ -71,10 +73,10 @@ struct _rel
|
||||
type(type_)
|
||||
{}
|
||||
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class relationship : public xml::element_impl<relationship>
|
||||
|
||||
@ -46,13 +46,13 @@ void oox_chart::set_cache_only (bool val)
|
||||
|
||||
}
|
||||
|
||||
void oox_chart::set_formula_series(int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source)
|
||||
void oox_chart::set_formula_series(int ind, std::wstring val, std::wstring formatCode, bool link_to_source)
|
||||
{
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setFormula(ind, val, formatCode, link_to_source);
|
||||
|
||||
}
|
||||
void oox_chart::set_name(const std::wstring& val)
|
||||
void oox_chart::set_name(std::wstring val)
|
||||
{
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setName(val);
|
||||
@ -68,13 +68,6 @@ void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setValues (ind, val);
|
||||
}
|
||||
void oox_chart::set_label_series(const std::wstring& formula, std::vector<std::wstring> & cash)
|
||||
{
|
||||
if (formula.empty() && cash.empty()) return;
|
||||
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setLabels (formula, cash);
|
||||
}
|
||||
void oox_chart::set_properties(std::vector<odf_reader::_property> g)
|
||||
{
|
||||
_CP_OPT(int) iVal;
|
||||
|
||||
@ -78,10 +78,9 @@ public:
|
||||
virtual void add_series(int id){}
|
||||
|
||||
void set_cache_only (bool val);
|
||||
void set_formula_series (int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source);
|
||||
void set_formula_series (int ind, std::wstring val, std::wstring formatCode, bool link_to_source);
|
||||
void set_values_series (int ind, std::vector<std::wstring> & val);
|
||||
void set_label_series (const std::wstring& formula, std::vector<std::wstring> & val);
|
||||
void set_name (const std::wstring& val);
|
||||
void set_name (std::wstring val);
|
||||
void set_content_series (odf_reader::chart::series & content);
|
||||
|
||||
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
|
||||
|
||||
@ -83,7 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
|
||||
|
||||
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
|
||||
pptx_slide_context_.get_mediaitems()->set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void pptx_conversion_context::process_layouts()
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
|
||||
pptx_table_context & get_table_context() { return pptx_table_context_; }
|
||||
|
||||
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
|
||||
//void start_hyperlink(const std::wstring & styleName);
|
||||
//void end_hyperlink(std::wstring const & href);
|
||||
|
||||
@ -509,15 +509,15 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems)
|
||||
void ppt_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems);
|
||||
void set_media(mediaitems_ptr & _mediaitems);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
|
||||
@ -65,8 +65,10 @@ public:
|
||||
bool onClick;
|
||||
};
|
||||
|
||||
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
|
||||
Impl(const std::wstring & _odfPacket) : odfPacket_(_odfPacket)
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odfPacket_);
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ public:
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
@ -138,7 +140,7 @@ private:
|
||||
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
pptx_drawings_ptr pptx_drawings_;
|
||||
pptx_drawings_ptr pptx_notes_drawings_;
|
||||
};
|
||||
@ -357,7 +359,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
|
||||
bool isMediaInternal = false;
|
||||
std::wstring ref;
|
||||
|
||||
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
impl_->background_fill_ = fill;
|
||||
@ -421,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
@ -493,10 +495,6 @@ 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;
|
||||
@ -566,7 +564,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
}
|
||||
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -576,7 +574,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
@ -584,7 +582,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -599,7 +597,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
@ -608,7 +606,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
@ -623,12 +621,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(std::wstring) sPlaceHolderType;
|
||||
@ -651,7 +649,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
@ -662,7 +660,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
@ -674,7 +672,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
@ -685,7 +683,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
@ -718,7 +716,7 @@ void pptx_slide_context::dump_rels(rels & Rels)
|
||||
impl_->get_drawings()->dump_rels(Rels);
|
||||
}
|
||||
|
||||
mediaitems & pptx_slide_context::get_mediaitems()
|
||||
mediaitems_ptr & pptx_slide_context::get_mediaitems()
|
||||
{
|
||||
return impl_->get_mediaitems();
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
|
||||
void process_drawings();
|
||||
|
||||
mediaitems & get_mediaitems();
|
||||
mediaitems_ptr & get_mediaitems();
|
||||
|
||||
void add_background (_oox_fill & fill);
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref;
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
|
||||
}
|
||||
oox::oox_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
@ -48,17 +48,17 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_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);
|
||||
odf_reader::GetProperty ( val.additional, L"text-content", strTextContent);
|
||||
|
||||
if (!strTextContent)return;
|
||||
if (strTextContent->empty())return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:txBody")
|
||||
CP_XML_NODE(ns + L":txBody")
|
||||
{
|
||||
val.serialize_bodyPr(CP_XML_STREAM());
|
||||
|
||||
@ -71,28 +71,28 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE( ns + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
CP_XML_NODE( ns + (ns.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
{
|
||||
CP_XML_NODE(L"xdr:col")
|
||||
CP_XML_NODE(ns + L":col")
|
||||
{
|
||||
CP_XML_CONTENT(position.col);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:colOff")
|
||||
CP_XML_NODE(ns + L":colOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:row")
|
||||
CP_XML_NODE(ns + L":row")
|
||||
{
|
||||
CP_XML_CONTENT(position.row);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:rowOff")
|
||||
CP_XML_NODE(ns + L":rowOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
|
||||
}
|
||||
@ -100,15 +100,15 @@ void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pic")
|
||||
CP_XML_NODE(ns + L":pic")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvPicPr")
|
||||
CP_XML_NODE(ns + L":nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
@ -116,7 +116,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvPicPr")
|
||||
CP_XML_NODE(ns + L":cNvPicPr")
|
||||
{
|
||||
if (val.fill.bitmap->bCrop)
|
||||
{
|
||||
@ -128,7 +128,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
val.fill.bitmap->name_space = L"xdr";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -139,20 +139,20 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:sp")
|
||||
CP_XML_NODE(ns + L":sp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvSpPr")
|
||||
CP_XML_NODE(ns + L":nvSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
|
||||
@ -160,12 +160,12 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
CP_XML_NODE(ns + L":cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
|
||||
}
|
||||
} // xdr:nv_Pr
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -174,7 +174,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
@ -206,22 +206,22 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:grpSp")
|
||||
CP_XML_NODE(ns + L":grpSp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvGrpSpPr")
|
||||
CP_XML_NODE(ns + L":nvGrpSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvGrpSpPr");
|
||||
CP_XML_NODE(ns + L":cNvGrpSpPr");
|
||||
}
|
||||
CP_XML_NODE(L"xdr:grpSpPr")
|
||||
CP_XML_NODE(ns + L":grpSpPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -266,15 +266,15 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
if (val.type == typeShape)
|
||||
{
|
||||
xlsx_serialize_shape(strm, val);
|
||||
xlsx_serialize_shape(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
xlsx_serialize_image(strm, val);
|
||||
xlsx_serialize_image(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeChart)
|
||||
{
|
||||
@ -282,7 +282,7 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
else if (val.type == typeGroupShape)
|
||||
{
|
||||
xlsx_serialize_group(strm, val);
|
||||
xlsx_serialize_group(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject ||
|
||||
@ -292,44 +292,76 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm)
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
return xlsx_serialize(strm, *this);
|
||||
return xlsx_serialize(strm, *this, ns);
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (type_anchor == 1)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:twoCellAnchor")
|
||||
CP_XML_NODE(ns + L":twoCellAnchor")
|
||||
{
|
||||
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
|
||||
|
||||
from_.serialize (CP_XML_STREAM());
|
||||
to_.serialize (CP_XML_STREAM());
|
||||
|
||||
xlsx_serialize (CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xlsx_serialize (CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (type_anchor == 2)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:absoluteAnchor")
|
||||
CP_XML_NODE(ns + L":absoluteAnchor")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pos")
|
||||
CP_XML_NODE(ns + L":pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", x);
|
||||
CP_XML_ATTR(L"y", y);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:ext")
|
||||
CP_XML_NODE(ns + L":ext")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 3)
|
||||
{
|
||||
CP_XML_NODE(ns + L":relSizeAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":from")
|
||||
{
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y / *owner_cy_);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(ns + L":to")
|
||||
{
|
||||
_INT32 x1 = x + cx;
|
||||
_INT32 y1 = y + cy;
|
||||
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ struct xlsx_drawing_position
|
||||
enum type_t {from, to} type;
|
||||
xlsx_table_position position;
|
||||
|
||||
void serialize(std::wostream & _Wostream, std::wstring ns = L"xdr:");
|
||||
void serialize(std::wostream & _Wostream, const std::wstring & ns = L"xdr");
|
||||
};
|
||||
|
||||
|
||||
@ -63,9 +63,14 @@ public:
|
||||
xlsx_drawing_position from_;
|
||||
xlsx_drawing_position to_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
std::wstring content_group_;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
};
|
||||
|
||||
@ -53,41 +53,42 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems_ptr & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
mediaitems & get_mediaitems() { return items_; }
|
||||
mediaitems_ptr & get_mediaitems() { return items_; }
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return next_rId_++;
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings));
|
||||
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings, type_));
|
||||
const std::wstring rId = std::wstring(L"rDrId") + id;
|
||||
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
|
||||
private:
|
||||
mediaitems & items_;
|
||||
mediaitems_ptr items_;
|
||||
std::vector<drawing_elm> drawings_;
|
||||
|
||||
size_t next_rId_;
|
||||
size_t next_drawing_id_;
|
||||
};
|
||||
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems & items)
|
||||
: impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems_ptr & items) :
|
||||
impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,9 +96,9 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
return impl_->add_drawing_xml(content, drawings);
|
||||
return impl_->add_drawing_xml(content, drawings, type_);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
@ -108,13 +109,13 @@ const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
class xlsx_drawing_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl(xlsx_drawing_context_handle & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
Impl(xlsx_drawing_context_handle_ptr & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
{
|
||||
current_level_ = &objects_;
|
||||
use_image_replacement_ = false;
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle& handle_;
|
||||
xlsx_drawing_context_handle_ptr handle_;
|
||||
drawing_object_description object_description_;
|
||||
|
||||
std::vector<drawing_object_description> objects_;
|
||||
@ -124,11 +125,11 @@ public:
|
||||
bool use_image_replacement_;
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
mediaitems & get_mediaitems() { return handle_.impl_->get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return handle_->impl_->get_mediaitems(); }
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns = L"xdr")
|
||||
{
|
||||
xlsx_drawings_->serialize(strm);
|
||||
xlsx_drawings_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
@ -138,7 +139,7 @@ public:
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return handle_.impl_->next_rId();
|
||||
return handle_->impl_->next_rId();
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr get_drawings()
|
||||
@ -150,7 +151,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle & h)
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h)
|
||||
: impl_(new xlsx_drawing_context::Impl(h))
|
||||
{
|
||||
hlinks_size_ = 0;
|
||||
@ -386,6 +387,12 @@ void xlsx_drawing_context::set_scale(double cx_pt, double cy_pt)
|
||||
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::set_rel_anchor(_INT32 owner_cx, _INT32 owner_cy)
|
||||
{
|
||||
impl_->object_description_.owner_cx_ = owner_cx;
|
||||
impl_->object_description_.owner_cy_ = owner_cy;
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_anchor(std::wstring anchor, double x_pt, double y_pt, bool group)
|
||||
{
|
||||
if (group)
|
||||
@ -444,9 +451,17 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
{
|
||||
if (obj.anchor_.empty())
|
||||
{
|
||||
drawing.type_anchor = 2; // absolute
|
||||
if (obj.owner_cx_ && obj.owner_cy_)
|
||||
{
|
||||
drawing.type_anchor = 3; // relative
|
||||
drawing.owner_cx_ = obj.owner_cx_;
|
||||
drawing.owner_cy_ = obj.owner_cy_;
|
||||
}
|
||||
else
|
||||
drawing.type_anchor = 2; // absolute
|
||||
}
|
||||
else
|
||||
|
||||
if (drawing.type_anchor == 1)
|
||||
{
|
||||
xlsx_table_position from, to;
|
||||
|
||||
@ -470,17 +485,19 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
_rect & r = obj.svg_rect_.get();
|
||||
|
||||
//todooo непонятно что делать с отрицательными значениями
|
||||
int val = 0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.x = val;
|
||||
_INT32 val = 0;
|
||||
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.x = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.y = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.y = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cx = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cx = val;
|
||||
|
||||
val = .5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cy = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cy = val;
|
||||
}
|
||||
|
||||
drawing.additional = obj.additional_;
|
||||
@ -555,7 +572,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
}
|
||||
std::wstring fileName = odf_packet_path_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -564,14 +581,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -589,7 +606,7 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
if (drawing.inGroup)
|
||||
@ -627,7 +644,7 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
@ -641,7 +658,7 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
|
||||
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_);
|
||||
}
|
||||
|
||||
@ -653,7 +670,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
xlsx_drawings_child->serialize(strm);
|
||||
xlsx_drawings_child->serialize(strm, L"xdr");
|
||||
|
||||
drawing.content_group_ = strm.str();
|
||||
|
||||
@ -661,7 +678,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
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_);
|
||||
|
||||
}
|
||||
@ -692,7 +709,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
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 объекта
|
||||
@ -716,9 +733,9 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
|
||||
@ -756,6 +773,5 @@ void xlsx_drawing_context::set_is_connector_shape(bool val)
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,15 +53,16 @@ namespace oox {
|
||||
class xlsx_drawings;
|
||||
struct _oox_fill;
|
||||
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
class xlsx_drawing_context_handle
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context_handle(mediaitems & items);
|
||||
xlsx_drawing_context_handle(mediaitems_ptr & items);
|
||||
~xlsx_drawing_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
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;
|
||||
|
||||
friend class xlsx_drawing_context;
|
||||
@ -72,10 +73,12 @@ public:
|
||||
|
||||
|
||||
|
||||
typedef _CP_PTR(xlsx_drawing_context_handle) xlsx_drawing_context_handle_ptr;
|
||||
|
||||
class xlsx_drawing_context
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle & h);
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h);
|
||||
~xlsx_drawing_context();
|
||||
|
||||
void set_odf_packet_path(std::wstring path){odf_packet_path_ = path;}//для анализа картинок
|
||||
@ -105,6 +108,7 @@ public:
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle, bool translate = false);
|
||||
|
||||
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 );
|
||||
@ -122,7 +126,8 @@ public:
|
||||
bool empty() const;
|
||||
void clear();
|
||||
|
||||
void serialize(std::wostream & strm);
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
|
||||
|
||||
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
|
||||
|
||||
xlsx_drawings_ptr get_drawings();
|
||||
|
||||
@ -85,28 +85,35 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(strm);
|
||||
xlsx_drawings_[i].serialize(strm, ns);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:wsDr")
|
||||
CP_XML_NODE(ns + L":wsDr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
if (ns == L"xdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
}
|
||||
if (ns == L"cdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
|
||||
}
|
||||
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++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM());
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,9 +199,9 @@ void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize(std::wostream & strm)
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
|
||||
@ -46,13 +46,14 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
struct drawing_elm
|
||||
{
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings)
|
||||
: filename(_filename), content(_content), drawings(_drawings)
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
|
||||
: filename(_filename), content(_content), drawings(_drawings), type(_type)
|
||||
{}
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
xlsx_drawings_ptr drawings;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class _xlsx_drawing;
|
||||
@ -71,7 +72,7 @@ public:
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
|
||||
void serialize (std::wostream & _Wostream);
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "xlsx_package.h"
|
||||
#include "docx_package.h"
|
||||
#include "pptx_package.h"
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
@ -298,16 +300,16 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
sheets_files_.add_sheet(sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(mediaitems & _Mediaitems)
|
||||
void xl_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void xl_files::set_comments(element_ptr Element)
|
||||
@ -563,10 +565,18 @@ xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
|
||||
void xl_drawings::write(const std::wstring & RootPath)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
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());
|
||||
|
||||
const std::wstring override_str = docx ? L"/word/drawings/" : (pptx ? L"/ppt/drawings/" : L"/xl/drawings/");
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
|
||||
|
||||
@ -578,10 +588,11 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
|
||||
const std::wstring kDrawingCT = drawings_[i].type == typeChartUserShapes ?
|
||||
L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml" :
|
||||
L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
|
||||
contentTypes->add_override(override_str + drawings_[i].filename, kDrawingCT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ public:
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
|
||||
@ -69,12 +69,12 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
xlsx_table_context_ (this, xlsx_text_context_),
|
||||
math_context_ (odf_document_->odf_context().fontContainer(), true),
|
||||
xlsx_style_ (this),
|
||||
|
||||
|
||||
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() ),
|
||||
mediaitems_ (odf_document_->get_folder()),
|
||||
xlsx_drawing_context_handle_(mediaitems_)
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() )
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
drawing_context_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
}
|
||||
|
||||
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
|
||||
@ -90,7 +90,16 @@ xlsx_conversion_context::~xlsx_conversion_context()
|
||||
|
||||
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
void xlsx_conversion_context::set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle)
|
||||
{
|
||||
drawing_context_handle_ = handle;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_mediaitems(mediaitems_ptr &items)
|
||||
{
|
||||
mediaitems_ = items;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart(std::wstring name)
|
||||
@ -323,7 +332,7 @@ 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(xlsx_drawing_context_handle_.content());
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
|
||||
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
|
||||
@ -496,13 +505,13 @@ void xlsx_conversion_context::end_table()
|
||||
L"../pivotTables/pivotTable" + std::to_wstring(it->second) + L".xml"));
|
||||
}
|
||||
|
||||
if (!get_drawing_context().empty())
|
||||
if (false == get_drawing_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize(strm);
|
||||
|
||||
const std::pair<std::wstring, std::wstring> drawingName
|
||||
= xlsx_drawing_context_handle_.add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
= drawing_context_handle_->add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
current_sheet().set_drawing_link(drawingName.first, drawingName.second);
|
||||
|
||||
@ -730,7 +739,7 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
else
|
||||
font_size =10;
|
||||
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
}
|
||||
@ -749,9 +758,9 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
|
||||
return get_table_context().get_drawing_context();
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
|
||||
xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle()
|
||||
{
|
||||
return xlsx_drawing_context_handle_;
|
||||
return drawing_context_handle_;
|
||||
}
|
||||
xlsx_comments_context & xlsx_conversion_context::get_comments_context()
|
||||
{
|
||||
|
||||
@ -188,12 +188,16 @@ public:
|
||||
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle);
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
void set_mediaitems(mediaitems_ptr &items);
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
@ -213,7 +217,7 @@ private:
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring> control_props_;
|
||||
@ -223,9 +227,9 @@ private:
|
||||
xlsx_table_context xlsx_table_context_;
|
||||
xlsx_text_context xlsx_text_context_;
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
xlsx_drawing_context_handle_ptr drawing_context_handle_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
@ -74,10 +74,6 @@ 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,17 +46,19 @@ 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_;
|
||||
};
|
||||
|
||||
|
||||
@ -221,6 +221,11 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
chart_context.set_cache_only(true);
|
||||
}
|
||||
|
||||
if (false == userShapes.first.empty())
|
||||
{
|
||||
chart_context.set_userShapes(userShapes);
|
||||
}
|
||||
|
||||
Context.end_chart();
|
||||
}
|
||||
else if (object_type_ == 2 && office_text_)
|
||||
@ -416,13 +421,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
std::vector<std::wstring> domain_cash;
|
||||
std::vector<std::wstring> cell_cash;
|
||||
std::vector<std::wstring> cat_cash;
|
||||
std::vector<std::wstring> label_cash;
|
||||
|
||||
calc_cache_series (domain_cell_range_adress_, domain_cash);
|
||||
calc_cache_series (series_[i].cell_range_address_, cell_cash);
|
||||
calc_cache_series (series_[i].label_cell_address_, label_cash);
|
||||
|
||||
if (false == categories_.empty())
|
||||
if (categories_.size() >0)
|
||||
calc_cache_series (categories_[0], cat_cash);
|
||||
|
||||
std::wstring formatCode = L"General";
|
||||
@ -436,11 +439,6 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
{
|
||||
formatCode = *strVal;
|
||||
}
|
||||
|
||||
if (false == series_[i].label_cell_address_.empty())
|
||||
{
|
||||
current->set_label_series(series_[i].label_cell_address_, label_cash);//_oox_strRef
|
||||
}
|
||||
|
||||
if (domain_cell_range_adress_.empty() == false ||
|
||||
last_set_type == chart_scatter)
|
||||
@ -457,14 +455,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
}
|
||||
else
|
||||
{ //x
|
||||
if (false == domain_cash.empty() || false == cash_values.empty())
|
||||
if (false == domain_cash.empty() || cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (2, domain_cash);
|
||||
}
|
||||
//y
|
||||
if (false == cell_cash.empty() || false == cash_values.empty())
|
||||
if (false == cell_cash.empty() || cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
|
||||
@ -206,6 +206,7 @@ public:
|
||||
std::map<std::wstring, _cell>cash_pivot;
|
||||
|
||||
std::wstring embeddedData;
|
||||
std::pair<std::wstring, std::wstring> userShapes;
|
||||
//---------------------------------------
|
||||
std::wstring target_table_;
|
||||
std::wstring table_name_;
|
||||
|
||||
@ -124,9 +124,8 @@ namespace chart {
|
||||
std::wstring chart_name_;
|
||||
std::wstring style_name_;
|
||||
std::vector<grid> grids_;
|
||||
int type_;
|
||||
|
||||
};
|
||||
int type_;
|
||||
};
|
||||
struct series : public simple
|
||||
{
|
||||
struct point : public simple
|
||||
|
||||
@ -499,6 +499,15 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
fill.gradient = oox::oox_gradient_fill::create();
|
||||
|
||||
Compute_GradientFill(image_style, fill.gradient);
|
||||
|
||||
if (fill.opacity)
|
||||
{
|
||||
for (size_t i = 0; i < fill.gradient->colors.size(); i++)
|
||||
{
|
||||
if (!fill.gradient->colors[i].opacity)
|
||||
fill.gradient->colors[i].opacity = fill.opacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,6 +207,11 @@ void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
|
||||
|
||||
if (frame->is_object_)
|
||||
{
|
||||
object_index = content_.size() - 1;
|
||||
}
|
||||
}
|
||||
else if (shape)
|
||||
{
|
||||
@ -256,16 +261,20 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_frame::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if (CP_CHECK_NAME(L"draw", L"text-box") ||
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение embedded объекта
|
||||
CP_CHECK_NAME(L"draw", L"object-ole") ||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
|
||||
CP_CHECK_NAME(L"draw", L"plugin") ||
|
||||
CP_CHECK_NAME(L"table", L"table")
|
||||
)
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"table", L"table") ||
|
||||
CP_CHECK_NAME(L"draw", L"object-ole")||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"floating-frame")||
|
||||
CP_CHECK_NAME(L"draw", L"plugin")
|
||||
)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"draw", L"object") //embedded объект
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
is_object_ = true;
|
||||
}
|
||||
else if CP_CHECK_NAME(L"office", L"event-listeners")
|
||||
{
|
||||
@ -324,6 +333,10 @@ 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";
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
static const ElementType type = typeDrawFrame;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_frame() : oox_drawing_(), idx_in_owner(-1) {}
|
||||
draw_frame() : oox_drawing_(), idx_in_owner(-1), is_object_(false) {}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
@ -185,10 +185,10 @@ public:
|
||||
|
||||
oox_drawing_ptr oox_drawing_;
|
||||
|
||||
bool is_object_;
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
|
||||
@ -209,7 +209,7 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_g() : position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
|
||||
draw_g() : object_index(-1), position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
@ -228,6 +228,8 @@ public:
|
||||
int position_child_x2;
|
||||
int position_child_y2;
|
||||
|
||||
int object_index ;
|
||||
|
||||
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);
|
||||
@ -271,8 +273,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){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_text_box);
|
||||
@ -307,6 +308,7 @@ public:
|
||||
|
||||
odf_document_ptr odf_document_;
|
||||
|
||||
office_element_ptr_array content_; //for case group with object
|
||||
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);
|
||||
|
||||
@ -923,7 +923,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = drawing->fill.bitmap->xlink_href_;
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -1196,7 +1196,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing->fill.type = 2;
|
||||
drawing->fill.bitmap->isInternal = false;
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->bStretch = true;
|
||||
|
||||
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
|
||||
@ -1216,7 +1216,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems().applicationFonts());
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems()->applicationFonts());
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_luminance_)
|
||||
{
|
||||
@ -1352,6 +1352,32 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.add_delayed_element(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (object_index >= 0) //только в документах нельзя объект объединять с шейпами в группы (
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame*>(content_[object_index].get());
|
||||
|
||||
frame->common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_ =
|
||||
common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
|
||||
|
||||
for (size_t i = 0; i < frame->content_.size(); i++)
|
||||
{
|
||||
draw_object *object = dynamic_cast<draw_object*>(frame->content_[i].get());
|
||||
if (!object)continue;
|
||||
|
||||
for (size_t j = 0; j < content_.size(); j++)
|
||||
{
|
||||
if (j == object_index) continue;
|
||||
|
||||
object->content_.push_back(content_[j]);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
frame->docx_convert(Context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oox::_docx_drawing drawing = oox::_docx_drawing();
|
||||
|
||||
@ -1451,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 || content_[0]->get_type() == typeDrawObject || content_[0]->get_type() == typeDrawObjectOle )
|
||||
if (content_[0]->get_type() == typeDrawImage)
|
||||
bImage = true;
|
||||
}
|
||||
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() && !bImage)
|
||||
@ -1541,6 +1567,10 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
|
||||
frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (frame)
|
||||
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
|
||||
if (objectBuild.table_table_)
|
||||
{
|
||||
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
|
||||
@ -1556,7 +1586,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
NSDirectory::CreateDirectory(href_folder);
|
||||
outputXlsx.write(href_folder);
|
||||
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
|
||||
@ -1565,11 +1595,34 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
if (false == content_.empty())
|
||||
{
|
||||
oox::xlsx_conversion_context xlsx_context(Context.root());
|
||||
|
||||
xlsx_context.set_drawing_context_handle(Context.get_chart_drawing_handle());
|
||||
xlsx_context.set_mediaitems(Context.get_mediaitems());
|
||||
|
||||
xlsx_context.get_table_context().start_table(L"", L"", 0);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); ++i)
|
||||
{
|
||||
xlsx_context.get_drawing_context().set_rel_anchor(drawing->cx, drawing->cy);
|
||||
content_[i]->xlsx_convert(xlsx_context);
|
||||
}
|
||||
xlsx_context.get_table_context().end_table();
|
||||
|
||||
xlsx_context.get_drawing_context().process_objects(xlsx_context.get_table_metrics());
|
||||
|
||||
std::wstringstream strm;
|
||||
xlsx_context.get_drawing_context().serialize(strm, L"cdr");
|
||||
|
||||
const std::pair<std::wstring, std::wstring> drawingName =
|
||||
xlsx_context.get_drawing_context_handle()->add_drawing_xml(strm.str(), xlsx_context.get_drawing_context().get_drawings(), oox::typeChartUserShapes );
|
||||
|
||||
objectBuild.userShapes = drawingName;
|
||||
}
|
||||
|
||||
objectBuild.docx_convert(Context);
|
||||
|
||||
frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (frame)
|
||||
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
if (!frame || !drawing)
|
||||
@ -1582,7 +1635,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->type = oox::typeChart;
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
}
|
||||
else if (objectBuild.object_type_ == 2 ) //embedded text
|
||||
{
|
||||
@ -1641,7 +1694,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool isMediaInternal = true;
|
||||
|
||||
href += FILE_SEPARATOR_STR + href_new;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectProgId = L"Excel.Sheet.12";
|
||||
}
|
||||
}
|
||||
@ -1682,7 +1735,7 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
|
||||
}
|
||||
void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
@ -303,7 +303,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
NSDirectory::CreateDirectory(href_folder);
|
||||
outputXlsx.write(href_folder);
|
||||
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
|
||||
|
||||
@ -224,11 +224,7 @@ void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & At
|
||||
}
|
||||
void presentation_footer_decl::add_text(const std::wstring & text)
|
||||
{
|
||||
text_ += text;
|
||||
}
|
||||
void presentation_footer_decl::add_space(const std::wstring & text)
|
||||
{
|
||||
text_ += text;
|
||||
text_ = text;
|
||||
}
|
||||
void presentation_footer_decl::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
@ -246,11 +242,7 @@ 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;
|
||||
}
|
||||
void presentation_date_time_decl::add_space(const std::wstring & text)
|
||||
{
|
||||
text_ += text;
|
||||
text_ = text;
|
||||
}
|
||||
void presentation_date_time_decl::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -104,7 +104,6 @@ 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){}
|
||||
@ -132,7 +131,6 @@ 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){}
|
||||
|
||||
@ -102,7 +102,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->name_space = L"w14";
|
||||
}
|
||||
|
||||
|
||||
@ -399,7 +399,7 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (state.ctrlPropId.empty())
|
||||
{
|
||||
std::wstring target;
|
||||
state.ctrlPropId = Context.get_mediaitems().add_control_props(target);
|
||||
state.ctrlPropId = Context.get_mediaitems()->add_control_props(target);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
|
||||
@ -52,12 +52,9 @@ std::wostream & svg_desc::text_to_stream(std::wostream & _Wostream, bool bXmlEnc
|
||||
|
||||
void svg_desc::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_ += Text;
|
||||
}
|
||||
void svg_desc::add_space(const std::wstring & Text)
|
||||
{
|
||||
text_ += Text;
|
||||
text_ = Text;
|
||||
}
|
||||
|
||||
// svg:font-face-uri
|
||||
//---------------------------------------------------------------------------------------
|
||||
const wchar_t * svg_font_face_uri::ns = L"svg";
|
||||
@ -83,6 +80,9 @@ 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,6 +103,9 @@ 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";
|
||||
@ -123,6 +126,9 @@ 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,6 +77,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);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_uri);
|
||||
|
||||
@ -99,7 +100,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);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_desc);
|
||||
|
||||
@ -121,6 +121,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);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_format);
|
||||
|
||||
@ -141,6 +142,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);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);
|
||||
|
||||
|
||||
@ -75,11 +75,7 @@ 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++)
|
||||
@ -117,11 +113,6 @@ 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,20 +50,22 @@ 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) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
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);
|
||||
|
||||
std::wstring text_label_;
|
||||
office_element_ptr_array content_;
|
||||
private:
|
||||
std::wstring text_label_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -79,18 +81,19 @@ 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) ;
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
note_body() {}
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
public:
|
||||
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,7 +184,9 @@ 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";
|
||||
@ -209,11 +211,7 @@ 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";
|
||||
@ -234,11 +232,6 @@ 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)
|
||||
{
|
||||
}
|
||||
@ -268,6 +261,10 @@ 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";
|
||||
@ -307,10 +304,7 @@ 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();
|
||||
@ -348,11 +342,7 @@ 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)
|
||||
{
|
||||
}
|
||||
@ -453,6 +443,9 @@ 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();
|
||||
@ -482,6 +475,9 @@ 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)
|
||||
{
|
||||
@ -512,6 +508,10 @@ 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,7 +544,9 @@ 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();
|
||||
@ -587,7 +589,9 @@ 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();
|
||||
@ -626,6 +630,9 @@ 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)
|
||||
{
|
||||
@ -656,7 +663,9 @@ 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();
|
||||
@ -687,7 +696,9 @@ 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();
|
||||
@ -721,7 +732,9 @@ 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();
|
||||
@ -747,7 +760,9 @@ 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();
|
||||
@ -771,6 +786,10 @@ 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,9 +58,8 @@ public:
|
||||
std::wstring get_style_name() const;
|
||||
|
||||
private:
|
||||
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) {}
|
||||
virtual void add_text(const std::wstring &);
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
odf_types::common_data_style_attlist common_data_style_attlist_;
|
||||
|
||||
@ -183,12 +182,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;
|
||||
|
||||
};
|
||||
|
||||
@ -211,7 +210,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);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
office_element_ptr_array text_;
|
||||
};
|
||||
@ -236,8 +234,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
// number-number-attlist
|
||||
_CP_OPT(std::wstring) number_decimal_replacement_;
|
||||
@ -275,7 +272,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);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(int) number_position_;
|
||||
office_element_ptr_array text_;
|
||||
@ -301,13 +297,16 @@ 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_space (const std::wstring & Text) {}
|
||||
virtual void add_text (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_;
|
||||
|
||||
@ -334,7 +333,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);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_language_;
|
||||
_CP_OPT(std::wstring) number_country_;
|
||||
@ -364,7 +362,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);
|
||||
virtual void add_space (const std::wstring & Text);
|
||||
|
||||
office_element_ptr_array text_;
|
||||
|
||||
@ -390,8 +387,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -418,8 +414,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -446,8 +441,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -473,8 +467,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(bool) number_textual_;
|
||||
_CP_OPT(bool) number_possessive_form_;
|
||||
@ -503,8 +496,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -526,13 +518,15 @@ 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_space (const std::wstring & Text) {}
|
||||
virtual void add_text (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_;
|
||||
|
||||
@ -557,8 +551,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(std::wstring) number_calendar_;
|
||||
@ -585,8 +578,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(std::wstring) number_style_;
|
||||
_CP_OPT(int) number_decimal_places_;
|
||||
@ -614,8 +606,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(number_am_pm);
|
||||
@ -638,8 +629,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) {}
|
||||
virtual void add_space (const std::wstring & Text) {}
|
||||
virtual void add_text (const std::wstring & Text);
|
||||
|
||||
_CP_OPT(int) number_min_integer_digits_;
|
||||
_CP_OPT(bool) number_grouping_;
|
||||
|
||||
@ -94,7 +94,10 @@ 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,9 +59,8 @@ 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_space(const std::wstring & Text) {}
|
||||
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
friend class odf_document;
|
||||
|
||||
office_element_ptr content_;
|
||||
|
||||
@ -75,6 +75,11 @@ 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();
|
||||
@ -121,7 +126,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
}
|
||||
int id = Context.get_drawing_context().get_current_shape_id();
|
||||
if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))
|
||||
|
||||
@ -61,15 +61,17 @@ 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_space(const std::wstring & Text) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
public:
|
||||
office_element_ptr content_;
|
||||
};
|
||||
|
||||
@ -82,6 +82,10 @@ 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,17 +47,18 @@ 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_space(const std::wstring & Text) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
public:
|
||||
std::wstring office_mimetype_;
|
||||
@ -189,7 +190,6 @@ 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,7 +216,6 @@ 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;
|
||||
@ -244,7 +243,6 @@ 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;
|
||||
@ -267,7 +265,6 @@ 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;
|
||||
@ -292,7 +289,6 @@ 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,9 +168,7 @@ private:
|
||||
virtual void add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
virtual void add_space(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// office_element impl
|
||||
public:
|
||||
virtual ElementType get_type() const
|
||||
|
||||
@ -57,6 +57,9 @@ 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
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -73,5 +76,9 @@ 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,6 +55,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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
@ -78,6 +79,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);
|
||||
|
||||
private:
|
||||
std::wstring script_language_;
|
||||
|
||||
@ -125,15 +125,6 @@ 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)
|
||||
{
|
||||
@ -316,7 +307,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
|
||||
{
|
||||
@ -507,11 +498,7 @@ 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;
|
||||
@ -616,11 +603,7 @@ 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;
|
||||
@ -759,6 +742,10 @@ 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
|
||||
@ -848,6 +835,12 @@ 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,6 +276,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);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@ -298,6 +299,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);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(reference_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@ -393,7 +395,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);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(span);
|
||||
@ -421,9 +422,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);
|
||||
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,6 +456,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);
|
||||
|
||||
std::wstring text_id_;
|
||||
odf_types::noteclass text_note_class_;
|
||||
@ -481,6 +482,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);
|
||||
|
||||
std::wstring text_style_name_;
|
||||
office_element_ptr text_ruby_base_;
|
||||
|
||||
@ -73,6 +73,12 @@ 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";
|
||||
@ -111,6 +117,12 @@ 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
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -146,6 +158,9 @@ 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,7 +95,8 @@ 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_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
public:
|
||||
odf_types::length style_position_;
|
||||
@ -135,7 +136,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){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
|
||||
};
|
||||
|
||||
@ -160,7 +160,8 @@ 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_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::common_xlink_attlist) xlink_attlist_;
|
||||
|
||||
@ -182,7 +183,8 @@ 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,10 +1204,7 @@ 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 (fontSizeVal <= 0)
|
||||
fontSizeVal = Context.get_current_fontSize();
|
||||
|
||||
if (style_text_position_->get_type() == text_position::Percent)
|
||||
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,9 +90,11 @@ 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_;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user