mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
21 Commits
v5.2.1.13
...
v5.2.99.88
| Author | SHA1 | Date | |
|---|---|---|---|
| 3816162555 | |||
| d8121d1a12 | |||
| a76bf57051 | |||
| 97b92cf75c | |||
| 506de8e9e1 | |||
| 677e3e49e0 | |||
| 02c84d107b | |||
| 49cd76d0f3 | |||
| 26f32dd511 | |||
| 395e54cf76 | |||
| 40476e7555 | |||
| 04f06c23a1 | |||
| a9a635747a | |||
| 4027a0de25 | |||
| f4fa754ce4 | |||
| 7d88a91fcc | |||
| 069b12839f | |||
| aa609336ca | |||
| 452917f213 | |||
| 5b5ccdc9be | |||
| adf7ca65ea |
@ -52,6 +52,7 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../UnicodeConverter/UnicodeConverter.h"
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
_UINT32 Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
@ -202,18 +202,20 @@ namespace DocFileFormat
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
{
|
||||
long result = S_FALSE;
|
||||
|
||||
WordDocument doc(progress, m_sTempFolder);
|
||||
WordprocessingDocument docx(strDstDirectory, &doc);
|
||||
|
||||
_UINT32 result = doc.LoadDocument(strSrcFile, password);
|
||||
result = doc.LoadDocument(strSrcFile, password);
|
||||
|
||||
if (result == 0)
|
||||
if (result == S_OK)
|
||||
{
|
||||
result = Convert(&doc, &docx, progress);
|
||||
|
||||
if (result == 0)
|
||||
if (result == S_OK)
|
||||
{
|
||||
docx.SaveDocument(bMacros);
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
@ -49,9 +48,9 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
|
||||
private:
|
||||
_UINT32 Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1042,7 +1042,7 @@ namespace DocFileFormat
|
||||
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:endnoteReference", true );
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_endnoteNr]);
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
if (desc && desc->aEndIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
@ -1348,8 +1348,6 @@ namespace DocFileFormat
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nestingLevel == iTap_current)
|
||||
@ -1379,8 +1377,6 @@ namespace DocFileFormat
|
||||
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ namespace DocFileFormat
|
||||
typedef struct FibWord2
|
||||
{
|
||||
unsigned int Spare = 0;
|
||||
unsigned short rgwSpare0[3];
|
||||
unsigned char rgwSpare0[3];
|
||||
|
||||
unsigned int fcPlcMcr = 0;
|
||||
unsigned int lcbPlcMcr = 0;
|
||||
@ -1312,10 +1312,10 @@ namespace DocFileFormat
|
||||
|
||||
flag16 = reader.ReadUInt16(); //10
|
||||
|
||||
m_FibBase.fDot = ((flag16 & 0x0001) >> 2) != 0;
|
||||
m_FibBase.fGlsy = ((flag16 & 0x0002) >> 1) != 0;
|
||||
m_FibBase.fComplex = ((flag16 & 0x0004) >> 2) != 0;
|
||||
m_FibBase.fHasPic = ((flag16 & 0x0008) >> 3) != 0;
|
||||
m_FibBase.fDot = (flag16 & 0x0001) >> 2;
|
||||
m_FibBase.fGlsy = (flag16 & 0x0002) >> 1;
|
||||
m_FibBase.fComplex = (flag16 & 0x0004) >> 2;
|
||||
m_FibBase.fHasPic = (flag16 & 0x0008) >> 3;
|
||||
m_FibBase.cQuickSaves = (WORD)(((int)flag16 & 0x00F0) >> 4);
|
||||
m_FibBase.fEncrypted = FormatUtils::BitmaskToBool((int)flag16, 0x0100);
|
||||
m_FibBase.fWhichTblStm = FormatUtils::BitmaskToBool((int)flag16, 0x0200);
|
||||
|
||||
@ -134,8 +134,6 @@ FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx,
|
||||
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,14 @@ public:
|
||||
|
||||
return rdUShort;
|
||||
}
|
||||
|
||||
void WriteUInt16(unsigned short val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((unsigned short *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(unsigned short);
|
||||
}
|
||||
}
|
||||
virtual short ReadInt16()
|
||||
{
|
||||
short rdShort = 0;
|
||||
@ -104,7 +111,14 @@ public:
|
||||
|
||||
return rdInt;
|
||||
}
|
||||
|
||||
void WriteInt32(_INT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_INT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_INT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned int ReadUInt32()
|
||||
{
|
||||
int rdUInt = 0;
|
||||
@ -117,7 +131,22 @@ public:
|
||||
|
||||
return rdUInt;
|
||||
}
|
||||
|
||||
void WriteByte(unsigned char val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
m_Data[m_Position] = val;
|
||||
m_Position += 1;
|
||||
}
|
||||
}
|
||||
void WriteUInt32(_UINT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_UINT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_UINT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned char ReadByte()
|
||||
{
|
||||
unsigned char rdByte = 0;
|
||||
@ -159,6 +188,14 @@ public:
|
||||
|
||||
return pBytes;
|
||||
}
|
||||
void WriteBytes(unsigned char* pData, int size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
memcpy(m_Data + m_Position, pData, size);
|
||||
m_Position += size;
|
||||
}
|
||||
}
|
||||
|
||||
virtual unsigned long GetPosition() const
|
||||
{
|
||||
@ -172,7 +209,7 @@ public:
|
||||
|
||||
virtual int Seek (int offset, int origin = 0/*STREAM_SEEK_SET*/)
|
||||
{
|
||||
if ( (m_Data != NULL) && (offset > 0) && ((unsigned int)offset < m_Size) )
|
||||
if ( (m_Data != NULL) && (offset >= 0) && ((unsigned int)offset < m_Size) )
|
||||
return m_Position = offset;
|
||||
|
||||
return 0;
|
||||
@ -180,7 +217,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
unsigned char* m_Data;
|
||||
unsigned char* m_Data;
|
||||
unsigned long m_Size;
|
||||
unsigned long m_Position;
|
||||
bool bMemoryCopy;
|
||||
|
||||
@ -697,8 +697,6 @@ namespace DocFileFormat
|
||||
{
|
||||
isPictureBullet = FormatUtils::BitmaskToBool(FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize), 0x1);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ namespace DocFileFormat
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
if (shape)
|
||||
{
|
||||
shape->m_nIndex = (int)i;
|
||||
shape->m_nIndex = i;
|
||||
if (shape->m_bBackground)
|
||||
{
|
||||
m_pBackgroud = shape;
|
||||
|
||||
@ -112,7 +112,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.x)
|
||||
{
|
||||
int index = (DWORD)point.x - 0x80000000;
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.x = guides[index].param3;
|
||||
}
|
||||
@ -120,7 +120,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.y)
|
||||
{
|
||||
int index = (DWORD)point.y - 0x80000000;
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
|
||||
@ -244,8 +244,6 @@ namespace DocFileFormat
|
||||
case sprmOldCFData:
|
||||
case sprmCFData:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,8 +117,6 @@ namespace DocFileFormat
|
||||
this->RsidDel = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//put the sprm on the revision stack
|
||||
|
||||
@ -130,8 +130,6 @@ namespace DocFileFormat
|
||||
appendValueAttribute( &pgBorders, L"w:display", L"notFirstPage" );
|
||||
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_ctx->_doc->nWordVersion == 2)
|
||||
|
||||
@ -92,8 +92,6 @@ namespace DocFileFormat
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
@ -320,8 +318,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1)
|
||||
|
||||
@ -70,7 +70,9 @@ namespace DocFileFormat
|
||||
case sprmTDefTable:
|
||||
{
|
||||
//SprmTDefTable tdef = new SprmTDefTable(sprm.Arguments);
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTTableHeader:
|
||||
case sprmTTableHeader:
|
||||
{ //header row
|
||||
@ -82,7 +84,9 @@ namespace DocFileFormat
|
||||
XMLTools::XMLElement header( L"w:tblHeader" );
|
||||
_trPr->AppendChild( header );
|
||||
}
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTWidthAfter:
|
||||
{ //width after
|
||||
XMLTools::XMLElement wAfter( L"w:wAfter" );
|
||||
@ -92,7 +96,9 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute wAfterType( L"w:type", L"dxa" );
|
||||
wAfter.AppendAttribute( wAfterType );
|
||||
_trPr->AppendChild( wAfter, true );
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTWidthBefore:
|
||||
{ //width before
|
||||
short before = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
@ -107,7 +113,9 @@ namespace DocFileFormat
|
||||
wBefore.AppendAttribute( wBeforeType );
|
||||
_trPr->AppendChild( wBefore, true );
|
||||
}
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTDyaRowHeight:
|
||||
case sprmTDyaRowHeight:
|
||||
{ //row height
|
||||
@ -139,19 +147,19 @@ namespace DocFileFormat
|
||||
_trPr->AppendChild( rowHeight );
|
||||
}
|
||||
break;
|
||||
case sprmOldTFCantSplit:
|
||||
case sprmTFCantSplit:
|
||||
case sprmTFCantSplit90:
|
||||
{ //can't split
|
||||
appendFlagElement( _trPr, *iter, L"cantSplit", true );
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
case sprmOldTFCantSplit:
|
||||
case sprmTFCantSplit:
|
||||
case sprmTFCantSplit90:
|
||||
{ //can't split
|
||||
appendFlagElement( _trPr, *iter, L"cantSplit", true );
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
}break;
|
||||
|
||||
//borders 80 exceptions
|
||||
//case SinglePropertyModifier.OperationCode.sprmTTableBorders80:
|
||||
// unsigned char[] brc80 = new unsigned char[4];
|
||||
|
||||
@ -427,9 +427,8 @@ namespace DocFileFormat
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"visibility", L"hidden");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -168,8 +168,6 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1684,8 +1682,6 @@ namespace DocFileFormat
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-top", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1823,12 +1819,12 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"none";
|
||||
case 1: return L"block";
|
||||
case 2: return L"classic";
|
||||
case 3: return L"diamond";
|
||||
case 4: return L"oval";
|
||||
case 5: return L"open";
|
||||
default: return L"none";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1836,9 +1832,9 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"short";
|
||||
case 1: return L"medium";
|
||||
case 2: return L"long";
|
||||
default: return L"short";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1846,9 +1842,9 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"narrow";
|
||||
case 1: return L"medium";
|
||||
case 2: return L"wide";
|
||||
default: return L"narrow";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
_UINT32 WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
int WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
{
|
||||
m_sFileName = fileName;
|
||||
m_sPassword = password;
|
||||
|
||||
@ -94,7 +94,7 @@ namespace DocFileFormat
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder );
|
||||
virtual ~WordDocument();
|
||||
|
||||
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
int LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
|
||||
int nWordVersion;
|
||||
int nDocumentCodePage;
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
#include "../DocDocxConverter/Converter.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
_UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
{
|
||||
_UINT32 hr = 0;
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
DocFileFormat::Converter docToDocx;
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
@ -46,7 +46,7 @@ _UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::w
|
||||
return hr;
|
||||
}
|
||||
|
||||
_UINT32 COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
HRESULT COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
{
|
||||
return 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ public:
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Writers
|
||||
NSDirectory::CreateDirectories(sCustomXmlRelsDir);
|
||||
|
||||
m_pDrawingConverter->SetDstContentRels();
|
||||
unsigned int lId;
|
||||
long lId;
|
||||
m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXmlProps.RelationType(), sCustomXMLPropsFilename, L"", &lId);
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
|
||||
@ -335,10 +335,48 @@ public:
|
||||
sShd += L"<w:shd";
|
||||
if(bValue)
|
||||
{
|
||||
if(shd_Nil == Value)
|
||||
sShd += L" w:val=\"nil\"";
|
||||
else
|
||||
sShd += L" w:val=\"clear\"";
|
||||
switch(Value)
|
||||
{
|
||||
case SimpleTypes::shdClear : sShd += L" w:val=\"clear\""; break;
|
||||
case SimpleTypes::shdDiagCross : sShd += L" w:val=\"diagCross\""; break;
|
||||
case SimpleTypes::shdDiagStripe : sShd += L" w:val=\"diagStripe\""; break;
|
||||
case SimpleTypes::shdHorzCross : sShd += L" w:val=\"horzCross\""; break;
|
||||
case SimpleTypes::shdHorzStripe : sShd += L" w:val=\"horzStripe\""; break;
|
||||
case SimpleTypes::shdNil : sShd += L" w:val=\"nil\""; break;
|
||||
case SimpleTypes::shdPct10 : sShd += L" w:val=\"pct10\""; break;
|
||||
case SimpleTypes::shdPct12 : sShd += L" w:val=\"pct12\""; break;
|
||||
case SimpleTypes::shdPct15 : sShd += L" w:val=\"pct15\""; break;
|
||||
case SimpleTypes::shdPct20 : sShd += L" w:val=\"pct20\""; break;
|
||||
case SimpleTypes::shdPct25 : sShd += L" w:val=\"pct25\""; break;
|
||||
case SimpleTypes::shdPct30 : sShd += L" w:val=\"pct30\""; break;
|
||||
case SimpleTypes::shdPct35 : sShd += L" w:val=\"pct35\""; break;
|
||||
case SimpleTypes::shdPct37 : sShd += L" w:val=\"pct37\""; break;
|
||||
case SimpleTypes::shdPct40 : sShd += L" w:val=\"pct40\""; break;
|
||||
case SimpleTypes::shdPct45 : sShd += L" w:val=\"pct45\""; break;
|
||||
case SimpleTypes::shdPct5 : sShd += L" w:val=\"pct5\""; break;
|
||||
case SimpleTypes::shdPct50 : sShd += L" w:val=\"pct50\""; break;
|
||||
case SimpleTypes::shdPct55 : sShd += L" w:val=\"pct55\""; break;
|
||||
case SimpleTypes::shdPct60 : sShd += L" w:val=\"pct60\""; break;
|
||||
case SimpleTypes::shdPct62 : sShd += L" w:val=\"pct62\""; break;
|
||||
case SimpleTypes::shdPct65 : sShd += L" w:val=\"pct65\""; break;
|
||||
case SimpleTypes::shdPct70 : sShd += L" w:val=\"pct70\""; break;
|
||||
case SimpleTypes::shdPct75 : sShd += L" w:val=\"pct75\""; break;
|
||||
case SimpleTypes::shdPct80 : sShd += L" w:val=\"pct80\""; break;
|
||||
case SimpleTypes::shdPct85 : sShd += L" w:val=\"pct85\""; break;
|
||||
case SimpleTypes::shdPct87 : sShd += L" w:val=\"pct87\""; break;
|
||||
case SimpleTypes::shdPct90 : sShd += L" w:val=\"pct90\""; break;
|
||||
case SimpleTypes::shdPct95 : sShd += L" w:val=\"pct95\""; break;
|
||||
case SimpleTypes::shdReverseDiagStripe : sShd += L" w:val=\"reverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdSolid : sShd += L" w:val=\"solid\""; break;
|
||||
case SimpleTypes::shdThinDiagCross : sShd += L" w:val=\"thinDiagCross\""; break;
|
||||
case SimpleTypes::shdThinDiagStripe : sShd += L" w:val=\"thinDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinHorzCross : sShd += L" w:val=\"thinHorzCross\""; break;
|
||||
case SimpleTypes::shdThinHorzStripe : sShd += L" w:val=\"thinHorzStripe\""; break;
|
||||
case SimpleTypes::shdThinReverseDiagStripe : sShd += L" w:val=\"thinReverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinVertStripe : sShd += L" w:val=\"thinVertStripe\""; break;
|
||||
case SimpleTypes::shdVertStripe : sShd += L" w:val=\"vertStripe\""; break;
|
||||
default : sShd += L" w:val=\"solid\""; break;
|
||||
}
|
||||
}
|
||||
sShd += L" w:color=\"auto\"";
|
||||
if(bColor)
|
||||
@ -2115,7 +2153,7 @@ class CDrawingProperty
|
||||
public:
|
||||
bool bObject;
|
||||
std::wstring sObjectProgram;
|
||||
unsigned int nObjectId;
|
||||
long nObjectId;
|
||||
BYTE nObjectType;
|
||||
|
||||
long DataPos;
|
||||
|
||||
@ -100,94 +100,88 @@ public:
|
||||
RELEASEOBJECT(m_oRPr)
|
||||
}
|
||||
};
|
||||
#ifndef READ1_DEF
|
||||
#define READ1_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read1defCurPos = 0;\
|
||||
while(read1defCurPos < (long)stLen)\
|
||||
|
||||
#define READ1_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read1defCurPos = 0;\
|
||||
while(read1defCurPos < stLen)\
|
||||
{\
|
||||
BYTE read1defType = m_oBufferedStream.GetUChar();\
|
||||
long read1defLength = m_oBufferedStream.GetLong();\
|
||||
res = fReadFunction(read1defType, read1defLength, arg);\
|
||||
if(res == c_oSerConstants::ReadUnknown)\
|
||||
{\
|
||||
BYTE read1defType = m_oBufferedStream.GetUChar();\
|
||||
long read1defLength = m_oBufferedStream.GetLong();\
|
||||
res = fReadFunction(read1defType, read1defLength, arg);\
|
||||
if(res == c_oSerConstants::ReadUnknown)\
|
||||
{\
|
||||
m_oBufferedStream.GetPointer(read1defLength);\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
}\
|
||||
else if(res != c_oSerConstants::ReadOk)\
|
||||
break;\
|
||||
read1defCurPos += read1defLength + 5;\
|
||||
m_oBufferedStream.GetPointer(read1defLength);\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
#ifndef READ2_DEF
|
||||
#define READ2_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read2defCurPos = 0;\
|
||||
while(read2defCurPos < (long)stLen)\
|
||||
else if(res != c_oSerConstants::ReadOk)\
|
||||
break;\
|
||||
read1defCurPos += read1defLength + 5;\
|
||||
}\
|
||||
}
|
||||
#define READ2_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read2defCurPos = 0;\
|
||||
while(read2defCurPos < stLen)\
|
||||
{\
|
||||
BYTE read2defType = m_oBufferedStream.GetUChar();\
|
||||
long read2defLenType = m_oBufferedStream.GetUChar();\
|
||||
int read2defCurPosShift = 2;\
|
||||
int read2defRealLen;\
|
||||
switch(read2defLenType)\
|
||||
{\
|
||||
BYTE read2defType = m_oBufferedStream.GetUChar();\
|
||||
long read2defLenType = m_oBufferedStream.GetUChar();\
|
||||
int read2defCurPosShift = 2;\
|
||||
int read2defRealLen;\
|
||||
switch(read2defLenType)\
|
||||
{\
|
||||
case c_oSerPropLenType::Null: read2defRealLen = 0;break;\
|
||||
case c_oSerPropLenType::Byte: read2defRealLen = 1;break;\
|
||||
case c_oSerPropLenType::Short: read2defRealLen = 2;break;\
|
||||
case c_oSerPropLenType::Three: read2defRealLen = 3;break;\
|
||||
case c_oSerPropLenType::Long:\
|
||||
case c_oSerPropLenType::Double: read2defRealLen = 4;break;\
|
||||
case c_oSerPropLenType::Variable:\
|
||||
read2defRealLen = m_oBufferedStream.GetLong();\
|
||||
read2defCurPosShift += 4;\
|
||||
break;\
|
||||
case c_oSerPropLenType::Double64: read2defRealLen = 8;break;\
|
||||
case c_oSerPropLenType::Long64: read2defRealLen = 8;break;\
|
||||
default:res = c_oSerConstants::ErrorUnknown;break;\
|
||||
}\
|
||||
if(res == c_oSerConstants::ReadOk)\
|
||||
res = fReadFunction(read2defType, read2defRealLen, arg);\
|
||||
if(res == c_oSerConstants::ReadUnknown)\
|
||||
{\
|
||||
m_oBufferedStream.GetPointer(read2defRealLen);\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
}\
|
||||
else if(res != c_oSerConstants::ReadOk)\
|
||||
break;\
|
||||
read2defCurPos += read2defRealLen + read2defCurPosShift;\
|
||||
case c_oSerPropLenType::Null: read2defRealLen = 0;break;\
|
||||
case c_oSerPropLenType::Byte: read2defRealLen = 1;break;\
|
||||
case c_oSerPropLenType::Short: read2defRealLen = 2;break;\
|
||||
case c_oSerPropLenType::Three: read2defRealLen = 3;break;\
|
||||
case c_oSerPropLenType::Long:\
|
||||
case c_oSerPropLenType::Double: read2defRealLen = 4;break;\
|
||||
case c_oSerPropLenType::Variable:\
|
||||
read2defRealLen = m_oBufferedStream.GetLong();\
|
||||
read2defCurPosShift += 4;\
|
||||
break;\
|
||||
case c_oSerPropLenType::Double64: read2defRealLen = 8;break;\
|
||||
case c_oSerPropLenType::Long64: read2defRealLen = 8;break;\
|
||||
default:res = c_oSerConstants::ErrorUnknown;break;\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
#ifndef READ_TABLE_DEF
|
||||
#define READ_TABLE_DEF(res, fReadFunction, arg) {\
|
||||
res = m_oBufferedStream.Peek(4) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;\
|
||||
if(res == c_oSerConstants::ReadOk)\
|
||||
res = fReadFunction(read2defType, read2defRealLen, arg);\
|
||||
if(res == c_oSerConstants::ReadUnknown)\
|
||||
{\
|
||||
m_oBufferedStream.GetPointer(read2defRealLen);\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
}\
|
||||
else if(res != c_oSerConstants::ReadOk)\
|
||||
break;\
|
||||
read2defCurPos += read2defRealLen + read2defCurPosShift;\
|
||||
}\
|
||||
}
|
||||
#define READ_TABLE_DEF(res, fReadFunction, arg) {\
|
||||
res = m_oBufferedStream.Peek(4) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;\
|
||||
if (c_oSerConstants::ReadOk == res) {\
|
||||
long readtabledefLen = m_oBufferedStream.GetLong();\
|
||||
res = m_oBufferedStream.Peek(readtabledefLen) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;\
|
||||
if (c_oSerConstants::ReadOk == res) {\
|
||||
long readtabledefLen = m_oBufferedStream.GetLong();\
|
||||
res = m_oBufferedStream.Peek(readtabledefLen) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;\
|
||||
if (c_oSerConstants::ReadOk == res) {\
|
||||
READ1_DEF(readtabledefLen, res, fReadFunction, arg);\
|
||||
}\
|
||||
READ1_DEF(readtabledefLen, res, fReadFunction, arg);\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
#ifndef READ1_TRACKREV
|
||||
#define READ1_TRACKREV(type, length, poResult) \
|
||||
if(c_oSerProp_RevisionType::Author == type)\
|
||||
{\
|
||||
poResult->Author = m_oBufferedStream.GetString3(length);\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::Date == type)\
|
||||
{\
|
||||
poResult->Date = m_oBufferedStream.GetString3(length);\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::Id == type)\
|
||||
{\
|
||||
poResult->Id = new long(m_oBufferedStream.GetLong());\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::UserId == type)\
|
||||
{\
|
||||
poResult->UserId = m_oBufferedStream.GetString3(length);\
|
||||
}
|
||||
#endif
|
||||
}\
|
||||
}
|
||||
#define READ1_TRACKREV(type, length, poResult) \
|
||||
if(c_oSerProp_RevisionType::Author == type)\
|
||||
{\
|
||||
poResult->Author = m_oBufferedStream.GetString3(length);\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::Date == type)\
|
||||
{\
|
||||
poResult->Date = m_oBufferedStream.GetString3(length);\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::Id == type)\
|
||||
{\
|
||||
poResult->Id = new long(m_oBufferedStream.GetLong());\
|
||||
}\
|
||||
else if(c_oSerProp_RevisionType::UserId == type)\
|
||||
{\
|
||||
poResult->UserId = m_oBufferedStream.GetString3(length);\
|
||||
}
|
||||
|
||||
void InnerColorToOOX(rPr& oRPr, ComplexTypes::Word::CColor& oColor);
|
||||
|
||||
class Binary_CommonReader
|
||||
@ -2062,7 +2056,7 @@ public:
|
||||
if(true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW)
|
||||
{
|
||||
//ищем по tblGrid
|
||||
if(orowPrAfterBefore.nGridAfter < (long)m_aCurTblGrid.size())
|
||||
if(orowPrAfterBefore.nGridAfter < m_aCurTblGrid.size())
|
||||
{
|
||||
double nSumW = 0;
|
||||
for(int i = 0; i < orowPrAfterBefore.nGridAfter; i++)
|
||||
@ -2604,7 +2598,7 @@ public:
|
||||
if ( c_oSerNumTypes::Lvl == type )
|
||||
{
|
||||
docLvl* odocLvl = new docLvl();
|
||||
odocLvl->ILvl = (long)odocANum->Lvls.size();
|
||||
odocLvl->ILvl = odocANum->Lvls.size();
|
||||
READ2_DEF(length, res, this->ReadLevel, odocLvl);
|
||||
odocANum->Lvls.push_back(odocLvl);
|
||||
}
|
||||
@ -3899,7 +3893,7 @@ public:
|
||||
oFile.WriteFile(pData, length);
|
||||
oFile.CloseFile();
|
||||
|
||||
unsigned int lId = 0;
|
||||
long lId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), sJsaProject.GetPath(), L"", &lId);
|
||||
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(sJsaProject.GetExtention(false));
|
||||
}
|
||||
@ -4526,7 +4520,7 @@ public:
|
||||
READ1_DEF(length, res, this->ReadParagraphContent, NULL);
|
||||
if (!pHyperlink->sLink.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
@ -6877,7 +6871,7 @@ public:
|
||||
std::wstring sNewImgRel = _T("media/") + sNewImgName;
|
||||
|
||||
sNewImgRel = XmlUtils::EncodeXmlString(sNewImgRel);
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")), sNewImgRel, std::wstring(), &rId);
|
||||
odocImg.srId = L"rId" + std::to_wstring(rId);
|
||||
//odocImg.srId = m_oMediaWriter.m_poDocumentRelsWriter->AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"), sNewImgRel, false);
|
||||
@ -7418,7 +7412,7 @@ public:
|
||||
if (oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace))
|
||||
{
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
unsigned int rIdXlsx;
|
||||
long rIdXlsx;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
@ -7445,7 +7439,7 @@ public:
|
||||
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + L".rels";
|
||||
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(pathChartsRels.GetPath());
|
||||
|
||||
unsigned int rIdChart;
|
||||
long rIdChart;
|
||||
std::wstring bstrChartRelType = OOX::FileTypes::Chart.RelationType();
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartRelType, sRelsName, std::wstring(), &rIdChart);
|
||||
@ -8552,7 +8546,7 @@ public:
|
||||
m_oBufferedStream.Seek(nDocumentOffset);
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
unsigned int stamdartRId;
|
||||
long stamdartRId;
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", L"styles.xml", L"", &stamdartRId);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", L"settings.xml", L"", &stamdartRId);
|
||||
@ -8580,19 +8574,19 @@ public:
|
||||
|
||||
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", L"numbering.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml");
|
||||
}
|
||||
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", L"footnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml");
|
||||
}
|
||||
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", L"endnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml");
|
||||
}
|
||||
@ -8601,7 +8595,7 @@ public:
|
||||
Writers::HdrFtrItem* pHeader = m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders[i];
|
||||
if(false == pHeader->IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", pHeader->m_sFilename, std::wstring(), &rId);
|
||||
pHeader->rId = L"rId" + std::to_wstring( rId );
|
||||
|
||||
@ -8613,7 +8607,7 @@ public:
|
||||
Writers::HdrFtrItem* pFooter = m_oFileWriter.m_oHeaderFooterWriter.m_aFooters[i];
|
||||
if(false == pFooter->IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", pFooter->m_sFilename, std::wstring(), &rId);
|
||||
pFooter->rId = L"rId" + std::to_wstring( rId );
|
||||
|
||||
@ -8623,7 +8617,7 @@ public:
|
||||
if(!oSettingsCustom.IsEmpty()){
|
||||
std::wstring sFilename = m_oFileWriter.m_oCustomXmlWriter.WriteCustomXml(oSettingsCustom.GetSchemaUrl(), oSettingsCustom.ToXml());
|
||||
std::wstring sRelsPath = L"../" + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath() + L"/" + sFilename;
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXml.RelationType(), sRelsPath, L"", &rId);
|
||||
}
|
||||
|
||||
@ -8644,19 +8638,19 @@ public:
|
||||
|
||||
if(false == oCommentsWriter.m_sComment.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
|
||||
}
|
||||
if(false == oCommentsWriter.m_sCommentExt.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
|
||||
}
|
||||
if(false == oCommentsWriter.m_sPeople.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
|
||||
}
|
||||
|
||||
@ -1438,8 +1438,8 @@ namespace MathEquation
|
||||
}
|
||||
else if (eType == commandBrackets)
|
||||
{
|
||||
MBRACKETSTYPE ebType = MBRACKETSTYPE::bracketsAngle; //???
|
||||
EndBrackets(ebType, false, false);
|
||||
MBRACKETSTYPE ebType;
|
||||
EndBrackets(ebType, false,false);
|
||||
}
|
||||
}
|
||||
virtual void BeginAngleBracketsWithSeparator(MANGLEBRACKETSWITHSEPARATORTYPE eType)
|
||||
|
||||
@ -315,19 +315,19 @@ namespace BinDocxRW
|
||||
void WriteShd(const ComplexTypes::Word::CShading& Shd)
|
||||
{
|
||||
//Type
|
||||
if(false != Shd.m_oVal.IsInit())
|
||||
if (false != Shd.m_oVal.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerShdType::Value);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(Shd.m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
|
||||
default: m_oStream.WriteBYTE(shd_Clear);break;
|
||||
}
|
||||
m_oStream.WriteBYTE(Shd.m_oVal.get().GetValue()); //Misalignment-footer.doc
|
||||
|
||||
}
|
||||
//Value
|
||||
if(false != Shd.m_oFill.IsInit())
|
||||
if (false != Shd.m_oFill.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oFill.get());
|
||||
else if (false != Shd.m_oColor.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oColor.get());
|
||||
|
||||
WriteThemeColor(c_oSerShdType::ColorTheme, Shd.m_oFill, Shd.m_oThemeFill, Shd.m_oThemeFillTint, Shd.m_oThemeFillShade);
|
||||
}
|
||||
void WriteDistance(const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistL,
|
||||
|
||||
@ -282,7 +282,7 @@ namespace BinXlsxRW{
|
||||
{
|
||||
OOX::Spreadsheet::CTableColumn* pTableColumn = new OOX::Spreadsheet::CTableColumn();
|
||||
pTableColumn->m_oId.Init();
|
||||
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
|
||||
pTableColumn->m_oId->SetValue(i + 1);
|
||||
pTableColumn->m_oName.Init();
|
||||
pTableColumn->m_oName->append(m_aTableNames[i]);
|
||||
pTable->m_oTable->m_oTableColumns->m_arrItems.push_back(pTableColumn);
|
||||
@ -604,7 +604,7 @@ namespace BinXlsxRW{
|
||||
// Не число
|
||||
aSharedStrings.push_back(val);
|
||||
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
|
||||
pCell->m_oValue->m_sText = std::to_wstring((int)aSharedStrings.size() - 1);
|
||||
pCell->m_oValue->m_sText = std::to_wstring(aSharedStrings.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -658,7 +658,7 @@ namespace BinXlsxRW{
|
||||
|
||||
if(NULL != format)
|
||||
{
|
||||
int nXfsIndex = (int)m_aXfs.size();
|
||||
int nXfsIndex = m_aXfs.size();
|
||||
|
||||
boost::unordered_map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
if(itFormat == m_mapFormats.end())
|
||||
|
||||
@ -196,7 +196,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
bool bValidFormat = false;
|
||||
std::wstring sSignature(g_sFormatSignature);
|
||||
int nSigLength = (int)sSignature.length();
|
||||
if((int)nBase64DataSize > nSigLength)
|
||||
if(nBase64DataSize > nSigLength)
|
||||
{
|
||||
std::string sCurSig((char*)pBase64Data, nSigLength);
|
||||
if(sSignature == std::wstring(sCurSig.begin(), sCurSig.end()))
|
||||
|
||||
@ -85,7 +85,7 @@ namespace BinXlsxRW{
|
||||
sMediaPath = pathMediaDir.GetPath();
|
||||
sEmbedPath = pathEmbedDir.GetPath();
|
||||
}
|
||||
_UINT32 CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
int CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
@ -100,7 +100,7 @@ namespace BinXlsxRW{
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
}
|
||||
_UINT32 CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
int CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
|
||||
pFontPicker->Init(m_sFontDir);
|
||||
@ -136,7 +136,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
_UINT32 result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
int result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return result;
|
||||
@ -186,7 +186,7 @@ namespace BinXlsxRW{
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
unsigned int rId;
|
||||
long rId;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#define XLSX_SERIALIZER
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -63,8 +62,8 @@ namespace BinXlsxRW {
|
||||
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
_UINT32 loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
_UINT32 saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
int loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
int saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
|
||||
@ -53,6 +53,12 @@
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */; };
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2042130146000D9C0F1 /* xmlutils.h */; };
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2062130146800D9C0F1 /* xmllight_private.h */; };
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2072130146800D9C0F1 /* xmldom.cpp */; };
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2082130146800D9C0F1 /* xmllight.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -103,6 +109,12 @@
|
||||
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
|
||||
8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader.cpp; path = ../../../Common/FileDownloader/FileDownloader.cpp; sourceTree = "<group>"; };
|
||||
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmlutils.h; path = ../../../DesktopEditor/xml/include/xmlutils.h; sourceTree = "<group>"; };
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmllight_private.h; path = ../../../DesktopEditor/xml/src/xmllight_private.h; sourceTree = "<group>"; };
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmldom.cpp; path = ../../../DesktopEditor/xml/src/xmldom.cpp; sourceTree = "<group>"; };
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmllight.cpp; path = ../../../DesktopEditor/xml/src/xmllight.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -135,6 +147,7 @@
|
||||
17E17EDE1AC453F800BEA2EA /* ASCOfficeDocxFile2Lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */,
|
||||
17E17F4D1AC454E200BEA2EA /* Common */,
|
||||
17E17F1A1AC4549B00BEA2EA /* XlsxSerializerCom */,
|
||||
17E17F0D1AC4546100BEA2EA /* DocWrapper */,
|
||||
@ -149,6 +162,8 @@
|
||||
children = (
|
||||
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */,
|
||||
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */,
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */,
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */,
|
||||
17A765271B0F3DC30046BC0B /* DefaultThemeWriter.h */,
|
||||
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */,
|
||||
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */,
|
||||
@ -252,6 +267,17 @@
|
||||
name = BinWriter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */,
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */,
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */,
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */,
|
||||
);
|
||||
name = XmlUtils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
@ -276,7 +302,9 @@
|
||||
17C1FEAD1ACC42C4006B99B3 /* ChartWriter.h in Headers */,
|
||||
17C1FEAE1ACC42C4006B99B3 /* DocumentRelsWriter.h in Headers */,
|
||||
17C1FEAF1ACC42C4006B99B3 /* CommentsWriter.h in Headers */,
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */,
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */,
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */,
|
||||
17C1FEB01ACC42C4006B99B3 /* BinaryCommonReader.h in Headers */,
|
||||
17C1FEB11ACC42C4006B99B3 /* Common.h in Headers */,
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */,
|
||||
@ -292,6 +320,7 @@
|
||||
17C1FEBC1ACC42C4006B99B3 /* DocxSerializer.h in Headers */,
|
||||
17C1FEBD1ACC42C4006B99B3 /* FileWriter.h in Headers */,
|
||||
17C1FEBE1ACC42C4006B99B3 /* CSVWriter.h in Headers */,
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -346,17 +375,20 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */,
|
||||
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
|
||||
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
|
||||
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
|
||||
17C1FE991ACC42C4006B99B3 /* DocxSerializer.cpp in Sources */,
|
||||
17C1FE9A1ACC42C4006B99B3 /* CommonWriter.cpp in Sources */,
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */,
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
|
||||
);
|
||||
|
||||
@ -408,7 +408,7 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const &
|
||||
{
|
||||
std::wstring out;
|
||||
|
||||
size_t sz = what.size();
|
||||
int sz = what.size();
|
||||
|
||||
if (what[1].matched)
|
||||
{
|
||||
@ -568,7 +568,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
boost::algorithm::split(distance_inp,expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < distance_inp.size(); i++)
|
||||
for (int i = 0; i < distance_inp.size(); i++)
|
||||
{
|
||||
std::wstring sheet;
|
||||
std::vector<std::wstring> range;
|
||||
@ -576,7 +576,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
boost::algorithm::split(range, distance_inp[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t j = 0 ; j < range.size(); j++)
|
||||
for (int j = 0 ; j < range.size(); j++)
|
||||
{
|
||||
int pos = range[j].find('!');
|
||||
if (0 <= pos)
|
||||
@ -588,7 +588,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
}
|
||||
std::wstring cells_out;
|
||||
for (size_t c = 0; c < cells.size(); c++)
|
||||
for (int c = 0; c < cells.size(); c++)
|
||||
{
|
||||
if (!sheet.empty())
|
||||
cells_out += sheet + L".";
|
||||
@ -607,7 +607,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
}
|
||||
std::wstring result;
|
||||
|
||||
for (size_t i = 0 ; i < distance_out.size(); i++)
|
||||
for (int i = 0 ; i < distance_out.size(); i++)
|
||||
{
|
||||
result += distance_out[i];
|
||||
result += L" ";
|
||||
@ -743,7 +743,7 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
|
||||
XmlUtils::replace_all( expr, L")", L"");
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i=0; i < splitted.size(); i++)
|
||||
for (long i=0; i < splitted.size(); i++)
|
||||
{
|
||||
int res = splitted[i].find(L"!");
|
||||
if (res > 0) splitted[i] = splitted[i].substr(res+1, splitted[i].size()-res);
|
||||
|
||||
@ -310,7 +310,6 @@ typedef xml::writer::element<wchar_t> xml_element;
|
||||
#define CP_XML_WRITER(STRM) if (bool _b_ = false) {} else for (xml_writer _xml_wr_((STRM));!_b_;_b_=true)
|
||||
#define CP_XML_NODE(NAME) if (bool _b_ = false) {} else for (xml_element _xml_node_(_xml_wr_, (NAME));!_b_;_b_=true)
|
||||
#define CP_XML_ATTR(NAME, VAL) _xml_node_.attr((NAME),(VAL))
|
||||
#define CP_XML_ATTR2(NAME, VAL) _xml_node_.attr((std::wstring(NAME).c_str()),(VAL))
|
||||
#define CP_XML_CONTENT(VAL) _xml_node_.contents((VAL))
|
||||
#define CP_XML_STREAM() _xml_node_.stream()
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
#include "../include/odf/odf_document.h"
|
||||
|
||||
_UINT32 ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::xlsx_document outputXlsx;
|
||||
cpdoccore::oox::xlsx_conversion_context conversionContext( &inputOdf);
|
||||
@ -56,7 +56,7 @@ _UINT32 ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const st
|
||||
outputXlsx.write(dstPath);
|
||||
return 0;
|
||||
}
|
||||
_UINT32 ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
int ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::docx_document outputDocx;
|
||||
cpdoccore::oox::docx_conversion_context conversionContext(&inputOdf);
|
||||
@ -70,7 +70,7 @@ _UINT32 ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const st
|
||||
|
||||
return 0;
|
||||
}
|
||||
_UINT32 ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
int ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::pptx_document outputPptx;
|
||||
cpdoccore::oox::pptx_conversion_context conversionContext(&inputOdf);
|
||||
@ -83,9 +83,9 @@ _UINT32 ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const st
|
||||
|
||||
return 0;
|
||||
}
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
{
|
||||
_UINT32 nResult = 0;
|
||||
int nResult = 0;
|
||||
|
||||
try
|
||||
{
|
||||
@ -134,9 +134,9 @@ _UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstP
|
||||
|
||||
}
|
||||
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
int ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
{
|
||||
_UINT32 nResult = 0;
|
||||
int nResult = 0;
|
||||
|
||||
std::wstring manifest_xml = srcPath + FILE_SEPARATOR_STR + L"META-INF" + FILE_SEPARATOR_STR + L"manifest.xml";
|
||||
std::wstring mimetype_xml = srcPath + FILE_SEPARATOR_STR + L"mimetype";
|
||||
|
||||
@ -31,11 +31,10 @@
|
||||
*/
|
||||
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include <string>
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
int ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
|
||||
@ -42,7 +42,7 @@ std::string ansi_to_utf8(const std::string & _AnsiString)
|
||||
|
||||
std::wstring utf8_to_utf16(const std::string & _Utf8String)
|
||||
{
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)_Utf8String.c_str(), (LONG)_Utf8String.length());
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)_Utf8String.c_str(), _Utf8String.length());
|
||||
}
|
||||
|
||||
std::string utf16_to_utf8(const std::wstring & _Utf16String)
|
||||
|
||||
@ -72,10 +72,10 @@ std::wostream & override_content_type::xml_to_stream(std::wostream & _Wostream)
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
const wchar_t * content_type::ns = L"";
|
||||
const wchar_t * content_type::name = L"Types";
|
||||
const wchar_t * content_type_content::ns = L"";
|
||||
const wchar_t * content_type_content::name = L"Types";
|
||||
|
||||
std::wostream & content_type::xml_to_stream(std::wostream & _Wostream) const
|
||||
std::wostream & content_type_content::xml_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
|
||||
@ -86,8 +86,8 @@ public:
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
// content_type
|
||||
class content_type : public xml::element_impl<content_type>
|
||||
// content_type_content
|
||||
class content_type_content : public xml::element_impl<content_type_content>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
|
||||
@ -128,14 +128,63 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
void text_forms_context::start_element (int type)
|
||||
{
|
||||
current_state_.clear();
|
||||
|
||||
current_state_.type = type;
|
||||
}
|
||||
void text_forms_context::set_id (const std::wstring& id)
|
||||
{
|
||||
current_state_.id = id;
|
||||
}
|
||||
void text_forms_context::set_name (const std::wstring& name)
|
||||
{
|
||||
current_state_.name = name;
|
||||
}
|
||||
void text_forms_context::set_label (const std::wstring& label)
|
||||
{
|
||||
current_state_.label = label;
|
||||
}
|
||||
void text_forms_context::set_uuid (const std::wstring& uuid)
|
||||
{
|
||||
current_state_.uuid = uuid;
|
||||
}
|
||||
void text_forms_context::set_value (const std::wstring &value)
|
||||
{
|
||||
current_state_.value = value;
|
||||
}
|
||||
void text_forms_context::set_element(odf_reader::form_element *elm)
|
||||
{
|
||||
current_state_.element = elm;
|
||||
}
|
||||
void text_forms_context::end_element ()
|
||||
{
|
||||
mapElements_.insert( std::make_pair(current_state_.id, current_state_));
|
||||
|
||||
current_state_.clear();
|
||||
}
|
||||
text_forms_context::_state& text_forms_context::get_state_element (std::wstring id)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator it = mapElements_.find(id);
|
||||
|
||||
if (it != mapElements_.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
next_dump_page_properties_ (false),
|
||||
page_break_ (false),
|
||||
page_break_after_ (false),
|
||||
page_break_before_ (false),
|
||||
in_run_ (false),
|
||||
in_automatic_style_ (false),
|
||||
in_paragraph_ (false),
|
||||
in_header_ (false),
|
||||
in_drawing_content_ (false),
|
||||
in_table_content_ (false),
|
||||
@ -146,6 +195,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
is_rtl_ (false),
|
||||
is_paragraph_keep_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
@ -197,14 +247,14 @@ std::wstring styles_map::name(const std::wstring & Name, odf_types::style_family
|
||||
}
|
||||
void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
{
|
||||
if (!state_.in_run_)
|
||||
if (!in_run_)
|
||||
{
|
||||
state_.in_run_ = true;
|
||||
in_run_ = true;
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
if (!state_.text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
if (!text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
{
|
||||
if (!state_.text_properties_stack_.empty())
|
||||
if (!text_properties_stack_.empty())
|
||||
{
|
||||
odf_reader::style_text_properties_ptr textProp = this->current_text_properties();
|
||||
get_styles_context().start();
|
||||
@ -222,36 +272,36 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
|
||||
void docx_conversion_context::start_paragraph(bool is_header)
|
||||
{
|
||||
if (state_.in_paragraph_)
|
||||
if (in_paragraph_)
|
||||
finish_paragraph();
|
||||
|
||||
output_stream() << L"<w:p>";
|
||||
|
||||
in_header_ = is_header;
|
||||
in_paragraph_ = true;
|
||||
is_rtl_ = false;
|
||||
|
||||
state_.in_paragraph_ = true;
|
||||
start_changes();
|
||||
}
|
||||
|
||||
void docx_conversion_context::finish_paragraph()
|
||||
{
|
||||
if (state_.in_paragraph_)
|
||||
if (in_paragraph_)
|
||||
{
|
||||
end_changes();
|
||||
|
||||
output_stream() << L"</w:p>";
|
||||
}
|
||||
|
||||
in_header_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
state_.in_paragraph_ = false;
|
||||
in_paragraph_ = false;
|
||||
in_header_ = false;
|
||||
is_paragraph_keep_ = false;
|
||||
}
|
||||
|
||||
|
||||
void docx_conversion_context::finish_run()
|
||||
{
|
||||
if (false == state_.in_run_) return;
|
||||
if (false == in_run_) return;
|
||||
|
||||
if (get_comments_context().state() == 4)
|
||||
{
|
||||
@ -259,7 +309,7 @@ void docx_conversion_context::finish_run()
|
||||
get_comments_context().state(0);
|
||||
}
|
||||
output_stream() << L"</w:r>";
|
||||
state_.in_run_ = false;
|
||||
in_run_ = false;
|
||||
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
@ -581,27 +631,6 @@ oox_chart_context & docx_conversion_context::current_chart()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::reset_context_state()
|
||||
{
|
||||
keep_state_.push_back(state_);
|
||||
|
||||
state_.in_paragraph_ = false;
|
||||
state_.in_run_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
|
||||
state_.drawing_text_props_.clear();
|
||||
state_.text_properties_stack_.clear();
|
||||
|
||||
get_styles_context().text_style_ext().clear();
|
||||
}
|
||||
void docx_conversion_context::back_context_state()
|
||||
{
|
||||
state_ = keep_state_.back();
|
||||
keep_state_.pop_back();
|
||||
|
||||
get_styles_context().text_style_ext().clear();
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
{
|
||||
finish_run();
|
||||
@ -1017,36 +1046,13 @@ void docx_conversion_context::process_styles()
|
||||
_Wostream << L"<w:pPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
if (content->get_style_paragraph_properties())
|
||||
{
|
||||
if(content->get_style_paragraph_properties()->content_.fo_background_color_)
|
||||
{
|
||||
odf_types::background_color color = *content->get_style_paragraph_properties()->content_.fo_background_color_;
|
||||
if ((color.get_type() != odf_types::background_color::Transparent &&
|
||||
color.get_color() == odf_types::color(L"ffffff")) ||
|
||||
(color.get_type() == odf_types::background_color::Transparent))
|
||||
{
|
||||
content->get_style_paragraph_properties()->content_.fo_background_color_ = boost::none;
|
||||
}
|
||||
}
|
||||
}
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:pPrDefault>";
|
||||
}
|
||||
if (odf_reader::style_instance * defaultParStyle = styles.style_default_by_type(odf_types::style_family::Text))
|
||||
{
|
||||
_Wostream << L"<w:rPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:rPrDefault>";
|
||||
}
|
||||
|
||||
_Wostream << L"</w:docDefaults>";
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
@ -1094,7 +1100,7 @@ void docx_conversion_context::process_styles()
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
{
|
||||
get_tabs_context().clear();
|
||||
calc_tab_stops(arStyles[i].get(), get_tabs_context());
|
||||
odf_reader::calc_tab_stops(arStyles[i].get(), get_tabs_context());
|
||||
|
||||
get_styles_context().start_process_style(arStyles[i].get());
|
||||
content->docx_convert(*this, true);
|
||||
@ -1346,22 +1352,22 @@ bool docx_conversion_context::in_automatic_style()
|
||||
|
||||
void docx_conversion_context::push_text_properties(const odf_reader::style_text_properties * TextProperties)
|
||||
{
|
||||
state_.text_properties_stack_.push_back(TextProperties);
|
||||
text_properties_stack_.push_back(TextProperties);
|
||||
}
|
||||
|
||||
void docx_conversion_context::pop_text_properties()
|
||||
{
|
||||
state_.text_properties_stack_.pop_back();
|
||||
text_properties_stack_.pop_back();
|
||||
}
|
||||
|
||||
odf_reader::style_text_properties_ptr docx_conversion_context::current_text_properties()
|
||||
{
|
||||
odf_reader::style_text_properties_ptr cur = boost::make_shared<odf_reader::style_text_properties>();
|
||||
|
||||
for (size_t i = 0; i < state_.text_properties_stack_.size(); i++)
|
||||
for (size_t i = 0; i < text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (state_.text_properties_stack_[i])
|
||||
cur->content().apply_from( state_.text_properties_stack_[i]->content() );
|
||||
if (text_properties_stack_[i])
|
||||
cur->content().apply_from( text_properties_stack_[i]->content() );
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -1569,7 +1575,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
|
||||
start_automatic_style(id);
|
||||
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
odf_reader::calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
|
||||
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
|
||||
@ -1761,11 +1767,6 @@ void docx_conversion_context::serialize_list_properties(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
void docx_conversion_context::set_drawing_text_props (const std::wstring &props)
|
||||
{
|
||||
get_styles_context().text_style_ext() = props;
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_delayed_element(odf_reader::office_element * Elm)
|
||||
{
|
||||
delayed_elements_.push_back(Elm);
|
||||
@ -1941,7 +1942,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
|
||||
|
||||
map_current_changes_.insert(std::pair<std::wstring, text_tracked_context::_state> (id, state_add));
|
||||
|
||||
if (state_.in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
if (in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
{
|
||||
map_changes_iterator it = map_current_changes_.find(id);
|
||||
text_tracked_context::_state &state = it->second;
|
||||
@ -2113,7 +2114,7 @@ void docx_conversion_context::end_text_changes (const std::wstring &id)
|
||||
|
||||
if (state.active)
|
||||
{
|
||||
if (state_.in_paragraph_)
|
||||
if (in_paragraph_)
|
||||
finish_run();
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
|
||||
@ -572,6 +572,47 @@ private:
|
||||
std::map<std::wstring, _state> mapChanges_;
|
||||
};
|
||||
|
||||
class text_forms_context
|
||||
{
|
||||
public:
|
||||
struct _state
|
||||
{
|
||||
std::wstring id;
|
||||
std::wstring name;
|
||||
int type = 0; //enum?
|
||||
std::wstring label;
|
||||
std::wstring uuid;
|
||||
std::wstring value;
|
||||
odf_reader::form_element* element = NULL;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = 0;
|
||||
id.clear();
|
||||
name.clear();
|
||||
label.clear();
|
||||
value.clear();
|
||||
uuid.clear();
|
||||
element = NULL;
|
||||
}
|
||||
};
|
||||
text_forms_context(){}
|
||||
|
||||
void start_element (int type);
|
||||
void set_id (const std::wstring& id);
|
||||
void set_name (const std::wstring& name);
|
||||
void set_label (const std::wstring& label);
|
||||
void set_uuid (const std::wstring& uuid);
|
||||
void set_value (const std::wstring& value);
|
||||
void set_element(odf_reader::form_element *elm);
|
||||
void end_element ();
|
||||
|
||||
_state& get_state_element (std::wstring id);
|
||||
|
||||
private:
|
||||
_state current_state_;
|
||||
std::map<std::wstring, _state> mapElements_;
|
||||
};
|
||||
class table_content_context
|
||||
{
|
||||
public:
|
||||
@ -756,7 +797,9 @@ public:
|
||||
|
||||
void add_element_to_run (std::wstring parenStyleId = _T(""));
|
||||
void finish_run ();
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
bool get_run_state () { return in_run_; }
|
||||
void set_run_state (bool Val) { in_run_ = Val; }
|
||||
|
||||
void start_paragraph (bool is_header = false);
|
||||
void finish_paragraph ();
|
||||
@ -764,18 +807,10 @@ public:
|
||||
bool is_alphabetical_index () { return false == mapAlphabeticals.empty();}
|
||||
bool is_table_content () { return in_table_content_; }
|
||||
bool is_paragraph_header () { return in_header_; }
|
||||
|
||||
void reset_context_state();
|
||||
void back_context_state();
|
||||
|
||||
bool get_run_state () { return state_.in_run_; }
|
||||
void set_run_state (bool Val) { state_.in_run_ = Val; }
|
||||
|
||||
bool get_paragraph_state () { return state_.in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { state_.in_paragraph_ = val; }
|
||||
|
||||
bool get_paragraph_keep () { return state_.is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { state_.is_paragraph_keep_ = val; }
|
||||
bool get_paragraph_state () { return in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { in_paragraph_ = val; }
|
||||
bool get_paragraph_keep () { return is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { is_paragraph_keep_ = val; }
|
||||
|
||||
bool get_delete_text_state () { return is_delete_text_; }
|
||||
void set_delete_text_state (bool Val) { is_delete_text_ = Val; }
|
||||
@ -895,13 +930,11 @@ public:
|
||||
section_context & get_section_context() { return section_context_; }
|
||||
notes_context & get_notes_context() { return notes_context_; }
|
||||
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
text_forms_context & get_forms_context() { return text_forms_context_; }
|
||||
tabs_context & get_tabs_context() { return tabs_context_;}
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
|
||||
void set_drawing_text_props (const std::wstring &props);
|
||||
|
||||
void docx_convert_delayed ();
|
||||
void add_delayed_element (odf_reader::office_element * Elm);
|
||||
|
||||
@ -942,10 +975,10 @@ public:
|
||||
void add_alphabetical_index_text (odf_reader::office_element_ptr & elem);
|
||||
|
||||
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
|
||||
|
||||
headers_footers & get_headers_footers() { return headers_footers_; }
|
||||
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_;
|
||||
@ -957,19 +990,6 @@ public:
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
{
|
||||
bool in_paragraph_ = false;
|
||||
bool in_run_ = false;
|
||||
bool is_paragraph_keep_ = false;
|
||||
|
||||
std::wstring drawing_text_props_;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
}state_;
|
||||
std::vector<_context_state> keep_state_;
|
||||
|
||||
std::wstringstream document_xml_;
|
||||
std::wstringstream styles_xml_;
|
||||
std::wstringstream fontTable_xml_;
|
||||
@ -992,7 +1012,7 @@ private:
|
||||
header_footer_context header_footer_context_;
|
||||
notes_context notes_context_;
|
||||
text_tracked_context text_tracked_context_;
|
||||
forms_context forms_context_;
|
||||
text_forms_context text_forms_context_;
|
||||
tabs_context tabs_context_;
|
||||
table_content_context table_content_context_;
|
||||
|
||||
@ -1025,10 +1045,12 @@ private:
|
||||
bool in_automatic_style_;
|
||||
bool in_drawing_content_;
|
||||
bool in_table_content_;
|
||||
|
||||
bool in_paragraph_;
|
||||
bool in_run_;
|
||||
bool in_header_;
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
bool is_paragraph_keep_;
|
||||
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
@ -1037,6 +1059,7 @@ private:
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ void customXml_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileNameItem = std::wstring(L"item") + std::to_wstring(i+1) + L".xml";
|
||||
const std::wstring fileNameProps = std::wstring(L"itemProps") + std::to_wstring(i+1) + L".xml";
|
||||
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/customXml/") + fileNameProps,
|
||||
L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml");
|
||||
|
||||
@ -280,7 +280,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, charts_[i]->str()).write(path);
|
||||
|
||||
@ -98,7 +98,7 @@ double docx_table_state::get_current_cell_width()
|
||||
{
|
||||
//return columns_width_[current_table_column_];
|
||||
double res = 0;
|
||||
for (unsigned int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
for (int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
{
|
||||
res += columns_width_[current_table_column_ + i];
|
||||
}
|
||||
|
||||
@ -101,10 +101,6 @@ std::wstring static get_default_file_name(RelsType type)
|
||||
return L"video";
|
||||
case typeAudio:
|
||||
return L"audio";
|
||||
case typeControl:
|
||||
return L"control";
|
||||
case typeControlProps:
|
||||
return L"controlProps";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
@ -184,10 +180,6 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
{
|
||||
sub_path = L"embeddings/";
|
||||
}
|
||||
else if ( type == typeControlProps)
|
||||
{
|
||||
sub_path = L"ctrlProps/";
|
||||
}
|
||||
else
|
||||
{
|
||||
isMediaInternal = is_internal(href, odf_packet_);
|
||||
@ -206,7 +198,6 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
else if ( type == typeSlide) number = count_slide + 1;
|
||||
else if ( type == typeMsObject ||
|
||||
type == typeOleObject) number = count_object + 1;
|
||||
else if ( type == typeControl) number = count_control + 1;
|
||||
else
|
||||
number = items_.size() + 1;
|
||||
|
||||
@ -286,19 +277,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
isInternal = isMediaInternal;
|
||||
return id;
|
||||
}
|
||||
std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
|
||||
count_control++;
|
||||
|
||||
std::wstring rId = std::wstring(L"ctrlId") + std::to_wstring(count_control);
|
||||
|
||||
oox_target = std::wstring(L"ctrlProp") + std::to_wstring(count_control) + L".xml";
|
||||
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId) );
|
||||
return rId;
|
||||
}
|
||||
void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
|
||||
@ -52,8 +52,6 @@ public:
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -84,14 +82,10 @@ public:
|
||||
size_t count_shape;
|
||||
size_t count_tables;
|
||||
size_t count_object;
|
||||
size_t count_activeX;
|
||||
size_t count_control;
|
||||
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
|
||||
|
||||
std::wstring add_control_props (std::wstring & oox_target);
|
||||
|
||||
void dump_rels(rels & Rels);
|
||||
items_array & items() { return items_; }
|
||||
|
||||
@ -108,9 +102,6 @@ public:
|
||||
case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
|
||||
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
|
||||
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
||||
case typeExternalLink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath";
|
||||
case typeActiveX: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control";
|
||||
case typeControlProps: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
if (content_.dimension_ == L"y")
|
||||
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
}
|
||||
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
|
||||
//oox_serialize_ln(_Wostream,content_.graphic_properties_);
|
||||
|
||||
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);
|
||||
|
||||
@ -318,7 +318,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (values_[i].strRef_.present && !bLocalTable_)
|
||||
else if (values_[i].strRef_.present > 0 && !bLocalTable_)
|
||||
{
|
||||
CP_XML_NODE(L"c:strRef")
|
||||
{
|
||||
|
||||
@ -42,56 +42,7 @@
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox
|
||||
{
|
||||
void forms_context::start_element (int type)
|
||||
{
|
||||
current_state_.clear();
|
||||
|
||||
current_state_.type = type;
|
||||
}
|
||||
void forms_context::set_id (const std::wstring& id)
|
||||
{
|
||||
current_state_.id = id;
|
||||
}
|
||||
void forms_context::set_name (const std::wstring& name)
|
||||
{
|
||||
current_state_.name = name;
|
||||
}
|
||||
void forms_context::set_label (const std::wstring& label)
|
||||
{
|
||||
current_state_.label = label;
|
||||
}
|
||||
void forms_context::set_uuid (const std::wstring& uuid)
|
||||
{
|
||||
current_state_.uuid = uuid;
|
||||
}
|
||||
void forms_context::set_value (const std::wstring &value)
|
||||
{
|
||||
current_state_.value = value;
|
||||
}
|
||||
void forms_context::set_element(odf_reader::form_element *elm)
|
||||
{
|
||||
current_state_.element = elm;
|
||||
}
|
||||
void forms_context::end_element ()
|
||||
{
|
||||
mapElements_.insert( std::make_pair(current_state_.id, current_state_));
|
||||
|
||||
current_state_.clear();
|
||||
}
|
||||
forms_context::_state& forms_context::get_state_element (std::wstring id)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator it = mapElements_.find(id);
|
||||
|
||||
if (it != mapElements_.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
void tabs_context::reset()
|
||||
{
|
||||
for (size_t i = 0; i < tabs.size(); i++)
|
||||
@ -198,9 +149,7 @@ std::wstringstream & styles_context::list_style()
|
||||
|
||||
void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange)
|
||||
{
|
||||
const std::wstring & text_style_str = text_style_.str();
|
||||
|
||||
if (!text_style_str.empty() || !text_style_ext_.empty())
|
||||
if (!text_style_.str().empty())
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -210,17 +159,14 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin
|
||||
{
|
||||
CP_XML_STREAM() << L"<w:rStyle w:val=\"" << parenStyleId << L"\" />";
|
||||
}
|
||||
CP_XML_STREAM() << text_style_str;
|
||||
const std::wstring & test_str = text_style_.str();
|
||||
CP_XML_STREAM() << test_str;
|
||||
|
||||
if (!strChange.empty())//rPrChange
|
||||
{
|
||||
CP_XML_STREAM() << strChange;
|
||||
strChange.clear();
|
||||
}
|
||||
if (!text_style_ext_.empty())
|
||||
{
|
||||
CP_XML_STREAM() << text_style_ext_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -244,7 +190,8 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace oox
|
||||
{
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
|
||||
{
|
||||
|
||||
@ -56,55 +56,9 @@ namespace odf_reader
|
||||
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
|
||||
|
||||
class office_element;
|
||||
class form_element;
|
||||
typedef boost::shared_ptr<office_element> office_element_ptr;
|
||||
};
|
||||
|
||||
namespace oox {
|
||||
class forms_context
|
||||
{
|
||||
public:
|
||||
struct _state
|
||||
{
|
||||
std::wstring id;
|
||||
std::wstring name;
|
||||
int type = 0; //enum?
|
||||
std::wstring label;
|
||||
std::wstring uuid;
|
||||
std::wstring value;
|
||||
odf_reader::form_element* element = NULL;
|
||||
|
||||
std::wstring ctrlPropId;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = 0;
|
||||
id.clear();
|
||||
name.clear();
|
||||
label.clear();
|
||||
value.clear();
|
||||
uuid.clear();
|
||||
ctrlPropId.clear();
|
||||
element = NULL;
|
||||
}
|
||||
};
|
||||
forms_context(){}
|
||||
|
||||
void start_element (int type);
|
||||
void set_id (const std::wstring& id);
|
||||
void set_name (const std::wstring& name);
|
||||
void set_label (const std::wstring& label);
|
||||
void set_uuid (const std::wstring& uuid);
|
||||
void set_value (const std::wstring& value);
|
||||
void set_element(odf_reader::form_element *elm);
|
||||
void end_element ();
|
||||
|
||||
_state& get_state_element (std::wstring id);
|
||||
|
||||
private:
|
||||
_state current_state_;
|
||||
std::map<std::wstring, _state> mapElements_;
|
||||
};
|
||||
class tabs_context : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -141,7 +95,6 @@ public:
|
||||
|
||||
std::wstring & extern_node(){return extern_node_;}
|
||||
std::wstring & hlinkClick(){return hlinkClick_;}
|
||||
std::wstring & text_style_ext(){return text_style_ext_;}
|
||||
|
||||
const odf_reader::style_instance * get_current_processed_style() const { return current_processed_style_; }
|
||||
|
||||
@ -153,7 +106,6 @@ private:
|
||||
|
||||
std::wstring extern_node_;
|
||||
std::wstring hlinkClick_;
|
||||
std::wstring text_style_ext_;
|
||||
|
||||
std::wstringstream list_style_;
|
||||
std::wstringstream text_style_;
|
||||
@ -163,6 +115,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace oox {
|
||||
|
||||
class math_context : boost::noncopyable
|
||||
{
|
||||
|
||||
@ -124,14 +124,8 @@ static const std::wstring _ooxDashStyle[]=
|
||||
L"sysDashDotDot"
|
||||
};
|
||||
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
std::wstring ns_node = L"a:ln";
|
||||
|
||||
if (ns == L"w14")
|
||||
ns_node = L"w14:textOutline";
|
||||
|
||||
_CP_OPT(std::wstring) strStrokeColor;
|
||||
_CP_OPT(int) iStroke;
|
||||
_CP_OPT(double) dStrokeWidth;
|
||||
@ -149,30 +143,30 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns_node)
|
||||
CP_XML_NODE(L"a:ln")
|
||||
{
|
||||
std::wstring color, dash_style, fill = ns + L":solidFill" ;
|
||||
std::wstring color, dash_style, fill = L"a:solidFill" ;
|
||||
|
||||
if (strStrokeColor) color = *strStrokeColor;
|
||||
|
||||
if (iStroke)
|
||||
{
|
||||
if (iStroke.get() == 0 || bWordArt) fill = ns + L":noFill";
|
||||
if (iStroke.get() == 0 || bWordArt) fill = L"a:noFill";
|
||||
else dash_style = _ooxDashStyle[iStroke.get()];
|
||||
}
|
||||
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != ns + L":noFill")
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != L"a:noFill")
|
||||
{
|
||||
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
|
||||
if (val < 10) val = 12700;
|
||||
|
||||
CP_XML_ATTR2(ns_att + L"w", val);
|
||||
CP_XML_ATTR(L"w", val);
|
||||
if (color.length()<1)color = L"729FCF";
|
||||
}
|
||||
|
||||
CP_XML_NODE(fill)
|
||||
{
|
||||
if (fill != ns + L":noFill")
|
||||
if (fill != L"a:noFill")
|
||||
{
|
||||
if ( color.empty() )
|
||||
{
|
||||
@ -180,49 +174,47 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
else color = L"FFFFFF";
|
||||
}
|
||||
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val",color);
|
||||
CP_XML_ATTR(L"val",color);
|
||||
|
||||
if (dStrokeOpacity)
|
||||
{
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val", (int)(*dStrokeOpacity * 1000));
|
||||
CP_XML_ATTR(L"val", (int)(*dStrokeOpacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fill != ns + L":noFill")
|
||||
if (fill != L"a:noFill")
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
|
||||
if (dash_style.length() > 0 && dash_style != L"solid")
|
||||
{
|
||||
CP_XML_NODE(ns + L":prstDash"){CP_XML_ATTR2(ns_att + L"val", dash_style);}
|
||||
CP_XML_NODE(L"a:prstDash"){CP_XML_ATTR(L"val", dash_style);}
|
||||
}
|
||||
odf_reader::GetProperty(prop,L"marker-start", strVal);
|
||||
if (strVal)
|
||||
{
|
||||
CP_XML_NODE(ns + L":headEnd"){CP_XML_ATTR2(ns_att + L"type", strVal.get());}
|
||||
CP_XML_NODE(L"a:headEnd"){CP_XML_ATTR(L"type", strVal.get());}
|
||||
}
|
||||
odf_reader::GetProperty(prop,L"marker-end",strVal);
|
||||
if (strVal)
|
||||
{
|
||||
CP_XML_NODE(ns + L":tailEnd"){CP_XML_ATTR2(ns_att + L"type",strVal.get());}
|
||||
CP_XML_NODE(L"a:tailEnd"){CP_XML_ATTR(L"type",strVal.get());}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":avLst")
|
||||
CP_XML_NODE(L"a:avLst")
|
||||
{
|
||||
_CP_OPT(std::wstring) strModifiers;
|
||||
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
|
||||
@ -276,20 +268,20 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
{
|
||||
if (values[i].empty()) continue;
|
||||
|
||||
CP_XML_NODE(ns + L":gd")
|
||||
CP_XML_NODE(L"a:gd")
|
||||
{
|
||||
if (names.size() > i)
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"name", names[i]);
|
||||
CP_XML_ATTR(L"name", names[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (values.size() > 1)
|
||||
CP_XML_ATTR2(ns_att + L"name", L"adj" + std::to_wstring(i + 1));
|
||||
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
|
||||
else
|
||||
CP_XML_ATTR2(ns_att + L"name", L"adj");
|
||||
CP_XML_ATTR(L"name", L"adj");
|
||||
}
|
||||
CP_XML_ATTR2(ns_att + L"fmla", L"val " + values[i]);
|
||||
CP_XML_ATTR(L"fmla", L"val " + values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,8 +118,8 @@ namespace oox {
|
||||
};
|
||||
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
|
||||
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false, const std::wstring &ns = L"a");
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
}
|
||||
|
||||
@ -53,59 +53,55 @@ namespace oox {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void oox_serialize_none_fill(std::wostream & strm, const std::wstring &ns)
|
||||
void oox_serialize_none_fill(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":noFill");
|
||||
CP_XML_NODE(L"a:noFill");
|
||||
}
|
||||
}
|
||||
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color,_CP_OPT(double) opacity, const std::wstring &ns)
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val", color);
|
||||
CP_XML_ATTR(L"val", color);
|
||||
if (opacity)
|
||||
{
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns)
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val",color);
|
||||
CP_XML_ATTR(L"val",color);
|
||||
if (opacity)
|
||||
{
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)opacity->get_value() * 1000));// + L"%");
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.solid)return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":solidFill")
|
||||
CP_XML_NODE(L"a:solidFill")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity, ns);
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -155,25 +151,20 @@ void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.bitmap) return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(std::wstring(val.bitmap->name_space + L":blipFill"))
|
||||
{
|
||||
//if (val.bitmap->rotate) CP_XML_ATTR(ns + L":rotWithShape",*(val.bitmap->rotate));
|
||||
//else CP_XML_ATTR(ns + L":rotWithShape",1);
|
||||
//if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
|
||||
//else CP_XML_ATTR(L"a:rotWithShape",1);
|
||||
|
||||
if (val.bitmap->dpi)
|
||||
{
|
||||
CP_XML_ATTR2(ns + L":dpi", *val.bitmap->dpi);
|
||||
}
|
||||
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi", *val.bitmap->dpi);
|
||||
|
||||
CP_XML_NODE(ns + L":blip")
|
||||
CP_XML_NODE(L"a:blip")
|
||||
{
|
||||
if (val.bitmap->isInternal)
|
||||
{
|
||||
@ -185,38 +176,38 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, cons
|
||||
|
||||
if (val.opacity)
|
||||
{
|
||||
CP_XML_NODE(ns + L":alphaModFix")
|
||||
CP_XML_NODE(L"a:alphaModFix")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"amt", (int)(*val.opacity * 1000));
|
||||
CP_XML_ATTR(L"amt",(int)(*val.opacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bCrop)
|
||||
{
|
||||
CP_XML_NODE(ns + L":srcRect")
|
||||
CP_XML_NODE(L"a:srcRect")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
|
||||
CP_XML_ATTR(L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR(L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR(L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR(L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bTile)
|
||||
{
|
||||
CP_XML_NODE(ns + L":tile")
|
||||
CP_XML_NODE(L"a:tile")
|
||||
{
|
||||
//tx="0" ty="0" sx="100000" sy="100000"
|
||||
CP_XML_ATTR2(ns_att + L"flip", "none");
|
||||
CP_XML_ATTR2(ns_att + L"algn", L"ctr");
|
||||
CP_XML_ATTR(L"flip", "none");
|
||||
CP_XML_ATTR(L"algn", L"ctr");
|
||||
}
|
||||
}
|
||||
else if (val.bitmap->bStretch)
|
||||
{
|
||||
CP_XML_NODE(ns + L":stretch")
|
||||
CP_XML_NODE(L"a:stretch")
|
||||
{
|
||||
if (!val.bitmap->bCrop)
|
||||
{
|
||||
CP_XML_NODE(ns + L":fillRect");
|
||||
CP_XML_NODE(L"a:fillRect");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,27 +269,25 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.gradient) return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":gradFill")
|
||||
CP_XML_NODE(L"a:gradFill")
|
||||
{
|
||||
if (val.gradient->colors.size()>0)
|
||||
{
|
||||
CP_XML_NODE(ns + L":gsLst")
|
||||
CP_XML_NODE(L"a:gsLst")
|
||||
{
|
||||
for (size_t i = 0; i < val.gradient->colors.size(); i++)
|
||||
for (int i = 0; i < val.gradient->colors.size(); i++)
|
||||
{
|
||||
oox_gradient_fill::_color_position & col = val.gradient->colors[i];
|
||||
CP_XML_NODE(ns + L":gs")
|
||||
CP_XML_NODE(L"a:gs")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"pos", (int)(col.pos * 1000));//%
|
||||
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity, ns);
|
||||
CP_XML_ATTR(L"pos", (int)(col.pos * 1000));//%
|
||||
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,25 +298,25 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, co
|
||||
switch(val.gradient->style)
|
||||
{
|
||||
case 0:
|
||||
CP_XML_NODE(ns + L":lin")
|
||||
CP_XML_NODE(L"a:lin")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"ang",(int)angle);//gr in rad
|
||||
CP_XML_ATTR(L"ang",(int)angle);//gr in rad
|
||||
}break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
CP_XML_NODE(ns + L":path")
|
||||
CP_XML_NODE(L"a:path")
|
||||
{
|
||||
if (val.gradient->style == 1) CP_XML_ATTR2(ns_att + L"path", L"rect");
|
||||
if (val.gradient->style == 2) CP_XML_ATTR2(ns_att + L"path", L"circle");
|
||||
if (val.gradient->style == 3) CP_XML_ATTR2(ns_att + L"path", L"shape");
|
||||
if (val.gradient->style == 1) CP_XML_ATTR(L"path", L"rect");
|
||||
if (val.gradient->style == 2) CP_XML_ATTR(L"path", L"circle");
|
||||
if (val.gradient->style == 3) CP_XML_ATTR(L"path", L"shape");
|
||||
|
||||
CP_XML_NODE(ns + L":fillToRect")
|
||||
CP_XML_NODE(L"a:fillToRect")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"l", (int)(val.gradient->rect[0] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"t", (int)(val.gradient->rect[1] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"r", (int)(val.gradient->rect[2] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"b", (int)(val.gradient->rect[3] * 1000));
|
||||
CP_XML_ATTR(L"l", (int)(val.gradient->rect[0] * 1000));
|
||||
CP_XML_ATTR(L"t", (int)(val.gradient->rect[1] * 1000));
|
||||
CP_XML_ATTR(L"r", (int)(val.gradient->rect[2] * 1000));
|
||||
CP_XML_ATTR(L"b", (int)(val.gradient->rect[3] * 1000));
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@ -335,24 +324,22 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, co
|
||||
//tileRect (Tile Rectangle) §20.1.8.59
|
||||
}
|
||||
}
|
||||
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.hatch)return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":pattFill")
|
||||
CP_XML_NODE(L"a:pattFill")
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"prst", val.hatch->preset);
|
||||
CP_XML_NODE(ns + L":fgClr")//опять для ms важно что этот цвет перед back
|
||||
CP_XML_ATTR(L"prst",val.hatch->preset);
|
||||
CP_XML_NODE(L"a:fgClr")//опять для ms важно что этот цвет перед back
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.hatch->color_ref, val.opacity);
|
||||
}
|
||||
if (val.hatch->color_back_ref)
|
||||
{
|
||||
CP_XML_NODE(ns + L":bgClr")
|
||||
CP_XML_NODE(L"a:bgClr")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), *val.hatch->color_back_ref ,val.opacity);
|
||||
}
|
||||
@ -392,23 +379,23 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
|
||||
}
|
||||
}
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
switch (val.type)
|
||||
{
|
||||
case 0:
|
||||
oox_serialize_none_fill(strm, ns);
|
||||
oox_serialize_none_fill(strm);
|
||||
break;
|
||||
case 1:
|
||||
oox_serialize_solid_fill(strm, val, ns);
|
||||
oox_serialize_solid_fill(strm, val);
|
||||
break;
|
||||
case 2:
|
||||
oox_serialize_bitmap_fill(strm, val, ns);
|
||||
oox_serialize_bitmap_fill(strm, val);
|
||||
break;
|
||||
case 3:
|
||||
oox_serialize_gradient_fill(strm, val, ns);
|
||||
oox_serialize_gradient_fill(strm, val);
|
||||
break;
|
||||
case 4: oox_serialize_hatch_fill(strm, val, ns);
|
||||
case 4: oox_serialize_hatch_fill(strm, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,12 +143,10 @@ namespace oox {
|
||||
}
|
||||
};
|
||||
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring &color, int id);
|
||||
|
||||
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(double) opacity, const std::wstring &ns = L"a");
|
||||
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns = L"a");
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ void content_types_file::write(const std::wstring & RootPath)
|
||||
elm.write(RootPath);
|
||||
}
|
||||
|
||||
content_type * content_types_file::content()
|
||||
content_type_content * content_types_file::content()
|
||||
{
|
||||
return &content_type_content_;
|
||||
}
|
||||
@ -132,7 +132,7 @@ bool content_types_file::add_or_find_default(const std::wstring & extension)
|
||||
{
|
||||
std::vector<default_content_type> & defaults = content_type_content_.get_default();
|
||||
|
||||
for (size_t i = 0 ; i < defaults.size(); i++)
|
||||
for (int i = 0 ; i < defaults.size(); i++)
|
||||
{
|
||||
if (defaults[i].extension() == extension)
|
||||
return true;
|
||||
@ -279,11 +279,11 @@ _CP_PTR(customXml_content) customXml_content::create(const std::wstring &item, c
|
||||
return boost::make_shared<customXml_content>(item, props);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
simple_element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
simple_element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
|
||||
@ -86,27 +86,23 @@ public:
|
||||
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_type_content * content ();
|
||||
|
||||
private:
|
||||
content_type content_type_content_;
|
||||
content_type_content content_type_content_;
|
||||
std::wstring filename_;
|
||||
};
|
||||
|
||||
class simple_element;
|
||||
typedef boost::shared_ptr<simple_element> simple_element_ptr;
|
||||
|
||||
class simple_element : public element
|
||||
{
|
||||
public:
|
||||
simple_element(const std::wstring & FileName, const std::wstring & Content);
|
||||
static simple_element_ptr create(const std::wstring & FileName, const std::wstring & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::wstring & Content);
|
||||
|
||||
simple_element(const std::wstring & FileName, const std::string & Content);
|
||||
static simple_element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
std::wstring get_filename() {return file_name_;}
|
||||
|
||||
private:
|
||||
std::wstring file_name_;
|
||||
@ -115,6 +111,7 @@ private:
|
||||
bool bXml;
|
||||
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
class rels_file;
|
||||
typedef boost::shared_ptr<rels_file> rels_file_ptr;
|
||||
|
||||
@ -56,10 +56,7 @@ enum RelsType
|
||||
typeSlide,
|
||||
typeVideo,
|
||||
typeAudio,
|
||||
typeExternalLink,
|
||||
typeActiveX,
|
||||
typeControl,
|
||||
typeControlProps
|
||||
typeControl
|
||||
};
|
||||
|
||||
struct _rel
|
||||
|
||||
@ -39,7 +39,7 @@ namespace oox {
|
||||
|
||||
void oox_chart::set_cache_only (bool val)
|
||||
{
|
||||
for (size_t i = 0 ; i < series_.size(); i++)
|
||||
for (int i = 0 ; i < series_.size(); i++)
|
||||
{
|
||||
series_[i]->set_cache_only(val);
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
@ -311,7 +311,7 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
@ -352,7 +352,7 @@ void pptx_serialize_object(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
pptx_drawings_.push_back(d);
|
||||
|
||||
bool present = false;
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].rid == rid && pptx_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -83,7 +83,7 @@ public:
|
||||
{
|
||||
|
||||
bool present = false;
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].rid == rid && pptx_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -96,7 +96,7 @@ public:
|
||||
}
|
||||
void serialize(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0; i < pptx_drawings_.size(); i++)
|
||||
for (int i = 0; i < pptx_drawings_.size(); i++)
|
||||
{
|
||||
pptx_drawings_[i].serialize(strm);
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
|
||||
void dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].type == typeUnknown ||
|
||||
pptx_drawing_rels_[i].type == typeTable ||
|
||||
|
||||
@ -352,7 +352,7 @@ std::pair<int,int> pptx_xml_authors_comments::add_or_find(std::wstring author)
|
||||
int last_id=0;
|
||||
|
||||
bool find = false;
|
||||
for (size_t i=0;i<list_.size();i++)
|
||||
for (long i=0;i<list_.size();i++)
|
||||
{
|
||||
if (author == list_[i].name)
|
||||
{
|
||||
|
||||
@ -121,10 +121,10 @@ void slides_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slides" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
||||
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -156,10 +156,10 @@ void notes_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesSlides" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
||||
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -199,10 +199,10 @@ void slideMasters_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slideMasters" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
||||
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -233,10 +233,10 @@ void notesMaster_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesMasters" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
||||
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -275,14 +275,14 @@ void slideLayouts_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slideLayouts" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"slideLayout") + std::to_wstring( i + 1 ) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
||||
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/ppt/slideLayouts/") + fileName, kWSConType);
|
||||
|
||||
slides_[i]->get_rel_file()->set_file_name(fileName + L".rels");//внитренние релсы
|
||||
@ -327,12 +327,12 @@ void ppt_charts_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
for (int i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
if (!charts_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring( i + 1 ) + L".xml";
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/charts/") + fileName, kWSConType);
|
||||
@ -357,14 +357,14 @@ void ppt_themes_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"theme" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < themes_.size(); i++)
|
||||
for (int i = 0; i < themes_.size(); i++)
|
||||
{
|
||||
if (!themes_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"theme") + std::to_wstring( i + 1) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.theme+xml";
|
||||
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/ppt/theme/") + fileName, kWSConType);
|
||||
|
||||
std::wstringstream content;
|
||||
@ -383,9 +383,9 @@ void ppt_comments_files::write(const std::wstring & RootPath)
|
||||
std::wstring comm_path = RootPath + FILE_SEPARATOR_STR + L"comments";
|
||||
NSDirectory::CreateDirectory(comm_path.c_str());
|
||||
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
for (int i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.comments+xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/comments/") + comments_[i].filename, kWSConType);
|
||||
|
||||
@ -282,7 +282,7 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
|
||||
odf_reader::text_list_style * text_list_style = odf_context_.listStyleContainer().list_style_by_name(list_style_stack_.back());
|
||||
|
||||
if ((text_list_style) && (Level < (int)text_list_style->get_content().size()))
|
||||
if ((text_list_style) && (Level < text_list_style->get_content().size()))
|
||||
{
|
||||
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
|
||||
odf_reader::office_element_ptr elm_list;
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
|
||||
CP_XML_NODE(L"authors")
|
||||
{
|
||||
for (size_t i = 0 ; i < author_list_.size(); i++)
|
||||
for (int i = 0 ; i < author_list_.size(); i++)
|
||||
{
|
||||
const std::wstring & a = author_list_[i];
|
||||
CP_XML_NODE(L"author")
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
CP_XML_NODE(L"commentList")
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_comment_.size(); i++)
|
||||
for (int i = 0 ; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
for (size_t i = 0; i < xlsx_comment_.size(); i++)
|
||||
for (int i = 0; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
@ -222,7 +222,7 @@ public:
|
||||
void add(_xlsx_comment & c)
|
||||
{
|
||||
bool find = false;
|
||||
for (size_t i = 0; i < author_list_.size(); i++)
|
||||
for (long i = 0; i < author_list_.size(); i++)
|
||||
{
|
||||
if (c.author_ == author_list_[i])
|
||||
{
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
{
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
for (int i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"definedName")
|
||||
{
|
||||
|
||||
@ -252,7 +252,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"xdr");
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
@ -289,8 +289,7 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
xlsx_serialize_group(strm, val);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject ||
|
||||
val.type == typeControl)
|
||||
val.type == typeMsObject )
|
||||
{
|
||||
xlsx_serialize_object(strm, val);
|
||||
}
|
||||
@ -372,37 +371,5 @@ void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
|
||||
}
|
||||
|
||||
void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
{
|
||||
if (type != typeControl) return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"control")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", objectId);
|
||||
CP_XML_ATTR(L"shapeId", id);
|
||||
//CP_XML_ATTR(L"name", objectProgId);
|
||||
|
||||
CP_XML_NODE(L"controlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"defaultSize", 0);
|
||||
if (fill.bitmap)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", fill.bitmap->rId);
|
||||
}
|
||||
CP_XML_NODE(L"anchor")
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,8 +66,7 @@ public:
|
||||
std::wstring content_group_;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,11 +297,6 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
impl_->object_description_.descriptor_ = progId;
|
||||
}
|
||||
void xlsx_drawing_context::set_control(const std::wstring & ctrlPropId)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
@ -580,14 +575,15 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
}
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
if (drawing.type_anchor == 2) // absolute
|
||||
{
|
||||
//пересчет нужен
|
||||
//пересчет нужен для оле
|
||||
xlsx_table_position from, to;
|
||||
|
||||
process_position_properties (obj, table_metrics, from, to);
|
||||
@ -604,19 +600,11 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
drawing.to_.position.row = to.row;
|
||||
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
}
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (obj.type_ == typeControl)
|
||||
{
|
||||
drawing.objectId = obj.xlink_href_;
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
@ -692,8 +680,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
case typeShape: process_shape ( obj, drawing, xlsx_drawings_); break;
|
||||
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject:
|
||||
case typeControl:
|
||||
case typeOleObject:
|
||||
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,6 @@ public:
|
||||
void set_chart (const std::wstring & path);
|
||||
void set_ole_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_ms_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_control (const std::wstring & ctrlPropId);
|
||||
void set_text_box ();
|
||||
void end_frame();
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -121,15 +121,7 @@ public:
|
||||
xlsx_drawings_[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
void serialize_controls(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeControl) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_control(strm);
|
||||
}
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return (xlsx_drawings_.empty());
|
||||
@ -201,10 +193,6 @@ void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_objects(strm);
|
||||
}
|
||||
void xlsx_drawings::serialize_controls(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_controls(strm);
|
||||
}
|
||||
|
||||
bool xlsx_drawings::empty() const
|
||||
{
|
||||
|
||||
@ -73,7 +73,6 @@ public:
|
||||
|
||||
void serialize (std::wostream & _Wostream);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
@ -90,7 +90,7 @@ void xlsx_dxfs::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_ATTR(L"count", impl_->dxf_array.size());
|
||||
|
||||
for (size_t i = 0; i < impl_->dxf_array.size(); i++)
|
||||
for (int i = 0; i < impl_->dxf_array.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"dxf")
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"count", merges_.size());
|
||||
|
||||
for (size_t i = 0 ; i < merges_.size(); i++)
|
||||
for (int i = 0 ; i < merges_.size(); i++)
|
||||
{
|
||||
merge & m = merges_[i];
|
||||
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream controls_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -137,10 +136,6 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
|
||||
{
|
||||
return impl_->ole_objects_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::controls()
|
||||
{
|
||||
return impl_->controls_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
@ -208,7 +203,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (!impl_->commentsId_.empty())
|
||||
if (impl_->commentsId_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
{
|
||||
@ -221,13 +216,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->controls_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"controls")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
|
||||
@ -66,7 +66,6 @@ public:
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & controls();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ void sheets_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
@ -194,10 +194,6 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
sheets_files_.set_main_document( this->get_main_document() );
|
||||
sheets_files_.write(path);
|
||||
}
|
||||
{
|
||||
control_props_files_.set_main_document( this->get_main_document() );
|
||||
control_props_files_.write(path);
|
||||
}
|
||||
int index = 1;
|
||||
if (true)
|
||||
{
|
||||
@ -214,7 +210,7 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
connections_->write(path);
|
||||
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
|
||||
}
|
||||
|
||||
@ -326,10 +322,6 @@ void xl_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void xl_files::add_control_props (simple_element_ptr element)
|
||||
{
|
||||
control_props_files_.add_control_props(element);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
@ -340,7 +332,7 @@ void xl_pivot_cache_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotCache";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConTypeD = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
|
||||
static const std::wstring kWSConTypeR = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
|
||||
@ -392,7 +384,7 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotTables";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
|
||||
|
||||
@ -433,7 +425,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
|
||||
@ -448,33 +440,6 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
relFiles.write(path);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_control_props_files::add_control_props(simple_element_ptr query_table)
|
||||
{
|
||||
control_props_.push_back(query_table);
|
||||
}
|
||||
void xl_control_props_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (control_props_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"ctrlProps";
|
||||
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
content_type *contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.ms-excel.controlproperties+xml";
|
||||
|
||||
for (size_t i = 0; i < control_props_.size(); i++)
|
||||
{
|
||||
if (!control_props_[i])continue;
|
||||
|
||||
const std::wstring fileName = control_props_[i]->get_filename();
|
||||
|
||||
contentTypes->add_override(std::wstring(L"/xl/ctrlProps/") + fileName, kWSConType);
|
||||
|
||||
control_props_[i]->write(path);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
{
|
||||
@ -498,7 +463,7 @@ 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();
|
||||
content_type_content * 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);
|
||||
@ -518,7 +483,7 @@ void xl_comments::write(const std::wstring & RootPath)
|
||||
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/") + comments_[i].filename, kWSConType);
|
||||
|
||||
@ -211,23 +211,13 @@ private:
|
||||
rels_files * rels_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
class xl_control_props_files : public element
|
||||
{
|
||||
public:
|
||||
xl_control_props_files(){}
|
||||
|
||||
void add_control_props(simple_element_ptr props);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<simple_element_ptr> control_props_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
class xl_files : public element
|
||||
{
|
||||
public:
|
||||
xl_files();
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
void set_workbook (element_ptr Element);
|
||||
@ -243,7 +233,6 @@ public:
|
||||
void add_pivot_cache (pivot_cache_content_ptr cache);
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
void add_jsaProject (const std::string &content);
|
||||
void add_control_props (simple_element_ptr Element);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
@ -251,8 +240,7 @@ private:
|
||||
xl_charts_files charts_files_;
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
xl_pivot_table_files pivot_table_files_;
|
||||
xl_control_props_files control_props_files_;
|
||||
|
||||
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
|
||||
@ -540,7 +540,7 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count_items_row < (int)current_.fields[i].caches.size())
|
||||
if (count_items_row < current_.fields[i].caches.size())
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
}
|
||||
@ -772,7 +772,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
int fld = 0, ind_fld = current_.fields[ind_field_dirty].references_field < 0 ? ind_field_dirty :
|
||||
current_.fields[ind_field_dirty].references_field;
|
||||
for (int k = 0; k < ind_fld; k++)
|
||||
for (size_t k = 0; k < ind_fld; k++)
|
||||
{
|
||||
if (current_.fields[k].type != 7 ) fld++;
|
||||
}
|
||||
@ -815,7 +815,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
std::wstring name;
|
||||
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < (int)current_.fields.size())
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < current_.fields.size())
|
||||
{
|
||||
switch(current_.fields[ind_field_dirty].function)
|
||||
{
|
||||
@ -1470,7 +1470,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool sh
|
||||
if (index < 0)
|
||||
index = impl_->current_.fields.back().caches.size();
|
||||
|
||||
while (index > (int)impl_->current_.fields.back().caches.size())
|
||||
while (index > impl_->current_.fields.back().caches.size())
|
||||
{
|
||||
Impl::_field_value f(L"", L"m", true);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
{
|
||||
double length_pt =0;
|
||||
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
if (cell <= r.start_cell + r.count)
|
||||
@ -102,7 +102,7 @@ public:
|
||||
if (pos < 0)//cs102.ods
|
||||
{
|
||||
int c_skip = 0, i = 0;
|
||||
for (i = 0; i < (int)region_.size(); i++)
|
||||
for (i = 0; i < region_.size(); i++)
|
||||
{
|
||||
if (region_[i].count + c_skip > offset)
|
||||
break;
|
||||
@ -119,7 +119,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
if (r.start_cell + r.count <= offset)
|
||||
@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
std::pair<int, double> search(double pos)
|
||||
{
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ std::wstring xlsx_table_state::default_row_cell_style() const
|
||||
|
||||
std::wstring xlsx_table_state::default_column_cell_style() const
|
||||
{
|
||||
if (current_table_column_ + 1 < (int)column_default_cell_style_name_.size())
|
||||
if (current_table_column_ + 1 < column_default_cell_style_name_.size())
|
||||
return column_default_cell_style_name_.at(current_table_column_ + 1);
|
||||
else
|
||||
{
|
||||
@ -241,7 +241,7 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
rows_spanned_.push_back(xlsx_row_spanned());
|
||||
}
|
||||
|
||||
if ((int)rows_spanned_.size() <= current_table_column_)
|
||||
if (rows_spanned_.size() <= current_table_column_)
|
||||
{
|
||||
_CP_LOG << L"[warning] set_rows_spanned error\n";
|
||||
}
|
||||
@ -492,10 +492,6 @@ void xlsx_table_state::serialize_ole_objects(std::wostream & strm)
|
||||
{
|
||||
return xlsx_drawing_context_.get_drawings()->serialize_objects(strm);
|
||||
}
|
||||
void xlsx_table_state::serialize_controls(std::wostream & strm)
|
||||
{
|
||||
return xlsx_drawing_context_.get_drawings()->serialize_controls(strm);
|
||||
}
|
||||
void xlsx_table_state::serialize_hyperlinks(std::wostream & strm)
|
||||
{
|
||||
return xlsx_hyperlinks_.xlsx_serialize(strm);
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
bool filter;
|
||||
bool withHeader;
|
||||
|
||||
std::vector<std::pair<size_t, bool>> bySort; //field + order
|
||||
std::vector<std::pair<int, bool>> bySort; //field + order
|
||||
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
@ -134,7 +134,6 @@ public:
|
||||
void serialize_table_format (std::wostream & _Wostream);
|
||||
void serialize_merge_cells (std::wostream & _Wostream);
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
@ -336,10 +336,6 @@ void xlsx_table_context::serialize_ole_objects(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_ole_objects(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_controls(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_controls(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels)
|
||||
{
|
||||
return state()->dump_rels_hyperlinks(Rels);
|
||||
|
||||
@ -89,7 +89,6 @@ public:
|
||||
void serialize_conditionalFormatting(std::wostream & _Wostream);
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
|
||||
@ -188,10 +188,8 @@ void xlsx_conversion_context::end_document()
|
||||
}
|
||||
|
||||
}
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = control_props_.begin(); it != control_props_.end(); ++it)
|
||||
{
|
||||
output_document_->get_xl_files().add_control_props( package::simple_element::create(it->first, it->second) );
|
||||
}
|
||||
//добавляем диаграммы
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
@ -446,8 +444,7 @@ void xlsx_conversion_context::end_table()
|
||||
|
||||
get_table_context().serialize_hyperlinks (current_sheet().hyperlinks());
|
||||
get_table_context().serialize_ole_objects (current_sheet().ole_objects());
|
||||
get_table_context().serialize_controls (current_sheet().controls());
|
||||
|
||||
|
||||
get_table_context().dump_rels_hyperlinks (current_sheet().sheet_rels());
|
||||
get_table_context().dump_rels_ole_objects (current_sheet().sheet_rels());
|
||||
|
||||
@ -502,17 +499,6 @@ void xlsx_conversion_context::end_table()
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
void xlsx_conversion_context::add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props)
|
||||
{
|
||||
if (rid.empty()) return;
|
||||
if (props.empty()) return;
|
||||
|
||||
control_props_.insert(std::make_pair(target, props));
|
||||
|
||||
current_sheet().sheet_rels().add(oox::relationship(rid,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp",
|
||||
L"../ctrlProps/" + target));
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_table_column(unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax)
|
||||
{
|
||||
|
||||
@ -158,8 +158,6 @@ public:
|
||||
void set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max);
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
@ -174,9 +172,8 @@ public:
|
||||
xlsx_text_context & get_text_context() { return xlsx_text_context_; }
|
||||
xlsx_table_context & get_table_context() { return xlsx_table_context_; }
|
||||
const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
math_context & get_math_context() { return math_context_; }
|
||||
num_format_context & get_num_format_context() { return num_format_context_; }
|
||||
@ -213,20 +210,16 @@ private:
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring>control_props_;
|
||||
|
||||
|
||||
xlsx_style_manager xlsx_style_;
|
||||
xlsx_defined_names xlsx_defined_names_;
|
||||
xlsx_table_context xlsx_table_context_;
|
||||
xlsx_text_context xlsx_text_context_;
|
||||
math_context math_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_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ paragraph_format_properties calc_paragraph_properties_content(const std::vector<
|
||||
return result;
|
||||
}
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context)
|
||||
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context)
|
||||
{
|
||||
std::vector<const style_paragraph_properties*> parProps;
|
||||
while (styleInstance)
|
||||
|
||||
@ -40,26 +40,22 @@
|
||||
#include "odfcontext.h"
|
||||
#include <vector>
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
namespace oox
|
||||
{
|
||||
class tabs_context;
|
||||
}
|
||||
namespace odf_reader
|
||||
{
|
||||
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
|
||||
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
namespace cpdoccore {
|
||||
class tabs_context;
|
||||
namespace odf_reader {
|
||||
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
|
||||
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const style_instance * styleInstance);
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context);
|
||||
}
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const style_instance * styleInstance);
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +232,11 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
Context.get_math_context().base_font_size_ = baseFontHeight_;
|
||||
|
||||
@ -242,9 +246,9 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.back_context_state();
|
||||
Context.set_stream_man (prev);
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
}
|
||||
else if(object_type_ == 4 && office_spreadsheet_)
|
||||
{
|
||||
|
||||
@ -101,8 +101,8 @@ class object_odf_context
|
||||
public:
|
||||
struct _cell
|
||||
{
|
||||
size_t col;
|
||||
size_t row;
|
||||
int col;
|
||||
int row;
|
||||
std::wstring val;
|
||||
};
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ math_variant::math_variant(const std::wstring & Value) : none_(true)
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, Value, boost::algorithm::is_any_of(L" \t"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0 ; i < splitted.size(); i++)
|
||||
for (int i = 0 ; i < splitted.size(); i++)
|
||||
{
|
||||
if (splitted[i] == L"bold")
|
||||
{
|
||||
|
||||
@ -284,7 +284,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
@ -300,7 +300,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
@ -312,7 +312,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
}break;
|
||||
@ -328,13 +328,13 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
|
||||
@ -312,7 +312,7 @@ std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
int sz_obj = pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
@ -430,6 +430,29 @@ void draw_plugin::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
// draw:control
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
const wchar_t * draw_control::name = L"control";
|
||||
|
||||
void draw_control::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"xml:id", xml_id_);
|
||||
CP_APPLY_ATTR(L"draw:caption-id", caption_id_);
|
||||
CP_APPLY_ATTR(L"draw:control", control_id_);
|
||||
|
||||
draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
|
||||
draw_attlists_.position_.add_attributes(Attributes);
|
||||
draw_attlists_.rel_size_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void draw_control::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"glue-point")
|
||||
{
|
||||
CP_CREATE_ELEMENT(draw_glue_point_);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_(NULL), idx_in_owner(-1) {}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
@ -378,7 +378,33 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public office_element_impl<draw_control>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDrawControl;
|
||||
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){}
|
||||
|
||||
odf_types::union_common_draw_attlists draw_attlists_;
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
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_control);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
|
||||
#include "../docx/docx_drawing.h"
|
||||
#include "../docx/xlsx_package.h"
|
||||
#include "../docx/oox_conversion_context.h"
|
||||
|
||||
#include "chart_build_oox.h"
|
||||
|
||||
@ -855,7 +854,8 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
|
||||
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
|
||||
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background)
|
||||
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background
|
||||
)
|
||||
{
|
||||
drawing-> behindDoc = L"1";
|
||||
}
|
||||
@ -895,7 +895,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
//////////////////////////////////////////
|
||||
bool bTxbx = (drawing->sub_type == 1);
|
||||
|
||||
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles(),drawing->fill, bTxbx);
|
||||
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
|
||||
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
|
||||
{
|
||||
@ -1039,7 +1039,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (drawing.sub_type !=5 )//line
|
||||
{
|
||||
drawing.additional.push_back(_property(L"text-content", Context.get_drawing_context().get_text_stream_shape()));
|
||||
drawing.additional.push_back(_property(L"text-content",Context.get_drawing_context().get_text_stream_shape()));
|
||||
}
|
||||
|
||||
Context.get_drawing_context().clear_stream_shape();
|
||||
@ -1054,7 +1054,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
bad_shape_ = false;
|
||||
}
|
||||
|
||||
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional, L"stroke"))//бывает что и не определено ничего
|
||||
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//бывает что и не определено ничего
|
||||
{
|
||||
drawing.fill.solid = oox::oox_solid_fill::create();
|
||||
drawing.fill.solid->color = L"729FCF";
|
||||
@ -1071,10 +1071,10 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.reset_context_state();
|
||||
Context.set_run_state (runState);
|
||||
//Context.set_paragraph_state (false);
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
bool new_run = false;
|
||||
|
||||
@ -1106,8 +1106,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
//Context.set_paragraph_state(paraState);
|
||||
Context.back_context_state();
|
||||
Context.set_paragraph_state(paraState);
|
||||
|
||||
Context.get_drawing_context().stop_shape();
|
||||
}
|
||||
@ -1143,14 +1142,19 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.back_context_state();
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
@ -1204,8 +1208,13 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
Context.set_drawing_state_content(true);
|
||||
@ -1218,8 +1227,10 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.back_context_state();
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -1344,7 +1355,11 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(drawing.content_group_);
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -1353,9 +1368,9 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
|
||||
Context.set_stream_man(prev);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.set_stream_man (prev);
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
//--------------------------------------------------
|
||||
Context.get_drawing_context().get_size_group (drawing.cx , drawing.cy);
|
||||
Context.get_drawing_context().get_position_group(drawing.x , drawing.y);
|
||||
@ -1388,8 +1403,8 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
runState = Context.get_run_state();
|
||||
pState = Context.get_paragraph_state();
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !pState)
|
||||
{
|
||||
@ -1450,8 +1465,10 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.reset_context_state();
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
{
|
||||
@ -1473,7 +1490,9 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.back_context_state();
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (paraState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
Context.get_drawing_context().stop_frame();
|
||||
}
|
||||
@ -1558,7 +1577,6 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_frame();
|
||||
|
||||
bool in_frame = !drawing->isInline;
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
|
||||
@ -1652,7 +1670,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!control_id_) return;
|
||||
|
||||
oox::forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
oox::text_forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
if ((state.type == 6 || state.type == 4) && state.element)
|
||||
@ -1678,7 +1696,12 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
@ -1686,10 +1709,10 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.start_paragraph(false);
|
||||
|
||||
if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
if (draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
text::paragraph_attrs attrs_;
|
||||
attrs_.text_style_name_ = *common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_;
|
||||
attrs_.text_style_name_ = *draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_;
|
||||
|
||||
int textStyle = Context.process_paragraph_attr(&attrs_);
|
||||
}
|
||||
@ -1716,9 +1739,10 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
|
||||
Context.back_context_state();
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_shape();
|
||||
|
||||
@ -1733,14 +1757,14 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
/////////
|
||||
common_draw_docx_convert(Context, common_draw_attlists_, &drawing);
|
||||
common_draw_docx_convert(Context, draw_attlists_, &drawing);
|
||||
/////////
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool pState = Context.get_paragraph_state();
|
||||
bool runState = Context.get_run_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
pState = Context.get_paragraph_state();
|
||||
runState = Context.get_run_state();
|
||||
keepState = Context.get_paragraph_keep();
|
||||
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
@ -52,10 +52,8 @@
|
||||
#include "odf_document_impl.h"
|
||||
|
||||
#include "calcs_styles.h"
|
||||
#include "chart_build_oox.h"
|
||||
|
||||
#include "../docx/oox_conversion_context.h"
|
||||
#include "../docx/xlsx_drawing.h"
|
||||
#include "chart_build_oox.h"
|
||||
|
||||
#include "datatypes/length.h"
|
||||
#include "datatypes/borderstyle.h"
|
||||
@ -257,7 +255,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (!text_content_.empty())
|
||||
if (text_content_.length()>0)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace odf_reader {
|
||||
|
||||
const wchar_t * draw_shape::ns = L"draw";
|
||||
const wchar_t * draw_shape::name = L"shape";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-shape-attlist
|
||||
void draw_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -69,14 +69,7 @@ void draw_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attribut
|
||||
|
||||
void draw_shape::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"enhanced-geometry")
|
||||
{
|
||||
CP_CREATE_ELEMENT(enhanced_geometry_);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -95,9 +88,7 @@ void draw_rect_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
CP_APPLY_ATTR(L"draw:corner-radius",draw_corner_radius_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw:rect
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
const wchar_t * draw_rect::ns = L"draw";
|
||||
const wchar_t * draw_rect::name = L"rect";
|
||||
|
||||
@ -112,6 +103,9 @@ void draw_rect::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-ellipse-attlist
|
||||
|
||||
void draw_ellipse_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
@ -119,9 +113,7 @@ void draw_ellipse_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw:ellipse
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_ellipse::ns = L"draw";
|
||||
const wchar_t * draw_ellipse::name = L"ellipse";
|
||||
|
||||
@ -141,9 +133,7 @@ void draw_circle_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
{
|
||||
//CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:circle
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_circle::ns = L"draw";
|
||||
const wchar_t * draw_circle::name = L"circle";
|
||||
|
||||
@ -154,6 +144,7 @@ void draw_circle::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 4;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-line-attlist
|
||||
void draw_line_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -162,9 +153,7 @@ void draw_line_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"svg:y1", svg_y1_);
|
||||
CP_APPLY_ATTR(L"svg:y2", svg_y2_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:line
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_line::ns = L"draw";
|
||||
const wchar_t * draw_line::name = L"line";
|
||||
|
||||
@ -210,9 +199,7 @@ void draw_line::reset_svg_attributes()
|
||||
void draw_custom_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:custom_shape
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_custom_shape::ns = L"draw";
|
||||
const wchar_t * draw_custom_shape::name = L"custom-shape";
|
||||
|
||||
@ -231,9 +218,7 @@ void draw_path_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_path::ns = L"draw";
|
||||
const wchar_t * draw_path::name = L"path";
|
||||
|
||||
@ -291,15 +276,11 @@ void draw_polygon_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_polygon::ns = L"draw";
|
||||
const wchar_t * draw_contour_polygon::name = L"contour-polygon";
|
||||
|
||||
@ -357,9 +338,7 @@ void draw_polyline_attlist::add_attributes( const xml::attributes_wc_ptr & Attri
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polyline
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polyline::ns = L"draw";
|
||||
const wchar_t * draw_polyline::name = L"polyline";
|
||||
|
||||
@ -417,7 +396,7 @@ void draw_polyline::reset_polyline_path()
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void draw_equation_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:name", draw_name_);
|
||||
@ -438,9 +417,7 @@ void draw_handle_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
|
||||
CP_APPLY_ATTR(L"draw:handle-polar", draw_handle_polar_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_handle::ns = L"draw";
|
||||
const wchar_t * draw_handle::name = L"handle";
|
||||
|
||||
@ -482,9 +459,7 @@ void draw_enhanced_geometry_attlist::add_attributes( const xml::attributes_wc_pt
|
||||
CP_APPLY_ATTR(L"drawooo:enhanced-path" , drawooo_enhanced_path_);
|
||||
CP_APPLY_ATTR(L"drawooo:sub-view-size" , drawooo_sub_view_size_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:enhanced_geometry
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_enhanced_geometry::ns = L"draw";
|
||||
const wchar_t * draw_enhanced_geometry::name = L"enhanced-geometry";
|
||||
|
||||
@ -609,15 +584,13 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
//draw_handle_geometry_.push_back(elm);
|
||||
// }
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-caption-attlist
|
||||
//-------------------------------------------------------------------------------------------
|
||||
void draw_caption_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:caption
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_caption::ns = L"draw";
|
||||
const wchar_t * draw_caption::name = L"caption";
|
||||
|
||||
@ -628,18 +601,15 @@ void draw_caption::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
sub_type_ = 1;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-connector-attlist
|
||||
//-------------------------------------------------------------------------------------------
|
||||
void draw_connector_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:d", svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
CP_APPLY_ATTR(L"draw:type", draw_type_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:connector
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_connector::ns = L"draw";
|
||||
const wchar_t * draw_connector::name = L"connector";
|
||||
|
||||
@ -697,9 +667,7 @@ void draw_connector::reset_svg_path()
|
||||
}
|
||||
///////////////////////////////////////
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:scene
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_scene::ns = L"dr3d";
|
||||
const wchar_t * dr3d_scene::name = L"scene";
|
||||
|
||||
@ -710,9 +678,7 @@ void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 10;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:extrude
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_extrude::ns = L"dr3d";
|
||||
const wchar_t * dr3d_extrude::name = L"extrude";
|
||||
|
||||
@ -726,9 +692,7 @@ void dr3d_extrude::reset_svg_path()
|
||||
if (!svg_d_) return;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:light
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_light::ns = L"dr3d";
|
||||
const wchar_t * dr3d_light::name = L"light";
|
||||
|
||||
@ -739,28 +703,6 @@ void dr3d_light::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
CP_APPLY_ATTR(L"dr3d:specular", dr3d_specular_);
|
||||
CP_APPLY_ATTR(L"dr3d:enabled", dr3d_enabled_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:control
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
const wchar_t * draw_control::name = L"control";
|
||||
|
||||
void draw_control::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"xml:id", xml_id_);
|
||||
CP_APPLY_ATTR(L"draw:caption-id", caption_id_);
|
||||
CP_APPLY_ATTR(L"draw:control", control_id_);
|
||||
|
||||
draw_shape::add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void draw_control::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"glue-point")
|
||||
{
|
||||
CP_CREATE_ELEMENT(draw_glue_point_);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +85,7 @@ public:
|
||||
odf_types::common_xlink_attlist xlink_attlist_;
|
||||
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
|
||||
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr enhanced_geometry_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
bool bad_shape_;
|
||||
bool word_art_;
|
||||
@ -622,31 +621,6 @@ public:
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_light);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDrawControl;
|
||||
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){}
|
||||
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
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_control);
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,6 @@
|
||||
|
||||
#include <xml/xmlchar.h>
|
||||
#include <xml/attributes.h>
|
||||
#include <xml/utils.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "serialize_elements.h"
|
||||
@ -54,7 +53,7 @@
|
||||
#include "datatypes/borderstyle.h"
|
||||
|
||||
#include "../docx/xlsx_utils.h"
|
||||
#include "../docx/docx_drawing.h"
|
||||
#include "../docx/oox_drawing.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -72,68 +71,42 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape"));
|
||||
|
||||
//---------------------------сначала элементы графики потом все остальное
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->docx_convert(Context);
|
||||
//////////////////////////////на другом контексте
|
||||
|
||||
//---------------------------на другом контексте
|
||||
//тут может быть не только текст , но и таблицы, другие объекты ...
|
||||
oox::StreamsManPtr prev = Context.get_stream_man();
|
||||
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
Context.reset_context_state();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
const std::wstring styleName = common_draw_attlists_.shape_with_text_and_styles_.
|
||||
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
|
||||
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
|
||||
style_content * content = styleInst ? styleInst->content() : NULL;
|
||||
graphic_format_properties * graphicProp = content ? content->get_graphic_properties() : NULL;
|
||||
|
||||
if (graphicProp)
|
||||
//сначала элементы графики потом все остальное
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type == typeDrawCustomShape) // || ....
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(graphicProp->common_draw_fill_attlist_, graphicProp->style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
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);
|
||||
}
|
||||
|
||||
std::wstringstream strm_fill, strm_ln;
|
||||
oox::oox_serialize_fill(strm_fill, fill, L"w14");
|
||||
std::wstring textFill = strm_fill.str();
|
||||
|
||||
std::vector<_property> props;
|
||||
graphicProp->apply_to(props);
|
||||
|
||||
oox::oox_serialize_ln(strm_ln, props, false, L"w14");
|
||||
std::wstring textLn = strm_ln.str();
|
||||
|
||||
std::wstring text_props;
|
||||
if (!textLn.empty())
|
||||
{
|
||||
text_props += textLn;
|
||||
}
|
||||
if (!textFill.empty())
|
||||
{
|
||||
text_props += L"<w14:textFill>" + textFill + L"</w14:textFill>";
|
||||
}
|
||||
Context.set_drawing_text_props(text_props);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool pParaState = Context.get_paragraph_state();
|
||||
bool pRunState = Context.get_run_state();
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type != typeDrawCustomShape)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
Context.back_context_state();
|
||||
Context.set_paragraph_state(pParaState);
|
||||
Context.set_run_state(pRunState);
|
||||
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
@ -162,22 +162,13 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_object();
|
||||
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->pptx_convert(Context);
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
//set fill & stroke to text
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
|
||||
if (!text_content_.empty())
|
||||
if (text_content_.length()>0)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"text-content",text_content_));
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
#include <xml/attributes.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "office_forms.h"
|
||||
#include "serialize_elements.h"
|
||||
#include "style_graphic_properties.h"
|
||||
#include "odfcontext.h"
|
||||
@ -66,9 +65,6 @@ namespace odf_reader {
|
||||
|
||||
void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->xlsx_convert(Context);
|
||||
|
||||
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
|
||||
|
||||
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
@ -133,26 +129,20 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
Context.get_drawing_context().set_fill(fill);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_drawing_content();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
//Context.get_text_context().start_drawing_fill(fill);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (!text_content_.empty())
|
||||
if (text_content_.length()>0)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
|
||||
}
|
||||
|
||||
Context.get_drawing_context().end_drawing();
|
||||
@ -365,38 +355,5 @@ void dr3d_light::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (!control_id_) return;
|
||||
|
||||
oox::forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
if (state.ctrlPropId.empty())
|
||||
{
|
||||
std::wstring target;
|
||||
state.ctrlPropId = Context.get_mediaitems().add_control_props(target);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
form_element* control = dynamic_cast<form_element*>(state.element);
|
||||
if (control)
|
||||
{
|
||||
control->serialize_control_props(strm);
|
||||
}
|
||||
|
||||
Context.add_control_props(state.ctrlPropId, target, strm.str());
|
||||
}
|
||||
|
||||
Context.get_drawing_context().start_frame();
|
||||
Context.get_drawing_context().set_control(state.ctrlPropId);
|
||||
|
||||
common_xlsx_convert(Context);
|
||||
|
||||
Context.get_drawing_context().end_frame();
|
||||
Context.get_drawing_context().clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -200,11 +200,7 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
|
||||
|
||||
if (false == map_encryptions_.empty())
|
||||
{
|
||||
if (password.empty())
|
||||
{
|
||||
bError = true;
|
||||
return;
|
||||
}
|
||||
if (password.empty()) return;
|
||||
|
||||
//decrypt files
|
||||
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(tempPath);
|
||||
@ -290,22 +286,17 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
bool result = true;
|
||||
for (size_t i = 0; i < arFiles.size(); ++i)
|
||||
{
|
||||
result = false;
|
||||
std::wstring sFileName = NSFile::GetFileName(arFiles[i]);
|
||||
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind;
|
||||
if (false == map_encryptions_.empty())
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
{
|
||||
pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
if (!result && false == map_encryptions_extra_.empty())
|
||||
else
|
||||
{
|
||||
pFind = map_encryptions_extra_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
@ -315,11 +306,10 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
result = true;
|
||||
else
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; result && i < arDirectories.size(); ++i)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user