mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
69 Commits
core/devel
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| 2084587e9a | |||
| 8332c28ac2 | |||
| 435a11d75c | |||
| 9a5329f5d6 | |||
| 8eecbf5fa5 | |||
| 9e1773df65 | |||
| 39e4140524 | |||
| bd90de857e | |||
| 57f2ec7b96 | |||
| 634098a6fa | |||
| bdbf208f6c | |||
| a652f5d73f | |||
| 1602843aa6 | |||
| cdb7fb8ea6 | |||
| 6387e9fa69 | |||
| 4e8097c93d | |||
| 65254b57b2 | |||
| 95899e23a8 | |||
| 5c8757d346 | |||
| 234e19d68a | |||
| 62145b7204 | |||
| 8bcc6d1501 | |||
| 09ef46f333 | |||
| 1839350526 | |||
| d7587e91b1 | |||
| 7b0a342cf9 | |||
| 3d01b0782e | |||
| fecfcfa7d2 | |||
| 29b5fa513a | |||
| f9a19badbf | |||
| d2630ea73c | |||
| a4a58c4782 | |||
| 29a3d80071 | |||
| 598bb419c0 | |||
| 087da9d2ce | |||
| c505aced48 | |||
| 959d5e5fcd | |||
| 8ee0cf4b2c | |||
| 426342074e | |||
| d2c092fe62 | |||
| a336917338 | |||
| 8925ddeee5 | |||
| 84824631b2 | |||
| dc3ecb1fc0 | |||
| 266cef8c49 | |||
| a5e821cd21 | |||
| cb5d92334e | |||
| f6dbc6b9f0 | |||
| c2c6430495 | |||
| 9ecf5b7834 | |||
| 1d003863dd | |||
| 774561bd00 | |||
| d356a305b9 | |||
| 95c472c15c | |||
| 2dbec241f7 | |||
| f3c66cab50 | |||
| 11e6fc3e06 | |||
| cdf8c0a11b | |||
| ae29cebe35 | |||
| e933a1fb42 | |||
| 5a3f98c502 | |||
| 8677540a82 | |||
| f4ceac5b2b | |||
| 61be4ea100 | |||
| 51c6ce2ba2 | |||
| e13bc44198 | |||
| 56cefcb1be | |||
| 51c77c3a85 | |||
| 4326a7d258 |
@ -136,14 +136,18 @@ namespace DocFileFormat
|
||||
}
|
||||
return btWin32;
|
||||
}
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(
|
||||
NSDirectory::GetTempPath(), L"emb");
|
||||
|
||||
sTempXmlFile += L".xml";
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sTempXmlFile);
|
||||
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
|
||||
@ -186,6 +190,7 @@ namespace DocFileFormat
|
||||
if (res) break;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary::Remove(sTempXmlFile);
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
@ -297,8 +302,13 @@ namespace DocFileFormat
|
||||
case metroBlob:
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
//{
|
||||
// m_isEmbedded = false;
|
||||
//}
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
|
||||
@ -46,7 +46,6 @@ namespace DocFileFormat
|
||||
{
|
||||
class OleObject;
|
||||
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
|
||||
class VMLPictureMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
@ -58,6 +57,7 @@ namespace DocFileFormat
|
||||
/// Writes a border element
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
|
||||
@ -86,6 +86,7 @@ namespace DocFileFormat
|
||||
friend class Table;
|
||||
friend class TableRow;
|
||||
friend class VMLShapeMapping;
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
|
||||
|
||||
@ -45,13 +45,13 @@ namespace Writers
|
||||
int index;
|
||||
};
|
||||
std::vector<_chartElem> m_aCharts;
|
||||
int nChartCount;
|
||||
public:
|
||||
std::wstring m_sDir;
|
||||
int nEmbeddedCount;
|
||||
|
||||
ChartWriter(std::wstring sDir) : m_sDir(sDir)
|
||||
{
|
||||
nChartCount = 0;
|
||||
nEmbeddedCount = 1000;
|
||||
}
|
||||
~ChartWriter()
|
||||
{
|
||||
@ -80,30 +80,20 @@ namespace Writers
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int& index)
|
||||
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int index)
|
||||
{
|
||||
_chartElem oChartElem;
|
||||
|
||||
oChartElem.content = content;
|
||||
oChartElem.index = nChartCount + 1;
|
||||
nChartCount++;
|
||||
oChartElem.index = index;
|
||||
|
||||
oChartElem.filename = L"chart" + std::to_wstring(oChartElem.index) + L".xml";
|
||||
|
||||
sRelsName = L"charts/" + oChartElem.filename;
|
||||
sFileName = oChartElem.filename;
|
||||
index = oChartElem.index;
|
||||
|
||||
m_aCharts.push_back(oChartElem);
|
||||
}
|
||||
int getChartCount()
|
||||
{
|
||||
return nChartCount;
|
||||
}
|
||||
void setChartCount(int val)
|
||||
{
|
||||
nChartCount = val;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef CHART_WRITER
|
||||
|
||||
@ -61,7 +61,7 @@ namespace Writers
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:body>")));
|
||||
oFile.WriteStringUTF8(m_oContent.GetData());
|
||||
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:sectPr >")));
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:sectPr>")));
|
||||
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
|
||||
oFile.WriteStringUTF8(m_oSecPr.GetData());
|
||||
oFile.WriteStringUTF8( std::wstring(_T("</w:sectPr>")));
|
||||
|
||||
@ -61,6 +61,26 @@ enum ETblStyleOverrideType
|
||||
tblstyleoverridetypeSwCell = 11,
|
||||
tblstyleoverridetypeWholeTable = 12
|
||||
};
|
||||
class SdtWraper
|
||||
{
|
||||
public:
|
||||
|
||||
OOX::Logic::CSdt m_oSdt;
|
||||
rPr* m_oEndPr;
|
||||
rPr* m_oRPr;
|
||||
int m_nType;
|
||||
SdtWraper(int nType)
|
||||
{
|
||||
m_nType = nType;
|
||||
m_oEndPr = NULL;
|
||||
m_oRPr = NULL;
|
||||
}
|
||||
~SdtWraper()
|
||||
{
|
||||
RELEASEOBJECT(m_oEndPr)
|
||||
RELEASEOBJECT(m_oRPr)
|
||||
}
|
||||
};
|
||||
|
||||
#define READ1_DEF(stLen, fReadFunction, arg, res) {\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
@ -3635,6 +3655,11 @@ public:
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(0);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else if ( c_oSerParType::sectPr == type )
|
||||
{
|
||||
SectPr oSectPr;
|
||||
@ -3746,6 +3771,11 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(1);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6292,15 +6322,11 @@ public:
|
||||
std::wstring sDrawingProperty = oCDrawingProperty.Write();
|
||||
if(false == sDrawingProperty.empty())
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(m_oFileWriter.m_oChartWriter.getChartCount());
|
||||
|
||||
long nCurPos = m_oBufferedStream.GetPos();
|
||||
std::wstring sDrawingXml;
|
||||
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, sDrawingXml);
|
||||
m_oBufferedStream.Seek(nCurPos);
|
||||
|
||||
m_oFileWriter.m_oChartWriter.setChartCount(m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount());
|
||||
|
||||
if( false == sDrawingXml.empty())
|
||||
{
|
||||
GetRunStringWriter().WriteString(sDrawingXml);
|
||||
@ -6416,6 +6442,11 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::Read_Row, this, poResult);
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:tr>")));
|
||||
}
|
||||
else if(c_oSerDocTableType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(2);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6448,6 +6479,11 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadCell, this, poResult);
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:tc>")));
|
||||
}
|
||||
else if(c_oSerDocTableType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(3);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6606,8 +6642,11 @@ public:
|
||||
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
|
||||
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
|
||||
|
||||
//save xlsx
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(m_oFileWriter.m_oChartWriter.getChartCount() + 1) + L".xlsx";
|
||||
//save xlsx
|
||||
_INT32 nChartCount = m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount();
|
||||
_INT32 nChartIndex = nChartCount + 1;
|
||||
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(nChartCount + 1);
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(nChartIndex) + L".xlsx";
|
||||
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
|
||||
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
|
||||
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
|
||||
@ -6615,8 +6654,10 @@ public:
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rIdXlsx;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
|
||||
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
|
||||
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
|
||||
@ -6630,7 +6671,6 @@ public:
|
||||
|
||||
std::wstring sFilename;
|
||||
std::wstring sRelsName;
|
||||
int nChartIndex;
|
||||
std::wstring sContent = sw.GetData();
|
||||
|
||||
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
|
||||
@ -6824,8 +6864,7 @@ public:
|
||||
std::wstring strDstEmbeddedTemp = strDstEmbedded + FILE_SEPARATOR_STR + L"Temp";
|
||||
NSDirectory::CreateDirectory(strDstEmbeddedTemp);
|
||||
|
||||
int id = m_oFileWriter.m_oChartWriter.getChartCount();
|
||||
m_oFileWriter.m_oChartWriter.setChartCount(id + 1);
|
||||
int id = m_oFileWriter.m_oChartWriter.nEmbeddedCount++;
|
||||
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id + 1) + L".xlsx";
|
||||
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());//???
|
||||
@ -7148,6 +7187,309 @@ public:
|
||||
{
|
||||
return oBinary_pPrReader.Read_SecPr(type, length, poResult);
|
||||
}
|
||||
int ReadSdt(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
SdtWraper* pSdt = static_cast<SdtWraper*>(poResult);
|
||||
if (c_oSerSdt::Pr == type)
|
||||
{
|
||||
pSdt->m_oSdt.m_oSdtPr.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPr, this, pSdt);
|
||||
}
|
||||
else if (c_oSerSdt::EndPr == type)
|
||||
{
|
||||
pSdt->m_oEndPr = new rPr(m_oFontTableWriter.m_mapFonts);
|
||||
res = oBinary_rPrReader.Read(length, pSdt->m_oEndPr);
|
||||
}
|
||||
else if (c_oSerSdt::Content == type)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdt>");
|
||||
if ( pSdt->m_oSdt.m_oSdtPr.IsInit() )
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLStart());
|
||||
if (NULL != pSdt->m_oRPr)
|
||||
{
|
||||
pSdt->m_oRPr->Write(&m_oDocumentWriter.m_oContent);
|
||||
}
|
||||
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLEnd());
|
||||
}
|
||||
if (NULL != pSdt->m_oEndPr)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtEndPr>");
|
||||
pSdt->m_oEndPr->Write(&m_oDocumentWriter.m_oContent);
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtEndPr>");
|
||||
}
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtContent>");
|
||||
switch(pSdt->m_nType)
|
||||
{
|
||||
case 0:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocumentContent, this, this);
|
||||
break;
|
||||
case 1:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, this);
|
||||
break;
|
||||
case 2:
|
||||
res = Read1(length, &Binary_DocumentTableReader::Read_TableContent, this, &m_oDocumentWriter.m_oContent);
|
||||
break;
|
||||
case 3:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadRowContent, this, &m_oDocumentWriter.m_oContent);
|
||||
break;
|
||||
}
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtContent>");
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdt>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPr(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
SdtWraper* pSdtWraper = static_cast<SdtWraper*>(poResult);
|
||||
OOX::Logic::CSdtPr* pSdtPr = pSdtWraper->m_oSdt.m_oSdtPr.GetPointer();
|
||||
if (c_oSerSdt::Type == type)
|
||||
{
|
||||
pSdtPr->m_eType = (OOX::Logic::ESdtType)m_oBufferedStream.GetUChar();
|
||||
}
|
||||
else if (c_oSerSdt::Alias == type)
|
||||
{
|
||||
pSdtPr->m_oAlias.Init();
|
||||
pSdtPr->m_oAlias->m_sVal.Init();
|
||||
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::ComboBox == type)
|
||||
{
|
||||
pSdtPr->m_oComboBox.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtComboBox, this, pSdtPr->m_oComboBox.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DataBinding == type)
|
||||
{
|
||||
pSdtPr->m_oDataBinding.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDataBinding, this, pSdtPr->m_oDataBinding.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::PrDate == type)
|
||||
{
|
||||
pSdtPr->m_oDate.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDate, this, pSdtPr->m_oDate.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DocPartList == type)
|
||||
{
|
||||
pSdtPr->m_oDocPartList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartList.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DocPartObj == type)
|
||||
{
|
||||
pSdtPr->m_oDocPartObj.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartObj.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DropDownList == type)
|
||||
{
|
||||
pSdtPr->m_oDropDownList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDropDownList, this, pSdtPr->m_oDropDownList.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::Id == type)
|
||||
{
|
||||
pSdtPr->m_oId.Init();
|
||||
pSdtPr->m_oId->m_oVal.Init();
|
||||
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Label == type)
|
||||
{
|
||||
pSdtPr->m_oLabel.Init();
|
||||
pSdtPr->m_oLabel->m_oVal.Init();
|
||||
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Lock == type)
|
||||
{
|
||||
pSdtPr->m_oLock.Init();
|
||||
pSdtPr->m_oLock->m_oVal.SetValue((SimpleTypes::ELock)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerSdt::PlaceHolder == type)
|
||||
{
|
||||
pSdtPr->m_oPlaceHolder.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::RPr == type)
|
||||
{
|
||||
pSdtWraper->m_oRPr = new rPr(m_oFontTableWriter.m_mapFonts);
|
||||
res = oBinary_rPrReader.Read(length, pSdtWraper->m_oRPr);
|
||||
}
|
||||
else if (c_oSerSdt::ShowingPlcHdr == type)
|
||||
{
|
||||
pSdtPr->m_oShowingPlcHdr.Init();
|
||||
pSdtPr->m_oShowingPlcHdr->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::TabIndex == type)
|
||||
{
|
||||
pSdtPr->m_oTabIndex.Init();
|
||||
pSdtPr->m_oTabIndex->m_oVal.Init();
|
||||
pSdtPr->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Tag == type)
|
||||
{
|
||||
pSdtPr->m_oTag.Init();
|
||||
pSdtPr->m_oTag->m_sVal.Init();
|
||||
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Temporary == type)
|
||||
{
|
||||
pSdtPr->m_oTemporary.Init();
|
||||
pSdtPr->m_oTemporary->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::MultiLine == type)
|
||||
{
|
||||
pSdtPr->m_oText.Init();
|
||||
pSdtPr->m_oText->m_oMultiLine.Init();
|
||||
pSdtPr->m_oText->m_oMultiLine->FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtComboBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtComboBox* pSdtComboBox = static_cast<OOX::Logic::CSdtComboBox*>(poResult);
|
||||
if (c_oSerSdt::LastValue == type)
|
||||
{
|
||||
pSdtComboBox->m_sLastValue.Init();
|
||||
pSdtComboBox->m_sLastValue->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::SdtListItem == type)
|
||||
{
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
|
||||
pSdtComboBox->m_arrListItem.push_back(pSdtListItem); }
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtListItem(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = static_cast<ComplexTypes::Word::CSdtListItem*>(poResult);
|
||||
if (c_oSerSdt::DisplayText == type)
|
||||
{
|
||||
pSdtListItem->m_sDisplayText.Init();
|
||||
pSdtListItem->m_sDisplayText->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Value == type)
|
||||
{
|
||||
pSdtListItem->m_sValue.Init();
|
||||
pSdtListItem->m_sValue->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPrDataBinding(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
ComplexTypes::Word::CDataBinding* pDataBinding = static_cast<ComplexTypes::Word::CDataBinding*>(poResult);
|
||||
if (c_oSerSdt::PrefixMappings == type)
|
||||
{
|
||||
pDataBinding->m_sPrefixMappings.Init();
|
||||
pDataBinding->m_sPrefixMappings->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::StoreItemID == type)
|
||||
{
|
||||
pDataBinding->m_sStoreItemID.Init();
|
||||
pDataBinding->m_sStoreItemID->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::XPath == type)
|
||||
{
|
||||
pDataBinding->m_sXPath.Init();
|
||||
pDataBinding->m_sXPath->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPrDate(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CDate* pDate = static_cast<OOX::Logic::CDate*>(poResult);
|
||||
if (c_oSerSdt::FullDate == type)
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
|
||||
pDate->m_oFullDate.Init();
|
||||
pDate->m_oFullDate->SetValue(sVal);
|
||||
}
|
||||
else if (c_oSerSdt::Calendar == type)
|
||||
{
|
||||
pDate->m_oCalendar.Init();
|
||||
pDate->m_oCalendar->m_oVal.SetValue((SimpleTypes::ECalendarType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerSdt::DateFormat == type)
|
||||
{
|
||||
pDate->m_oDateFormat.Init();
|
||||
pDate->m_oDateFormat->m_sVal.Init();
|
||||
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Lid == type)
|
||||
{
|
||||
pDate->m_oLid.Init();
|
||||
pDate->m_oLid->m_oVal.Init();
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pDate->m_oLid->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if (c_oSerSdt::StoreMappedDataAs == type)
|
||||
{
|
||||
pDate->m_oStoreMappedDateAs.Init();
|
||||
pDate->m_oStoreMappedDateAs->m_oVal.SetValue((SimpleTypes::ESdtDateMappingType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDocPartList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtDocPart* pDocPart = static_cast<OOX::Logic::CSdtDocPart*>(poResult);
|
||||
if (c_oSerSdt::DocPartCategory == type)
|
||||
{
|
||||
pDocPart->m_oDocPartCategory.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartGallery == type)
|
||||
{
|
||||
pDocPart->m_oDocPartGallery.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartUnique == type)
|
||||
{
|
||||
pDocPart->m_oDocPartUnique.Init();
|
||||
pDocPart->m_oDocPartUnique->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDropDownList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtDropDownList* pDropDownList = static_cast<OOX::Logic::CSdtDropDownList*>(poResult);
|
||||
if (c_oSerSdt::LastValue == type)
|
||||
{
|
||||
pDropDownList->m_sLastValue.Init();
|
||||
pDropDownList->m_sLastValue->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::SdtListItem == type)
|
||||
{
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
|
||||
pDropDownList->m_arrListItem.push_back(pSdtListItem);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
class Binary_NotesTableReader : public Binary_CommonReader<Binary_NotesTableReader>
|
||||
{
|
||||
|
||||
@ -463,7 +463,8 @@ extern int g_nCurFormatVersion;
|
||||
FldSimple = 11,
|
||||
Del = 12,
|
||||
Ins = 13,
|
||||
Background = 14
|
||||
Background = 14,
|
||||
Sdt = 15
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -477,7 +478,8 @@ extern int g_nCurFormatVersion;
|
||||
Cell = 6,
|
||||
Cell_Pr = 7,
|
||||
Cell_Content = 8,
|
||||
tblGridChange = 9
|
||||
tblGridChange = 9,
|
||||
Sdt = 10
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -1003,6 +1005,45 @@ extern int g_nCurFormatVersion;
|
||||
Data = 1,
|
||||
Program = 2
|
||||
};}
|
||||
namespace c_oSerSdt{enum c_oSerSdt
|
||||
{
|
||||
Pr = 0,
|
||||
EndPr = 1,
|
||||
Content = 2,
|
||||
Type = 3,
|
||||
Alias = 4,
|
||||
ComboBox = 5,
|
||||
LastValue = 6,
|
||||
SdtListItem = 7,
|
||||
DisplayText = 8,
|
||||
Value = 9,
|
||||
DataBinding = 10,
|
||||
PrefixMappings = 11,
|
||||
StoreItemID = 12,
|
||||
XPath = 13,
|
||||
PrDate = 14,
|
||||
FullDate = 15,
|
||||
Calendar = 16,
|
||||
DateFormat = 17,
|
||||
Lid = 18,
|
||||
StoreMappedDataAs = 19,
|
||||
DocPartList = 20,
|
||||
DocPartObj = 21,
|
||||
DocPartCategory = 22,
|
||||
DocPartGallery = 23,
|
||||
DocPartUnique = 24,
|
||||
DropDownList = 25,
|
||||
Id = 26,
|
||||
Label = 27,
|
||||
Lock = 28,
|
||||
PlaceHolder = 29,
|
||||
RPr = 30,
|
||||
ShowingPlcHdr = 31,
|
||||
TabIndex = 32,
|
||||
Tag = 33,
|
||||
Temporary = 34,
|
||||
MultiLine = 35
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -81,12 +81,14 @@ namespace BinDocxRW
|
||||
void BinaryHeaderFooterTableWriter::WriteHdrFtrItem(OOX::Logic::CSectionProperty* pSectPr, OOX::CHdrFtr* pHdrFtr, bool bHdr)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
//Content
|
||||
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
|
||||
//Content
|
||||
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, pHdrFtr->m_arrShapeTypes);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
@ -57,7 +57,6 @@ namespace BinDocxRW
|
||||
PPTX::Theme* m_poTheme;
|
||||
|
||||
OOX::IFileContainer* m_pCurRels;
|
||||
std::wstring m_sCurDocumentPath;
|
||||
std::map<int, bool> m_mapIgnoreComments;
|
||||
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
|
||||
@ -72,9 +71,8 @@ namespace BinDocxRW
|
||||
{
|
||||
public:
|
||||
OOX::IFileContainer* m_pRels;
|
||||
std::wstring m_sDocumentPath;
|
||||
|
||||
ParamsDocumentWriter(OOX::IFileContainer* pRels, const std::wstring& sDocumentPath):m_pRels(pRels), m_sDocumentPath(sDocumentPath)
|
||||
ParamsDocumentWriter(OOX::IFileContainer* pRels) : m_pRels(pRels)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -99,6 +97,8 @@ namespace BinDocxRW
|
||||
BinaryCommonWriter(ParamsWriter& oParamsWriter) : m_oStream(*oParamsWriter.m_pCBufferedStream),
|
||||
m_pEmbeddedFontsManager(oParamsWriter.m_pEmbeddedFontsManager)
|
||||
{
|
||||
*m_oStream.m_pCurrentContainer = oParamsWriter.m_pCurRels;
|
||||
m_oStream.m_pCurrentContainer->AddRef();
|
||||
}
|
||||
int WriteItemStart(BYTE type)
|
||||
{
|
||||
@ -2999,15 +2999,17 @@ namespace BinDocxRW
|
||||
RELEASEOBJECT(m_aFldChars[i]);
|
||||
}
|
||||
}
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, std::wstring& sDocumentPath, std::vector<std::wstring>& aShapeTypes)
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
|
||||
{
|
||||
pOfficeDrawingConverter->SetRelsPath(sDocumentPath);
|
||||
smart_ptr<OOX::IFileContainer> oldRels = pOfficeDrawingConverter->GetRels();
|
||||
pOfficeDrawingConverter->SetRels(rels);
|
||||
|
||||
for(size_t i = 0, length = aShapeTypes.size(); i < length; ++i)
|
||||
{
|
||||
std::wstring& sShapeType = aShapeTypes[i];
|
||||
pOfficeDrawingConverter->AddShapeType(sShapeType);
|
||||
}
|
||||
pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
void Write(std::vector<OOX::WritingElement*>& aElems)
|
||||
{
|
||||
@ -3045,8 +3047,9 @@ namespace BinDocxRW
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
|
||||
WriteSdt(pStd, 0, NULL, 0, 0, 0);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_smartTag:
|
||||
{
|
||||
@ -3187,8 +3190,9 @@ namespace BinDocxRW
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
|
||||
WriteSdt(pStd, 1, NULL, 0, 0, 0);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_smartTag:
|
||||
@ -5480,21 +5484,14 @@ namespace BinDocxRW
|
||||
{
|
||||
if (pGraphic->chartRec.IsInit() && pGraphic->chartRec->id_data.IsInit() )
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( pGraphic->chartRec->id_data.get());
|
||||
if (pFile.IsInit() && OOX::FileTypes::Chart == pFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CChartSpace* pChart = static_cast<OOX::Spreadsheet::CChartSpace*>(pFile.operator ->());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::Chart2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::Chart2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(m_oBcw.m_oStream, m_pOfficeDrawingConverter);
|
||||
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
|
||||
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
pGraphic->chartRec->toPPTY(&m_oBcw.m_oStream);
|
||||
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6371,8 +6368,9 @@ namespace BinDocxRW
|
||||
else if(OOX::et_w_sdt == item->getType())
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
|
||||
WriteSdt(pStd, 2, pTblPr, 0, nRows, nCols);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_smartTag == item->getType())
|
||||
{
|
||||
@ -6430,8 +6428,9 @@ namespace BinDocxRW
|
||||
else if(OOX::et_w_sdt == item->getType())
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
|
||||
WriteSdt(pStd, 3, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_smartTag == item->getType())
|
||||
{
|
||||
@ -6467,6 +6466,287 @@ namespace BinDocxRW
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(pStd->m_oSdtPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Pr);
|
||||
WriteSdtPr(pStd->m_oSdtPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pStd->m_oSdtEndPr.IsInit() && pStd->m_oSdtEndPr->m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::EndPr);
|
||||
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Content);
|
||||
switch(type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, m_oParamsDocumentWriter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Type);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_eType);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
if(oStdPr.m_oAlias.IsInit() && oStdPr.m_oAlias->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Alias);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oComboBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
|
||||
WriteSdtComboBox(oStdPr.m_oComboBox.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDataBinding.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);
|
||||
WriteSdtPrDataBinding(oStdPr.m_oDataBinding.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrDate);
|
||||
WriteSdtPrDate(oStdPr.m_oDate.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDocPartList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartList);
|
||||
WriteDocPartList(oStdPr.m_oDocPartList.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDocPartObj.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartObj);
|
||||
WriteDocPartList(oStdPr.m_oDocPartObj.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDropDownList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DropDownList);
|
||||
WriteDropDownList(oStdPr.m_oDropDownList.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oId.IsInit() && oStdPr.m_oId->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Id);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oId->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oLabel.IsInit() && oStdPr.m_oLabel->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Label);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oLabel->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oLock.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lock);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oLock->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oPlaceHolder.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PlaceHolder);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::RPr);
|
||||
brPrs.Write_rPr(oStdPr.m_oRPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oShowingPlcHdr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ShowingPlcHdr);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oShowingPlcHdr->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTabIndex.IsInit() && oStdPr.m_oTabIndex->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TabIndex);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oTabIndex->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTag.IsInit() && oStdPr.m_oTag->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Tag);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oTag->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTemporary.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Temporary);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oTemporary->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oText.IsInit() && oStdPr.m_oText->m_oMultiLine.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::MultiLine);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oText->m_oMultiLine->ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtComboBox.m_sLastValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtComboBox.m_sLastValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
for(size_t i = 0; i < oSdtComboBox.m_arrListItem.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
|
||||
WriteSdtListItem(*oSdtComboBox.m_arrListItem[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtListItem(const ComplexTypes::Word::CSdtListItem& oSdtListItem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtListItem.m_sDisplayText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DisplayText);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sDisplayText.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtListItem.m_sValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Value);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPrDataBinding(const ComplexTypes::Word::CDataBinding& oDataBinding)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDataBinding.m_sPrefixMappings.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrefixMappings);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sPrefixMappings.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDataBinding.m_sStoreItemID.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreItemID);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sStoreItemID.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDataBinding.m_sXPath.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::XPath);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sXPath.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPrDate(const OOX::Logic::CDate& oDate)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDate.m_oFullDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::FullDate);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oFullDate->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oCalendar.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Calendar);
|
||||
m_oBcw.m_oStream.WriteBYTE(oDate.m_oCalendar->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oDateFormat.IsInit() && oDate.m_oDateFormat->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DateFormat);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oDateFormat->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oLid.IsInit() && oDate.m_oLid->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lid);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oLid->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oStoreMappedDateAs.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreMappedDataAs);
|
||||
m_oBcw.m_oStream.WriteBYTE(oDate.m_oStoreMappedDateAs->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtDocPart.m_oDocPartCategory.IsInit() && oSdtDocPart.m_oDocPartCategory->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartCategory);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartCategory->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtDocPart.m_oDocPartGallery.IsInit() && oSdtDocPart.m_oDocPartGallery->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartGallery);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartGallery->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtDocPart.m_oDocPartUnique.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartUnique);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSdtDocPart.m_oDocPartUnique->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDropDownList.m_sLastValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDropDownList.m_sLastValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
for(size_t i = 0; i < oDropDownList.m_arrListItem.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
|
||||
WriteSdtListItem(*oDropDownList.m_arrListItem[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
};
|
||||
class BinaryCommentsTableWriter
|
||||
{
|
||||
@ -6914,80 +7194,94 @@ namespace BinDocxRW
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteColorSchemeMapping(const OOX::Settings::CColorSchemeMapping& oColorSchemeMapping)
|
||||
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oColorSchemeMapping.m_oAccent1.IsInit())
|
||||
std::map<std::wstring, PPTX::Limit::ColorSchemeIndex>::const_iterator pFind;
|
||||
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent3.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent3");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent3);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent3->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent4.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent4");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent4);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent4->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent5.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent5");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent5);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent5->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent6.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent6");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent6);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent6->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oBg1.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"bg1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oBg2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"bg2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oFollowedHyperlink.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"folHlink");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::FollowedHyperlink);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oFollowedHyperlink->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oHyperlink.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"hlink");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Hyperlink);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oHyperlink->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oT1.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"tx1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
if(oColorSchemeMapping.m_oT2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"tx2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -7003,9 +7297,8 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteFootnotes(OOX::CFootnotes& oFootnotes)
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oFootnotes, oFootnotes.m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oFootnotes);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter, oFootnotes.m_arrShapeTypes);
|
||||
@ -7013,9 +7306,8 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteEndnotes(OOX::CEndnotes& oEndnotes)
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oEndnotes, oEndnotes.m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oEndnotes);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter, oEndnotes.m_arrShapeTypes);
|
||||
@ -7048,7 +7340,9 @@ namespace BinDocxRW
|
||||
}
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, arrShapeTypes);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::NoteContent);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oFtnEdn.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
@ -7213,14 +7507,13 @@ namespace BinDocxRW
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
|
||||
//Write DocumentTable
|
||||
ParamsDocumentWriter oParamsDocumentWriter(poDocument, poDocument->m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, poDocument->m_arrShapeTypes);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
|
||||
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
|
||||
|
||||
@ -387,7 +387,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const std::wstring& bsTxConten
|
||||
|
||||
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
|
||||
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels);
|
||||
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
|
||||
@ -411,7 +411,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContentElem(OOX::EElementType eElemTyp
|
||||
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
|
||||
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
|
||||
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels);
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
if(OOX::et_m_oMathPara == eElemType)
|
||||
{
|
||||
|
||||
@ -139,31 +139,7 @@ namespace BinXlsxRW{
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return true;
|
||||
}
|
||||
bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize)
|
||||
{
|
||||
if (NULL == pWriter) return false;
|
||||
if (NULL == m_pExternalDrawingConverter) return false;
|
||||
|
||||
OOX::CPath oRootPath;
|
||||
OOX::Spreadsheet::CChartSpace oChart(oRootPath, sChartPath);
|
||||
|
||||
long nStartPos = pWriter->GetPosition();
|
||||
BinXlsxRW::BinaryCommonWriter oBcw(*pWriter);
|
||||
|
||||
std::wstring sOldRelsPath = m_pExternalDrawingConverter->GetRelsPath();
|
||||
m_pExternalDrawingConverter->SetRelsPath(sChartPath);
|
||||
|
||||
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(*pWriter, m_pExternalDrawingConverter);
|
||||
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
|
||||
|
||||
m_pExternalDrawingConverter->SetRelsPath(sOldRelsPath);
|
||||
|
||||
long nEndPos = pWriter->GetPosition();
|
||||
lDataSize = nEndPos - nStartPos;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
|
||||
{
|
||||
if (NULL == pReader) return false;
|
||||
if (NULL == m_pExternalDrawingConverter) return false;
|
||||
|
||||
@ -64,7 +64,6 @@ namespace BinXlsxRW {
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize);
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
|
||||
@ -54,7 +54,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx docx
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx docx
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="OdfFileReaderTest"
|
||||
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
|
||||
RootNamespace="ASCOfficeOdfFileTest"
|
||||
|
||||
@ -72,8 +72,8 @@ public:
|
||||
void start_base_style(const std::wstring baseStyleName, const odf_types::style_family::type baseStyleType);
|
||||
void end_base_style();
|
||||
|
||||
void ApplyTextProperties (std::wstring style,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyParagraphProperties (std::wstring style,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring para_style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
void ApplyListProperties (odf_reader::paragraph_format_properties & propertiesOut, int Level);
|
||||
|
||||
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
|
||||
dump_run();
|
||||
hyperlink_hId = L"";
|
||||
}
|
||||
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
|
||||
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::wstring para_style_name, odf_reader::text_format_properties_content & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* para_style = NULL;
|
||||
odf_reader::style_instance* text_style = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
para_style = local_styles_ptr_->style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
text_style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Text);
|
||||
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
para_style = odf_context_.styleContainer().style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
text_style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Text);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (baseStyle) instances.push_back(baseStyle);
|
||||
if (style) instances.push_back(style);
|
||||
if (para_style) instances.push_back(para_style);
|
||||
if (text_style) instances.push_back(text_style);
|
||||
|
||||
if (style)get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
if (text_style) get_styles_context().start_process_style(text_style);
|
||||
else if (para_style) get_styles_context().start_process_style(para_style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
|
||||
}
|
||||
|
||||
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
|
||||
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name, odf_reader::paragraph_format_properties & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance * defaultStyle = NULL;
|
||||
odf_reader::style_instance * baseStyle = NULL;
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Paragraph);
|
||||
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
|
||||
baseStyle= odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Paragraph);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (baseStyle) instances.push_back(baseStyle);
|
||||
if (style) instances.push_back(style);
|
||||
|
||||
if (style)get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
if (style) get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
|
||||
}
|
||||
@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
|
||||
int level = list_style_stack_.size()-1;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph);
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_);
|
||||
ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
|
||||
|
||||
paragraph_properties_.pptx_convert(pptx_context_);
|
||||
@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
|
||||
return;
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_span_;
|
||||
ApplyTextProperties(span_style_name_, text_properties_span_,odf_types::style_family::Text);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_;
|
||||
|
||||
text_properties_.apply_from(text_properties_paragraph_);
|
||||
text_properties_.apply_from(text_properties_span_);
|
||||
|
||||
ApplyTextProperties(span_style_name_, paragraph_style_name_, text_properties_);
|
||||
|
||||
get_styles_context().start();
|
||||
|
||||
|
||||
@ -84,10 +84,10 @@ public:
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
|
||||
void ApplyTextProperties (std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
|
||||
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
void set_local_styles_container (odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
|
||||
bool is_drawing_context(){return in_draw;}
|
||||
|
||||
@ -136,7 +136,8 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm)
|
||||
xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles),
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false)
|
||||
{
|
||||
text_properties_cell_ = NULL;
|
||||
local_styles_ptr_ = NULL;
|
||||
text_properties_cell_ = NULL;
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::add_text(const std::wstring & text)
|
||||
@ -236,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
|
||||
hyperlink_hId = hId;
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
|
||||
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* paraStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Paragraph);
|
||||
paraStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Paragraph);
|
||||
paraStyle = styles_.style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (paraStyle) instances.push_back(paraStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
|
||||
}
|
||||
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
|
||||
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* textStyle = NULL;
|
||||
odf_reader::style_instance* paraStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Text);
|
||||
paraStyle = local_styles_ptr_->style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
textStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Text);
|
||||
paraStyle = styles_.style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
textStyle = styles_.style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (paraStyle) instances.push_back(paraStyle);
|
||||
if (textStyle) instances.push_back(textStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
|
||||
@ -290,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
|
||||
{
|
||||
if (paragraph_style_name_.empty())return;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_format_properties_;
|
||||
odf_reader::paragraph_format_properties paragraph_format_properties_;
|
||||
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph);
|
||||
paragraph_format_properties_.xlsx_convert(strm, in_draw);
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_);
|
||||
paragraph_format_properties_.xlsx_convert (strm, in_draw);
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
@ -302,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
&& !(!hyperlink_hId.empty() && in_draw)
|
||||
&& !(text_properties_cell_ && in_cell_content))return;
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
odf_reader::text_format_properties_content text_properties_span_;
|
||||
|
||||
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_ , odf_types::style_family::Paragraph);
|
||||
ApplyTextProperties (span_style_name_, text_properties_span_ , odf_types::style_family::Text);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_;
|
||||
|
||||
if (in_cell_content && text_properties_cell_)
|
||||
{
|
||||
text_properties_.apply_from(*text_properties_cell_);
|
||||
}
|
||||
text_properties_.apply_from(text_properties_paragraph_);
|
||||
text_properties_.apply_from(text_properties_span_);
|
||||
}
|
||||
|
||||
ApplyTextProperties (span_style_name_, paragraph_style_name_, text_properties_);
|
||||
|
||||
_CP_OPT(double) dValFontSize;
|
||||
if (text_properties_.fo_font_size_)
|
||||
|
||||
@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class
|
||||
std::wstring res = L"";
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case presentation_class::title: _Wostream << L"title" ; break;
|
||||
case presentation_class::subtitle: _Wostream << L"subtitle" ; break;
|
||||
case presentation_class::graphic: _Wostream << L"graphic" ; break;
|
||||
case presentation_class::object: _Wostream << L"object" ; break;
|
||||
case presentation_class::chart: _Wostream << L"chart" ; break;
|
||||
case presentation_class::table: _Wostream << L"table" ; break;
|
||||
case presentation_class::orgchart: _Wostream << L"orgchart" ; break;
|
||||
case presentation_class::header: _Wostream << L"header" ; break;
|
||||
case presentation_class::footer: _Wostream << L"footer" ; break;
|
||||
case presentation_class::date_time: _Wostream << L"date_time" ; break;
|
||||
case presentation_class::page_number: _Wostream << L"page_number" ; break;
|
||||
case presentation_class::page: _Wostream << L"page" ; break;
|
||||
case presentation_class::notes: _Wostream << L"notes" ; break;
|
||||
case presentation_class::handout: _Wostream << L"handout" ; break;
|
||||
case presentation_class::outline: _Wostream << L"outline" ; break;
|
||||
case presentation_class::text: _Wostream << L"text" ; break;
|
||||
case presentation_class::title: _Wostream << L"title"; break;
|
||||
case presentation_class::subtitle: _Wostream << L"subtitle"; break;
|
||||
case presentation_class::graphic: _Wostream << L"graphic"; break;
|
||||
case presentation_class::object: _Wostream << L"object"; break;
|
||||
case presentation_class::chart: _Wostream << L"chart"; break;
|
||||
case presentation_class::table: _Wostream << L"table"; break;
|
||||
case presentation_class::orgchart: _Wostream << L"orgchart"; break;
|
||||
case presentation_class::header: _Wostream << L"header"; break;
|
||||
case presentation_class::footer: _Wostream << L"footer"; break;
|
||||
case presentation_class::date_time: _Wostream << L"date-time"; break;
|
||||
case presentation_class::page_number: _Wostream << L"page-number";break;
|
||||
case presentation_class::page: _Wostream << L"page"; break;
|
||||
case presentation_class::notes: _Wostream << L"notes"; break;
|
||||
case presentation_class::handout: _Wostream << L"handout"; break;
|
||||
case presentation_class::outline: _Wostream << L"outline"; break;
|
||||
case presentation_class::text: _Wostream << L"text"; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if (tmp == L"page")
|
||||
return presentation_class( page );
|
||||
else if (tmp == L"title")
|
||||
return presentation_class( title);
|
||||
else if (tmp == L"outline")
|
||||
return presentation_class( outline );
|
||||
else if (tmp == L"subtitle")
|
||||
return presentation_class( subtitle);
|
||||
else if (tmp == L"text")
|
||||
return presentation_class( text);
|
||||
else if (tmp == L"graphic")
|
||||
return presentation_class( graphic );
|
||||
else if (tmp == L"object")
|
||||
return presentation_class( object );
|
||||
else if (tmp == L"chart")
|
||||
return presentation_class( chart );
|
||||
else if (tmp == L"table")
|
||||
return presentation_class( table );
|
||||
else if (tmp == L"orgchart")
|
||||
return presentation_class( orgchart );
|
||||
else if (tmp == L"notes")
|
||||
return presentation_class( notes );
|
||||
else if (tmp == L"handout")
|
||||
return presentation_class( handout );
|
||||
else if (tmp == L"header")
|
||||
return presentation_class( header );
|
||||
else if (tmp == L"footer")
|
||||
return presentation_class( footer );
|
||||
else if (tmp == L"date-time")
|
||||
return presentation_class( date_time );
|
||||
else if (tmp == L"page-number")
|
||||
return presentation_class( page_number );
|
||||
else
|
||||
if (tmp == L"page") return presentation_class( page );
|
||||
else if (tmp == L"title") return presentation_class( title);
|
||||
else if (tmp == L"outline") return presentation_class( outline );
|
||||
else if (tmp == L"subtitle") return presentation_class( subtitle);
|
||||
else if (tmp == L"text") return presentation_class( text);
|
||||
else if (tmp == L"graphic") return presentation_class( graphic );
|
||||
else if (tmp == L"object") return presentation_class( object );
|
||||
else if (tmp == L"chart") return presentation_class( chart );
|
||||
else if (tmp == L"table") return presentation_class( table );
|
||||
else if (tmp == L"orgchart") return presentation_class( orgchart );
|
||||
else if (tmp == L"notes") return presentation_class( notes );
|
||||
else if (tmp == L"handout") return presentation_class( handout );
|
||||
else if (tmp == L"header") return presentation_class( header );
|
||||
else if (tmp == L"footer") return presentation_class( footer );
|
||||
else if (tmp == L"date-time") return presentation_class( date_time );
|
||||
else if (tmp == L"page-number") return presentation_class( page_number );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return presentation_class( page );
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,6 +453,7 @@ void draw_enhanced_geometry_attlist::add_attributes( const xml::attributes_wc_pt
|
||||
CP_APPLY_ATTR(L"draw:modifiers" , draw_modifiers_);
|
||||
CP_APPLY_ATTR(L"draw:text-path" , draw_text_path_);
|
||||
CP_APPLY_ATTR(L"draw:enhanced-path" , draw_enhanced_path_);
|
||||
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
|
||||
@ -485,6 +486,9 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void draw_enhanced_geometry::find_draw_type_oox()
|
||||
{
|
||||
word_art_ = false;
|
||||
bOoxType_ = false;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_text_path_ &&
|
||||
*draw_enhanced_geometry_attlist_.draw_text_path_ == true)
|
||||
{
|
||||
@ -501,7 +505,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
{
|
||||
int count = sizeof(_OO_OOX_wordart) / sizeof(_shape_converter);
|
||||
|
||||
for (long i=0; i< count; i++)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (_OO_OOX_wordart[i].odf_reader == odf_type)
|
||||
{
|
||||
@ -518,7 +522,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
|
||||
if (pos < 0)
|
||||
{
|
||||
for (long i=0; i< count; i++)
|
||||
for (long i = 0; i< count; i++)
|
||||
{
|
||||
if (_OO_OOX_custom_shapes[i].odf_reader == odf_type)
|
||||
{
|
||||
@ -529,8 +533,9 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
}
|
||||
else
|
||||
{
|
||||
bOoxType_ = true;
|
||||
std::wstring oox_type = odf_type.substr(pos + 6);
|
||||
for (long i=0; i< count; i++)
|
||||
for (long i = 0; i< count; i++)
|
||||
{
|
||||
if (_OO_OOX_custom_shapes[i].oox == oox_type)
|
||||
{
|
||||
@ -547,18 +552,18 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
}
|
||||
std::wstringstream str;
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, draw_handle_)
|
||||
for (size_t i = 0; i < draw_handle_.size(); i++)
|
||||
{
|
||||
draw_handle * handle = dynamic_cast<draw_handle *>(parElement.get());
|
||||
|
||||
int min = -1;
|
||||
int max = -1;
|
||||
draw_handle * handle = dynamic_cast<draw_handle *>(draw_handle_[i].get());
|
||||
if (!handle) continue;
|
||||
|
||||
int min = -1, max = -1;
|
||||
|
||||
try
|
||||
{
|
||||
min = parsing(handle->draw_handle_attlist_.draw_handle_range_y_minimum_);//пока статик .. и выдается только цыфровое значение
|
||||
if (min<0)min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
|
||||
if (min<0)min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
|
||||
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
|
||||
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@ -574,7 +579,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
draw_handle_geometry elm={min, max};
|
||||
draw_handle_geometry elm = {min, max};
|
||||
draw_handle_geometry_.push_back(elm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -437,6 +437,7 @@ public:
|
||||
_CP_OPT(std::wstring) draw_modifiers_;
|
||||
_CP_OPT(bool) draw_text_path_;
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) drawooo_enhanced_path_;
|
||||
_CP_OPT(std::wstring) drawooo_sub_view_size_;
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@ -464,7 +465,9 @@ public:
|
||||
_CP_OPT(int) sub_type_;
|
||||
_CP_OPT(int) draw_type_oox_index_;
|
||||
_CP_OPT(std::wstring) svg_viewbox_;
|
||||
|
||||
bool word_art_;
|
||||
bool bOoxType_;
|
||||
|
||||
typedef std::pair<std::wstring,std::wstring> pair_string_value;
|
||||
|
||||
|
||||
@ -253,13 +253,19 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
set_shape = true;
|
||||
}
|
||||
|
||||
if (sub_type_)
|
||||
{
|
||||
shape->sub_type_ = sub_type_.get();
|
||||
set_shape = true;
|
||||
}
|
||||
std::wstring odf_path;
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
|
||||
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
if (!odf_path.empty())
|
||||
{
|
||||
std::vector<::svg_path::_polyline> o_Polyline;
|
||||
|
||||
@ -267,7 +273,7 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
try
|
||||
{
|
||||
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@ -316,8 +322,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
{
|
||||
if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"draw-modifiers-min",draw_handle_geometry_[0].min));
|
||||
shape->additional_.push_back(_property(L"draw-modifiers-max",draw_handle_geometry_[0].max));
|
||||
shape->additional_.push_back(_property(L"draw-modifiers-min", draw_handle_geometry_[0].min));
|
||||
shape->additional_.push_back(_property(L"draw-modifiers-max", draw_handle_geometry_[0].max));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,7 +332,6 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
{
|
||||
shape->bad_shape_ = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
{
|
||||
CP_XML_NODE(L"a:spcBef")
|
||||
{
|
||||
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
|
||||
if (fo_margin_top_->get_type() == length_or_percent::Length)
|
||||
{
|
||||
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
|
||||
CP_XML_NODE(L"a:spcPts")
|
||||
|
||||
@ -67,30 +67,41 @@ public:
|
||||
odf_type_name =L"ooxml-snip2DiagRect";
|
||||
|
||||
modifiers = L"0 16667";
|
||||
enhanced_path = L"M ?f9 ?f2 L ?f13 ?f2 ?f1 ?f12 ?f1 ?f11 ?f10 ?f3 ?f12 ?f3 ?f0 ?f14 ?f0 ?f9 Z N";
|
||||
text_areas = L"?f17 ?f17 ?f18 ?f19";
|
||||
view_box = L"0 0 21600 21600";
|
||||
enhanced_path = L"M ?f3 0 L ?f7 0 ?f14 ?f6 ?f14 ?f5 ?f4 ?f17 ?f6 ?f17 0 ?f8 0 ?f3 Z N";
|
||||
text_areas = L"?f11 ?f11 ?f12 ?f13";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"$0");
|
||||
add(L"f8", L"$1");
|
||||
add(L"f9", L"?f6 * ?f7 / 100000");
|
||||
add(L"f10", L"?f1 - ?f9");
|
||||
add(L"f11", L"?f3 - ?f9");
|
||||
add(L"f12", L"?f6 * ?f8 / 100000");
|
||||
add(L"f13", L"?f1 - ?f12");
|
||||
add(L"f14", L"?f3 - ?f12");
|
||||
add(L"f15", L"?f9 - ?f12");
|
||||
add(L"f16", L"if(?f15, ?f9, ?f12)");
|
||||
add(L"f17", L"?f16 / 2");
|
||||
add(L"f18", L"?f1 - ?f17");
|
||||
add(L"f19", L"?f3 - ?f17");
|
||||
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
|
||||
add(L"f1", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
|
||||
add(L"f2", L"min(logwidth,logheight)");
|
||||
add(L"f3", L"?f2 *?f0 /100000");
|
||||
add(L"f4", L"logwidth+0-?f3 ");
|
||||
add(L"f5", L"logheight+0-?f3 ");
|
||||
add(L"f6", L"?f2 *?f1 /100000");
|
||||
add(L"f7", L"logwidth+0-?f6 ");
|
||||
add(L"f8", L"logheight+0-?f6 ");
|
||||
add(L"f9", L"?f3 +0-?f6 ");
|
||||
add(L"f10", L"if(?f9 ,?f3 ,?f6 )");
|
||||
add(L"f11", L"?f10 *1/2");
|
||||
add(L"f12", L"logwidth+0-?f11 ");
|
||||
add(L"f13", L"logheight+0-?f11 ");
|
||||
add(L"f14", L"logwidth");
|
||||
add(L"f15", L"logheight/2");
|
||||
add(L"f16", L"logwidth/2");
|
||||
add(L"f17", L"logheight");
|
||||
|
||||
_handle h;
|
||||
|
||||
h.position = L"?f3 0";
|
||||
h.x_maximum= L"50000";
|
||||
h.x_minimum= L"0";
|
||||
handles.push_back(h);
|
||||
|
||||
h.position = L"?f7 0";
|
||||
h.x_maximum= L"50000";
|
||||
h.x_minimum= L"0";
|
||||
handles.push_back(h);
|
||||
|
||||
}
|
||||
};
|
||||
class oox_shape_snip2SameRect : public oox_shape
|
||||
|
||||
@ -403,9 +403,11 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
|
||||
void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"draw:type", draw_type_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
|
||||
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
|
||||
CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
|
||||
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
|
||||
CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_);
|
||||
CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_);
|
||||
CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_);
|
||||
|
||||
@ -316,19 +316,21 @@ CP_REGISTER_OFFICE_ELEMENT2(draw_handle);
|
||||
class draw_enhanced_geometry_attlist
|
||||
{
|
||||
public:
|
||||
_CP_OPT(std::wstring) draw_type_;
|
||||
_CP_OPT(std::wstring) draw_modifiers_;
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) draw_text_areas_;
|
||||
_CP_OPT(std::wstring) draw_glue_points_;
|
||||
_CP_OPT(std::wstring) draw_type_;
|
||||
_CP_OPT(std::wstring) draw_modifiers_;
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) draw_text_areas_;
|
||||
_CP_OPT(std::wstring) draw_glue_points_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_vertical_;
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
|
||||
_CP_OPT(std::wstring) draw_sub_view_size_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_vertical_;
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
|
||||
_CP_OPT(std::wstring) draw_text_path_mode_;
|
||||
_CP_OPT(std::wstring) draw_text_path_scale_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
|
||||
_CP_OPT(std::wstring) draw_text_path_mode_;
|
||||
_CP_OPT(std::wstring) draw_text_path_scale_;
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
|
||||
@ -96,7 +96,7 @@ void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
|
||||
|
||||
impl_->comments_.push_back(state);
|
||||
impl_->comments_.back().elements_.push_back(elm);//"0" - root comment eleemnt
|
||||
impl_->comments_.back().oox_id = oox_id;
|
||||
impl_->comments_.back().oox_id = oox_id < 0 ? impl_->comments_.back().elements_.size() : oox_id;
|
||||
impl_->comments_.back().odf_name = L"comment_" + boost::lexical_cast<std::wstring>(oox_id);
|
||||
|
||||
impl_->comments_.back().is_started = false;
|
||||
@ -159,14 +159,14 @@ std::wstring odf_comment_context::find_name_by_id(int oox_id)
|
||||
}
|
||||
bool odf_comment_context::is_started()
|
||||
{
|
||||
if (impl_->comments_.size()>0)
|
||||
if (!impl_->comments_.empty())
|
||||
return impl_->comments_.back().is_started;
|
||||
else return false;
|
||||
|
||||
}
|
||||
void odf_comment_context::set_author(std::wstring author)
|
||||
{
|
||||
if ((impl_->comments_.size()<1) || !is_started()) return;
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"dc", L"creator", elm, impl_->odf_context_);
|
||||
@ -178,11 +178,15 @@ void odf_comment_context::set_author(std::wstring author)
|
||||
|
||||
impl_->comments_.back().elements_[0]->add_child_element(elm);
|
||||
impl_->comments_.back().elements_.push_back(elm);
|
||||
}
|
||||
void odf_comment_context::set_initials(std::wstring initials)
|
||||
{
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
}
|
||||
void odf_comment_context::set_date(std::wstring _date)
|
||||
{
|
||||
if ((impl_->comments_.size()<1) || !is_started()) return;
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"dc", L"date", elm, impl_->odf_context_);
|
||||
@ -195,5 +199,18 @@ void odf_comment_context::set_date(std::wstring _date)
|
||||
impl_->comments_.back().elements_[0]->add_child_element(elm);
|
||||
impl_->comments_.back().elements_.push_back(elm);
|
||||
}
|
||||
void odf_comment_context::set_position (double x, double y)
|
||||
{
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_annotation* comm = dynamic_cast<office_annotation*>(impl_->comments_.back().elements_.back().get());
|
||||
|
||||
if (comm)
|
||||
{
|
||||
comm->office_annotation_attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
|
||||
comm->office_annotation_attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -66,8 +66,11 @@ public:
|
||||
void start_comment_content ();
|
||||
void end_comment_content ();
|
||||
|
||||
void set_author (std::wstring author);
|
||||
void set_date (std::wstring author);
|
||||
void set_author (std::wstring author);
|
||||
void set_initials (std::wstring author);
|
||||
void set_date (std::wstring author);
|
||||
|
||||
void set_position (double x, double y);
|
||||
|
||||
private:
|
||||
std::wstring find_name_by_id(int oox_id);
|
||||
|
||||
@ -262,6 +262,7 @@ void odf_conversion_context::process_settings(_object & object, bool isRoot)
|
||||
void odf_conversion_context::process_styles(_object & object, bool isRoot)
|
||||
{
|
||||
create_element(L"office", L"styles", object.styles, this, true);//общие стили
|
||||
|
||||
object.style_context->process_office_styles(object.styles.back());
|
||||
page_layout_context()->process_office_styles(object.styles.back());
|
||||
|
||||
@ -288,7 +289,15 @@ office_element_ptr odf_conversion_context::start_tabs()
|
||||
create_element(L"style", L"tab-stops", temporary_.elm, this,true);
|
||||
return temporary_.elm;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
|
||||
{
|
||||
if (image_file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
|
||||
{
|
||||
if (!temporary_.elm) return;
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
virtual void start_text_context() = 0;
|
||||
virtual void end_text_context() = 0;
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name) = 0;
|
||||
std::wstring add_image(const std::wstring & image_file_name);
|
||||
|
||||
virtual odf_style_context * styles_context();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -52,6 +52,7 @@ namespace odf_writer
|
||||
class odf_conversion_context;
|
||||
class odf_style_context;
|
||||
class odf_text_context;
|
||||
class style_paragraph_properties;
|
||||
|
||||
class odf_drawing_context
|
||||
{
|
||||
@ -59,7 +60,8 @@ public:
|
||||
odf_drawing_context (odf_conversion_context *odf_context);
|
||||
~odf_drawing_context ();
|
||||
|
||||
void set_presentation (bool bMaster);
|
||||
void set_presentation (bool bMaster);
|
||||
_CP_OPT(bool) get_presentation ();
|
||||
|
||||
void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
|
||||
void clear ();
|
||||
@ -124,21 +126,24 @@ public:
|
||||
void start_frame ();
|
||||
void end_frame ();
|
||||
|
||||
bool change_text_box_2_wordart();
|
||||
|
||||
void start_image (std::wstring file_path);
|
||||
void start_image (std::wstring odf_file_path);
|
||||
void end_image ();
|
||||
|
||||
bool change_text_box_2_wordart ();
|
||||
bool is_wordart ();
|
||||
void set_paragraph_properties (style_paragraph_properties *paragraph_properties);
|
||||
|
||||
void start_text_box ();
|
||||
void set_text_box_min_size (bool val);
|
||||
void set_text_box_min_size (double w_pt, double h_pt);
|
||||
void set_text_box_parent_style (std::wstring style_name);
|
||||
void set_text_box_tableframe (bool val);
|
||||
void set_text_box_tableframe (bool val);
|
||||
void end_text_box ();
|
||||
|
||||
void start_object(std::wstring name);
|
||||
void end_object();
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
office_element_ptr & get_root_element();
|
||||
@ -149,8 +154,12 @@ public:
|
||||
bool is_exist_content();
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
void set_path (std::wstring path_string);
|
||||
void add_path_element (std::wstring command, const std::wstring & elm);
|
||||
void add_path_element (std::wstring command, std::wstring elm);
|
||||
void add_modifier (std::wstring modifier);
|
||||
void add_formula (std::wstring name, std::wstring fmla);
|
||||
void set_textarea (std::wstring l, std::wstring t, std::wstring r, std::wstring b);
|
||||
void add_handle (std::wstring x, std::wstring y, std::wstring refX, std::wstring refY,
|
||||
std::wstring minX, std::wstring maxX, std::wstring minY, std::wstring maxY);
|
||||
|
||||
void set_viewBox (double W, double H);
|
||||
|
||||
|
||||
@ -54,11 +54,12 @@ void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
|
||||
odf_context_ = Context;
|
||||
}
|
||||
|
||||
void odf_lists_styles_context::process_styles(office_element_ptr root )
|
||||
void odf_lists_styles_context::process_styles(office_element_ptr root, bool automatic)
|
||||
{
|
||||
for (size_t i = 0; i < lists_format_array_.size(); i++)
|
||||
{
|
||||
if (lists_format_array_[i].elements.size() < 1) continue;
|
||||
if (lists_format_array_[i].elements.size() < 1) continue;
|
||||
if (lists_format_array_[i].automatic != automatic) continue;
|
||||
|
||||
root->add_child_element(lists_format_array_[i].elements[0]);
|
||||
}
|
||||
@ -92,7 +93,13 @@ std::wstring odf_lists_styles_context::get_style_name1(int oox_style_num)
|
||||
}
|
||||
std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
|
||||
{
|
||||
if (link_format_map_.count(oox_style_num) > 0)
|
||||
if (lists_format_array_.empty()) return L"";
|
||||
|
||||
if (oox_style_num < 0)
|
||||
{
|
||||
return lists_format_array_.back().odf_list_style_name;
|
||||
}
|
||||
else if (link_format_map_.count(oox_style_num) > 0)
|
||||
{
|
||||
return link_format_map_.at(oox_style_num);
|
||||
}
|
||||
@ -101,7 +108,7 @@ std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
void odf_lists_styles_context::start_style(int based_number)
|
||||
void odf_lists_styles_context::start_style(bool bMaster, int based_number)
|
||||
{
|
||||
list_format_state state;
|
||||
|
||||
@ -109,21 +116,29 @@ void odf_lists_styles_context::start_style(int based_number)
|
||||
create_element(L"text", L"list-style", elm, odf_context_);
|
||||
state.elements.push_back(elm);
|
||||
|
||||
state.oox_based_number = based_number;
|
||||
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(based_number + 1);
|
||||
if (based_number < 0)
|
||||
{
|
||||
state.oox_based_number = lists_format_array_.size();
|
||||
state.odf_list_style_name = std::wstring(L"L") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
state.oox_based_number = based_number;
|
||||
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
|
||||
}
|
||||
state.automatic = !bMaster;
|
||||
|
||||
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
|
||||
if (style == NULL)return;
|
||||
|
||||
style->text_list_style_attr_.style_name_ = state.odf_list_style_name;
|
||||
|
||||
lists_format_array_.push_back(state); //перенести в end??
|
||||
}
|
||||
|
||||
style_list_level_properties * odf_lists_styles_context::get_list_level_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -156,8 +171,8 @@ style_list_level_properties * odf_lists_styles_context::get_list_level_propertie
|
||||
}
|
||||
style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -167,14 +182,14 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
if (style_number_)
|
||||
{
|
||||
if (!style_number_->style_text_properties_)
|
||||
create_element(L"style", L"text-properties",style_number_->style_text_properties_,odf_context_);
|
||||
create_element(L"style", L"text-properties", style_number_->style_text_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_text_properties *>(style_number_->style_text_properties_.get());
|
||||
}
|
||||
if (style_bullet_)
|
||||
{
|
||||
if (!style_bullet_->style_text_properties_)
|
||||
create_element(L"style", L"text-properties",style_bullet_->style_text_properties_,odf_context_);
|
||||
create_element(L"style", L"text-properties", style_bullet_->style_text_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_text_properties *>(style_bullet_->style_text_properties_.get());
|
||||
}
|
||||
@ -190,8 +205,8 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
|
||||
style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alignment_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -201,21 +216,21 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
|
||||
if (style_number_)
|
||||
{
|
||||
if (!style_number_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_number_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_number_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_number_->style_list_level_properties_.get());
|
||||
}
|
||||
if (style_bullet_)
|
||||
{
|
||||
if (!style_bullet_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_bullet_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_bullet_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_bullet_->style_list_level_properties_.get());
|
||||
}
|
||||
if (style_image_)
|
||||
{
|
||||
if (!style_image_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_image_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_image_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_image_->style_list_level_properties_.get());
|
||||
}
|
||||
@ -223,14 +238,15 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
|
||||
|
||||
if (!props->style_list_level_label_alignment_)
|
||||
{
|
||||
create_element(L"style", L"list-level-label-alignment" ,props->style_list_level_label_alignment_,odf_context_);
|
||||
create_element(L"style", L"list-level-label-alignment" , props->style_list_level_label_alignment_, odf_context_);
|
||||
}
|
||||
return dynamic_cast<style_list_level_label_alignment *>(props->style_list_level_label_alignment_.get());
|
||||
}
|
||||
|
||||
int odf_lists_styles_context::start_style_level(int level, int type)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return -1;
|
||||
if (lists_format_array_.empty()) return -1;
|
||||
|
||||
int odf_type =1;
|
||||
int format_type = -1;
|
||||
|
||||
@ -451,10 +467,10 @@ wchar_t convert_bullet_char(wchar_t c)
|
||||
}
|
||||
void odf_lists_styles_context::set_numeric_format(std::wstring val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if ( val.length() <1 )
|
||||
return;
|
||||
if ( lists_format_array_.empty() ) return;
|
||||
if ( lists_format_array_.back().elements.empty() ) return;
|
||||
|
||||
if ( val.empty() ) return;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
if (style_number_)
|
||||
@ -522,10 +538,10 @@ void odf_lists_styles_context::set_numeric_format(std::wstring val)
|
||||
}
|
||||
void odf_lists_styles_context::set_bullet_char(std::wstring val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if ( val.length() <1 )
|
||||
return;
|
||||
if ( lists_format_array_.empty() ) return;
|
||||
if ( lists_format_array_.back().elements.empty() ) return ;
|
||||
|
||||
if ( val.empty() ) return;
|
||||
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -536,20 +552,20 @@ void odf_lists_styles_context::set_bullet_char(std::wstring val)
|
||||
void odf_lists_styles_context::set_bullet_image_size(double size)
|
||||
{
|
||||
if (size < 0.1) return;
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
style_list_level_properties *props = get_list_level_properties();
|
||||
|
||||
if(!props) return;
|
||||
|
||||
props->fo_width_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
|
||||
props->fo_height_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
|
||||
props->fo_width_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
|
||||
props->fo_height_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
|
||||
}
|
||||
void odf_lists_styles_context::set_bullet_image (std::wstring ref)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_image *style_image_ = dynamic_cast<text_list_level_style_image *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -557,14 +573,14 @@ void odf_lists_styles_context::set_bullet_image (std::wstring ref)
|
||||
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.href_ = ref;
|
||||
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_= xlink_type::Simple;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
}
|
||||
void odf_lists_styles_context::set_start_number(int val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -574,8 +590,8 @@ void odf_lists_styles_context::set_start_number(int val)
|
||||
}
|
||||
void odf_lists_styles_context::set_text_style_name(std::wstring name)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -55,7 +55,7 @@ struct list_format_state
|
||||
std::vector<office_element_ptr> elements;
|
||||
|
||||
std::wstring odf_list_style_name;
|
||||
|
||||
bool automatic;
|
||||
};
|
||||
|
||||
class odf_lists_styles_context
|
||||
@ -64,7 +64,7 @@ public:
|
||||
odf_lists_styles_context();
|
||||
void set_odf_context(odf_conversion_context * Context);
|
||||
|
||||
void start_style(int abstract_number);
|
||||
void start_style(bool bMaster, int abstract_number = -1);
|
||||
int start_style_level(int level, int type);
|
||||
style_list_level_properties * get_list_level_properties();
|
||||
style_list_level_label_alignment * get_list_level_alignment_properties();
|
||||
@ -84,9 +84,9 @@ public:
|
||||
|
||||
void add_style(int oox_style_num, int oox_based_num);
|
||||
|
||||
void process_styles(office_element_ptr root );
|
||||
void process_styles(office_element_ptr root, bool automatic);
|
||||
|
||||
std::wstring get_style_name(int oox_style_num);
|
||||
std::wstring get_style_name(int oox_style_num = -1);
|
||||
std::wstring get_style_name1(int oox_style_num);
|
||||
private:
|
||||
std::vector<list_format_state> lists_format_array_;
|
||||
|
||||
@ -161,6 +161,7 @@ void odf_style_context::process_automatic_styles(office_element_ptr root )
|
||||
if (/*it->automatic_== true && */style_state_list_[i]->root_== false && style_state_list_[i]->odf_style_)
|
||||
root->add_child_element(style_state_list_[i]->odf_style_);
|
||||
}
|
||||
lists_styles_context_.process_styles(root, true);
|
||||
}
|
||||
|
||||
void odf_style_context::process_office_styles(office_element_ptr root )
|
||||
@ -175,7 +176,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
|
||||
root->add_child_element(style_state_list_[i]->odf_style_);
|
||||
}
|
||||
|
||||
lists_styles_context_.process_styles(root );
|
||||
lists_styles_context_.process_styles(root, false);
|
||||
}
|
||||
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
|
||||
{
|
||||
|
||||
@ -154,13 +154,35 @@ void odf_text_context::add_text_content(const std::wstring & text)
|
||||
std::wstring last = text.substr(pos);
|
||||
if (last.length() > 0)current_level_.back().elm->add_text(last);
|
||||
}
|
||||
void odf_text_context::add_text_date(const std::wstring & text)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"date", s_elm, odf_context_);
|
||||
|
||||
text_date* s = dynamic_cast<text_date*>(s_elm.get());
|
||||
if (s) s->add_text(text);
|
||||
|
||||
if (current_level_.size()>0)
|
||||
current_level_.back().elm->add_child_element(s_elm);
|
||||
}
|
||||
void odf_text_context::add_text_page_number(const std::wstring & text)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"page-number", s_elm, odf_context_);
|
||||
|
||||
text_page_number* s = dynamic_cast<text_page_number*>(s_elm.get());
|
||||
if (s) s->add_text(text);
|
||||
|
||||
if (current_level_.size()>0)
|
||||
current_level_.back().elm->add_child_element(s_elm);
|
||||
}
|
||||
void odf_text_context::add_text_space(int count)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"s", s_elm, odf_context_);
|
||||
|
||||
text_s* s = dynamic_cast<text_s*>(s_elm.get());
|
||||
if (s)s->text_c_ = count;
|
||||
if (s) s->text_c_ = count;
|
||||
|
||||
//необязательно хранить..
|
||||
//int level = current_level_.size();
|
||||
|
||||
@ -67,8 +67,10 @@ public:
|
||||
|
||||
void add_text_content (const std::wstring & text);
|
||||
void add_text_space (int count);
|
||||
|
||||
void set_symbol_font (const std::wstring & font);
|
||||
void add_text_date (const std::wstring & text);
|
||||
void add_text_page_number(const std::wstring & text);
|
||||
|
||||
void set_symbol_font (const std::wstring & font);
|
||||
void set_symbol_text (int sym);
|
||||
|
||||
void start_paragraph (bool styled = false);
|
||||
|
||||
@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
|
||||
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
odf_text_context* odp_conversion_context::text_context()
|
||||
{
|
||||
return text_context_;
|
||||
}
|
||||
odp_slide_context* odp_conversion_context::slide_context()
|
||||
{
|
||||
return &slide_context_;
|
||||
}
|
||||
odf_drawing_context* odp_conversion_context::drawing_context()
|
||||
{
|
||||
if (slide_context_.page_state_list_.empty()) return NULL;
|
||||
|
||||
return slide_context_.state().drawing_context();
|
||||
}
|
||||
odf_comment_context* odp_conversion_context::comment_context()
|
||||
{
|
||||
if (slide_context_.page_state_list_.empty()) return NULL;
|
||||
|
||||
return slide_context_.state().comment_context();
|
||||
}
|
||||
|
||||
void odp_conversion_context::start_document()
|
||||
{
|
||||
@ -128,13 +147,41 @@ void odp_conversion_context::end_drawings()
|
||||
{
|
||||
current_slide().drawing_context()->clear();
|
||||
}
|
||||
void odp_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
current_slide().drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
void odp_conversion_context::start_comment(int oox_comm_id)
|
||||
{
|
||||
office_element_ptr comm_elm;
|
||||
create_element(L"office", L"annotation", comm_elm, this);
|
||||
|
||||
current_slide().comment_context()->start_comment(comm_elm, oox_comm_id);
|
||||
|
||||
current_slide().drawing_context()->start_drawing();
|
||||
current_slide().drawing_context()->start_element(comm_elm);
|
||||
}
|
||||
void odp_conversion_context::start_comment_content()
|
||||
{
|
||||
current_slide().comment_context()->start_comment_content();
|
||||
|
||||
office_element_ptr & root_comm_element = current_slide().drawing_context()->get_current_element();
|
||||
start_text_context();
|
||||
|
||||
text_context()->start_element(root_comm_element);
|
||||
text_context()->start_paragraph();
|
||||
}
|
||||
void odp_conversion_context::end_comment_content()
|
||||
{
|
||||
text_context()->end_paragraph();
|
||||
|
||||
current_slide().comment_context()->end_comment_content();
|
||||
|
||||
text_context()->end_element();
|
||||
end_text_context();
|
||||
}
|
||||
void odp_conversion_context::end_comment()
|
||||
{
|
||||
current_slide().drawing_context()->end_element();
|
||||
current_slide().drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,14 +64,18 @@ public:
|
||||
virtual void start_text_context();
|
||||
virtual void end_text_context();
|
||||
|
||||
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
|
||||
virtual odf_text_context * text_context() {return text_context_; }
|
||||
odp_slide_context * slide_context() {return &slide_context_;}
|
||||
virtual odf_drawing_context * drawing_context();
|
||||
virtual odf_text_context * text_context();
|
||||
odp_slide_context * slide_context();
|
||||
odf_comment_context * comment_context();
|
||||
|
||||
void start_drawings();
|
||||
void end_drawings();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
void start_comment (int oox_comment_id);
|
||||
void end_comment ();
|
||||
void start_comment_content ();
|
||||
void end_comment_content ();
|
||||
|
||||
private:
|
||||
odp_slide_context slide_context_;
|
||||
|
||||
@ -58,7 +58,7 @@ namespace odf_writer {
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
|
||||
: context_(Context), drawing_context_(Context)
|
||||
: context_(Context), drawing_context_(Context), comment_context_(Context)
|
||||
{
|
||||
page_elm_ = elm;
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@
|
||||
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "odf_drawing_context.h"
|
||||
#include "odf_comment_context.h"
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_types
|
||||
@ -57,7 +57,6 @@ namespace odf_writer {
|
||||
class odp_conversion_context;
|
||||
class odf_text_context;
|
||||
|
||||
//class table_table;
|
||||
class style;
|
||||
|
||||
|
||||
@ -85,6 +84,7 @@ public:
|
||||
|
||||
///////////////////////////////
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
odf_comment_context * comment_context(){return &comment_context_;}
|
||||
|
||||
std::wstring office_page_name_;
|
||||
office_element_ptr page_elm_;
|
||||
@ -94,6 +94,7 @@ private:
|
||||
odf_conversion_context * context_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
odf_comment_context comment_context_;
|
||||
|
||||
friend class odp_slide_context;
|
||||
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
|
||||
odp_page_state & state();
|
||||
|
||||
odf_comment_context * comment_context();
|
||||
odf_table_context * table_context();
|
||||
|
||||
void start_table ();
|
||||
|
||||
@ -238,11 +238,11 @@ void ods_conversion_context::end_row()
|
||||
//////////////////////
|
||||
void ods_conversion_context::start_comment(int col, int row, std::wstring & author)
|
||||
{
|
||||
current_table().start_comment(col,row,author);
|
||||
current_table().start_comment(col, row, author);
|
||||
start_text_context();
|
||||
////////////////
|
||||
office_element_ptr paragr_elm;
|
||||
create_element(L"text", L"p",paragr_elm,this);
|
||||
create_element(L"text", L"p", paragr_elm, this);
|
||||
|
||||
current_text_context_->start_paragraph(paragr_elm);
|
||||
}
|
||||
@ -309,7 +309,7 @@ void ods_conversion_context::add_merge_cells(const std::wstring & ref)
|
||||
|
||||
void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
|
||||
{
|
||||
int col=0, row=0;
|
||||
int col = 0, row = 0;
|
||||
utils::parsing_ref ( ref, col,row);
|
||||
|
||||
if (col > current_table().current_column()+1)
|
||||
@ -389,11 +389,31 @@ void ods_conversion_context::start_rows()
|
||||
void ods_conversion_context::end_rows()
|
||||
{
|
||||
//add default last row
|
||||
int repeat = (std::max)(current_table().dimension_row,64) - current_table().current_row();
|
||||
if (repeat < 0) repeat = 1;
|
||||
int repeated = (std::max)(current_table().dimension_row, 64) - current_table().current_row();
|
||||
if (repeated < 0) repeated = 1;
|
||||
|
||||
start_row(current_table().current_row()+1,repeat,0,true);
|
||||
end_row();
|
||||
while(true)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int comment_idx = current_table().is_row_comment(current_table().current_row() + 1, repeated);
|
||||
|
||||
if (comment_idx < 0) break;
|
||||
int rows = current_table().comments_[comment_idx].row - current_table().current_row() - 1;
|
||||
|
||||
start_row(current_table().current_row() + 1, rows, 0, true);
|
||||
end_row();
|
||||
|
||||
start_row(current_table().current_row() + 1, 1, 0, true);
|
||||
end_row();
|
||||
|
||||
repeated -= (1 + rows);
|
||||
}
|
||||
|
||||
if (repeated > 0)
|
||||
{
|
||||
start_row(current_table().current_row() + 1, repeated, 0, true);
|
||||
end_row();
|
||||
}
|
||||
}
|
||||
|
||||
void ods_conversion_context::add_column(int start_column, int repeated, int level, bool _default)
|
||||
@ -507,14 +527,7 @@ void ods_conversion_context::end_drawings()
|
||||
{
|
||||
current_table().drawing_context()->clear();
|
||||
}
|
||||
void ods_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
current_table().drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
double ods_conversion_context::convert_symbol_width(double val)
|
||||
{
|
||||
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
|
||||
|
||||
@ -101,8 +101,6 @@ public:
|
||||
void start_drawings();
|
||||
void end_drawings();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
|
||||
double convert_symbol_width(double val);
|
||||
|
||||
void add_defined_range (const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);
|
||||
|
||||
@ -136,8 +136,8 @@ ods_table_state::ods_table_state(odf_conversion_context * Context, office_elemen
|
||||
{
|
||||
office_table_ = elm;
|
||||
|
||||
current_table_row_ =0;
|
||||
current_table_column_ =0;
|
||||
current_table_row_ = 0;
|
||||
current_table_column_ = 0;
|
||||
|
||||
current_level_.push_back(office_table_);
|
||||
|
||||
@ -395,7 +395,7 @@ bool ods_table_state::is_cell_hyperlink()
|
||||
bool ods_table_state::is_cell_comment()
|
||||
{
|
||||
if (cells_size_ <1)return false;
|
||||
return cells_.back().comment_idx >=0 ? true : false;
|
||||
return cells_.back().comment_idx >= 0 ? true : false;
|
||||
}
|
||||
|
||||
int ods_table_state::is_cell_hyperlink(int col, int row)
|
||||
@ -413,7 +413,18 @@ int ods_table_state::is_cell_comment(int col, int row, short repeate_col)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if ((comments_[i].col < col+repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int ods_table_state::is_row_comment(int row, int repeate_row)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -489,10 +500,10 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
|
||||
|
||||
state.empty = true;
|
||||
state.elm = elm; state.repeated = 1; state.style_name = style_name; state.style_elm = style_elm;
|
||||
state.row=current_table_row_; state.col =current_table_column_+1;
|
||||
state.row = current_table_row_; state.col =current_table_column_ + 1;
|
||||
|
||||
state.hyperlink_idx = is_cell_hyperlink(state.col, state.row);
|
||||
state.comment_idx = is_cell_comment(state.col, state.row);
|
||||
state.comment_idx = is_cell_comment(state.col, state.row);
|
||||
|
||||
current_table_column_ += state.repeated;
|
||||
cells_.push_back(state);
|
||||
@ -1016,8 +1027,8 @@ void ods_table_state::end_cell()
|
||||
|
||||
void ods_table_state::add_default_cell( short repeated)
|
||||
{
|
||||
int comment_idx = is_cell_comment(current_table_column_+1 , current_table_row_, repeated);
|
||||
if (comment_idx >=0 && repeated >1)
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1 , current_table_row_, repeated);
|
||||
if (comment_idx >= 0 && repeated > 1)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int c = current_table_column_;
|
||||
|
||||
@ -300,6 +300,7 @@ public:
|
||||
int is_cell_hyperlink (int col, int row);
|
||||
bool is_cell_comment ();
|
||||
int is_cell_comment (int col, int row, short repeate_col = 1);
|
||||
int is_row_comment (int row, int repeate_row = 1);
|
||||
|
||||
ods_hyperlink_state & current_hyperlink();
|
||||
|
||||
@ -316,7 +317,8 @@ public:
|
||||
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
|
||||
std::wstring office_table_name_;
|
||||
std::wstring office_table_name_;
|
||||
std::vector<ods_comment_state> comments_;
|
||||
private:
|
||||
|
||||
odf_conversion_context * context_;
|
||||
@ -342,9 +344,7 @@ private:
|
||||
std::list<ods_cell_state> cells_;
|
||||
long cells_size_;
|
||||
|
||||
std::vector<ods_hyperlink_state> hyperlinks_;
|
||||
std::vector<ods_comment_state> comments_;
|
||||
|
||||
std::vector<ods_hyperlink_state> hyperlinks_;
|
||||
std::vector<ods_shared_formula_state> shared_formulas_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
|
||||
@ -163,6 +163,11 @@ odf_table_context* odt_conversion_context::table_context()
|
||||
{
|
||||
return &table_context_;
|
||||
}
|
||||
|
||||
odf_notes_context* odt_conversion_context::notes_context()
|
||||
{
|
||||
return ¬es_context_;
|
||||
}
|
||||
|
||||
odf_text_context* odt_conversion_context::text_context()
|
||||
{
|
||||
@ -266,8 +271,11 @@ void odt_conversion_context::end_drawings()
|
||||
}
|
||||
else
|
||||
{
|
||||
text_context()->start_element(elm);
|
||||
text_context()->end_element();
|
||||
if (elm)
|
||||
{
|
||||
text_context()->start_element(elm);
|
||||
text_context()->end_element();
|
||||
}
|
||||
|
||||
drawing_context()->clear();
|
||||
drawing_context_.pop_back();
|
||||
@ -915,14 +923,6 @@ void odt_conversion_context::end_change (int id, int type)
|
||||
// return (text_changes_state_.current_types.back() == 2);
|
||||
//}
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void odt_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name, _mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
|
||||
void odt_conversion_context::start_drop_cap(style_paragraph_properties *paragraph_properties)
|
||||
{
|
||||
|
||||
@ -79,11 +79,11 @@ public:
|
||||
odf_comment_context * comment_context();
|
||||
odf_table_context * table_context();
|
||||
|
||||
odf_notes_context * notes_context();
|
||||
void start_drawings ();
|
||||
void end_drawings ();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
void add_text_content (const std::wstring & text);
|
||||
void add_text_content (const std::wstring & text);
|
||||
|
||||
void start_paragraph (bool styled = false);
|
||||
void end_paragraph ();
|
||||
|
||||
@ -50,6 +50,12 @@
|
||||
namespace cpdoccore
|
||||
{
|
||||
|
||||
oox_shape::oox_shape()
|
||||
{
|
||||
odf_type_name = L"ooxml-non-primitive";
|
||||
view_box = L"0 0 0 0";
|
||||
}
|
||||
|
||||
oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
{
|
||||
switch (ooxPrstGeomType)
|
||||
@ -127,7 +133,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
|
||||
default:
|
||||
if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>();
|
||||
else return boost::make_shared<oox_shape>();
|
||||
else return oox_shape_ptr();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,8 @@ namespace cpdoccore
|
||||
public:
|
||||
static oox_shape_ptr create(int ooxPrstGeomType);
|
||||
|
||||
oox_shape();
|
||||
|
||||
struct _equation
|
||||
{
|
||||
std::wstring name;
|
||||
@ -66,20 +68,20 @@ namespace cpdoccore
|
||||
|
||||
void add(std::wstring name,std::wstring frmla)
|
||||
{
|
||||
_equation q = {name,frmla};
|
||||
_equation q = {name, frmla};
|
||||
equations.push_back(q);
|
||||
}
|
||||
|
||||
std::vector<_equation> equations;
|
||||
std::vector<_handle> handles;
|
||||
std::vector<_equation> equations;
|
||||
std::vector<_handle> handles;
|
||||
|
||||
std::wstring enhanced_path;
|
||||
std::wstring modifiers;
|
||||
std::wstring text_areas;
|
||||
std::wstring view_box;
|
||||
std::wstring enhanced_path;
|
||||
std::wstring modifiers;
|
||||
std::wstring text_areas;
|
||||
std::wstring view_box;
|
||||
_CP_OPT(std::wstring) sub_view_size;
|
||||
_CP_OPT(std::wstring) glue_points;
|
||||
|
||||
std::wstring odf_type_name;
|
||||
|
||||
_CP_OPT(std::wstring) glue_points;
|
||||
std::wstring odf_type_name;
|
||||
};
|
||||
};
|
||||
@ -207,6 +207,8 @@ void text_list::create_child_element(const std::wstring & Ns, const std::wstring
|
||||
}
|
||||
void text_list::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextListHeader)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
|
||||
}
|
||||
//m_oPreferRelative//типо можно менять размер
|
||||
|
||||
for (unsigned int i=0 ; i < vml_shape_type->m_arrItems.size();i++)
|
||||
for (size_t i = 0; i < vml_shape_type->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(vml_shape_type->m_arrItems[i]);
|
||||
}
|
||||
@ -86,6 +86,18 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
|
||||
//m_arrItems
|
||||
//CVmlCommonElements
|
||||
}
|
||||
void OoxConverter::convert(OOX::Vml::CFormulas *vml_formulas)
|
||||
{
|
||||
if (vml_formulas == NULL) return;
|
||||
|
||||
for (size_t i = 0; i < vml_formulas->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(vml_formulas->m_arrItems[i]);
|
||||
if (cf == NULL) continue;
|
||||
|
||||
//odf_context()->drawing_context()->add_formula(L"", cf->m_sEqn);
|
||||
}
|
||||
}
|
||||
|
||||
void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
|
||||
{
|
||||
@ -95,7 +107,7 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
|
||||
|
||||
_CP_OPT(int) anchor_type_x, anchor_type_y;
|
||||
|
||||
for (unsigned int i=0; i < vml_style->m_arrProperties.size(); i++)
|
||||
for (size_t i = 0; i < vml_style->m_arrProperties.size(); i++)
|
||||
{
|
||||
if (vml_style->m_arrProperties[i] == NULL) continue;
|
||||
|
||||
@ -693,17 +705,18 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
|
||||
odf_context()->drawing_context()->set_textarea_wrap(true);
|
||||
|
||||
DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
|
||||
|
||||
odf_context()->start_text_context();
|
||||
if (docx_converter)
|
||||
{
|
||||
for (unsigned int i=0 ; i < vml_textbox->m_oTxtbxContent->m_arrItems.size();i++)
|
||||
odf_context()->start_text_context();
|
||||
{
|
||||
if (docx_converter)
|
||||
for (size_t i = 0; i < vml_textbox->m_oTxtbxContent->m_arrItems.size(); i++)
|
||||
{
|
||||
docx_converter->convert(vml_textbox->m_oTxtbxContent->m_arrItems[i]);
|
||||
}
|
||||
odf_context()->drawing_context()->set_text( odf_context()->text_context());
|
||||
}
|
||||
odf_context()->drawing_context()->set_text( odf_context()->text_context());
|
||||
odf_context()->end_text_context();
|
||||
}
|
||||
odf_context()->end_text_context();
|
||||
|
||||
}
|
||||
void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
|
||||
@ -869,7 +882,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
for (unsigned int i=0 ; i < vml_common->m_arrItems.size();i++)
|
||||
for (size_t i = 0; i < vml_common->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(vml_common->m_arrItems[i]);
|
||||
}
|
||||
@ -899,7 +912,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
|
||||
odf_context()->drawing_context()->set_group_shift(vml_group->m_oCoordOrigin->GetX(), vml_group->m_oCoordOrigin->GetY());
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i < vml_group->m_arrItems.size(); i++)
|
||||
for (size_t i = 0; i < vml_group->m_arrItems.size(); i++)
|
||||
{
|
||||
if (vml_group->m_arrItems[i] == NULL) continue;
|
||||
|
||||
|
||||
@ -130,6 +130,8 @@ bool OoxConverter::UpdateProgress(long nComplete)
|
||||
|
||||
void OoxConverter::set_fonts_directory(const std::wstring &fontsPath)
|
||||
{
|
||||
if (odf_context() == NULL) return;
|
||||
|
||||
odf_context()->set_fonts_directory(fontsPath);
|
||||
}
|
||||
|
||||
@ -143,18 +145,15 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
case OOX::et_graphicFrame:
|
||||
{
|
||||
PPTX::Logic::GraphicFrame* pGraphicFrame= dynamic_cast<PPTX::Logic::GraphicFrame*>(oox_unknown);
|
||||
convert(pGraphicFrame);
|
||||
convert(dynamic_cast<PPTX::Logic::GraphicFrame*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_pic:
|
||||
{
|
||||
PPTX::Logic::Pic* pPic= dynamic_cast<PPTX::Logic::Pic*>(oox_unknown);
|
||||
convert(pPic);
|
||||
convert(dynamic_cast<PPTX::Logic::Pic*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_dgm_DiagrammParts:
|
||||
{
|
||||
PPTX::Logic::SmartArt* pDiagrammParts = dynamic_cast<PPTX::Logic::SmartArt*>(oox_unknown);
|
||||
convert(pDiagrammParts);
|
||||
convert(dynamic_cast<PPTX::Logic::SmartArt*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_Shape:
|
||||
case OOX::et_p_Shape:
|
||||
@ -181,6 +180,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ahXY:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::AhXY*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ahPolar:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::AhPolar*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_lnTo:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown));
|
||||
@ -258,18 +265,19 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
case OOX::et_v_fill:
|
||||
{
|
||||
OOX::Vml::CFill *vml = dynamic_cast<OOX::Vml::CFill*>(oox_unknown);
|
||||
convert(vml);
|
||||
convert(dynamic_cast<OOX::Vml::CFill*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_v_stroke:
|
||||
{
|
||||
OOX::Vml::CStroke *vml = dynamic_cast<OOX::Vml::CStroke*>(oox_unknown);
|
||||
convert(vml);
|
||||
convert(dynamic_cast<OOX::Vml::CStroke*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_v_formulas:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Vml::CFormulas*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_v_shadow:
|
||||
{
|
||||
OOX::Vml::CShadow *vml = dynamic_cast<OOX::Vml::CShadow*>(oox_unknown);
|
||||
convert(vml);
|
||||
convert(dynamic_cast<OOX::Vml::CShadow*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_v_image:
|
||||
{
|
||||
|
||||
@ -245,6 +245,7 @@ namespace OOX
|
||||
class CTextPath;
|
||||
class CGroup;
|
||||
class CVmlCommonElements;
|
||||
class CFormulas;
|
||||
}
|
||||
namespace VmlWord
|
||||
{
|
||||
@ -263,6 +264,7 @@ namespace PPTX
|
||||
class Theme;
|
||||
namespace Logic
|
||||
{
|
||||
class Bullet;
|
||||
class ClrMap;
|
||||
class SpTreeElem;
|
||||
class GraphicFrame;
|
||||
@ -322,6 +324,8 @@ namespace PPTX
|
||||
class InnerShdw;
|
||||
class OuterShdw;
|
||||
class PrstShdw;
|
||||
class AhXY;
|
||||
class AhPolar;
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,10 +355,11 @@ public:
|
||||
double getSystemDPI();
|
||||
|
||||
//.......................................................................................................................
|
||||
virtual OOX::IFileContainer *current_document() = 0;
|
||||
virtual cpdoccore::odf_writer::odf_conversion_context *odf_context() = 0;
|
||||
virtual PPTX::Theme *oox_theme() = 0;
|
||||
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
|
||||
|
||||
|
||||
virtual std::wstring find_link_by_id(std::wstring sId, int t) = 0;
|
||||
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId) = 0;
|
||||
|
||||
@ -362,6 +367,7 @@ public:
|
||||
|
||||
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
|
||||
bool convert (std::wstring sSchemeColor, DWORD & argb);
|
||||
void convert_font(PPTX::Theme *theme, std::wstring & font);
|
||||
//.......................................................................................................................
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
//drawingML & pptx................................................................................................................................
|
||||
@ -390,6 +396,7 @@ public:
|
||||
void convert(PPTX::Logic::PathBase *oox_path);
|
||||
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
|
||||
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
|
||||
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
|
||||
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
|
||||
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
|
||||
@ -399,10 +406,16 @@ public:
|
||||
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::NvPr *oox_nvPr);
|
||||
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
|
||||
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
|
||||
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties);
|
||||
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style);
|
||||
|
||||
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
|
||||
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::Run *oox_run);
|
||||
void convert(PPTX::Logic::Fld *oox_fld);
|
||||
void convert(PPTX::Logic::Br *oox_br);
|
||||
@ -417,6 +430,8 @@ public:
|
||||
void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
|
||||
void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
|
||||
void convert(PPTX::Logic::Close *oox_geom_path);
|
||||
void convert(PPTX::Logic::AhXY *oox_handle);
|
||||
void convert(PPTX::Logic::AhPolar *oox_handle);
|
||||
void convert(PPTX::Logic::EffectStyle *oox_effect);
|
||||
void convert(PPTX::Logic::EffectLst *oox_effect_list);
|
||||
void convert(PPTX::Logic::InnerShdw *oox_effect);
|
||||
@ -497,6 +512,7 @@ public:
|
||||
void convert(OOX::VmlWord::CWrap *vml_wrap);
|
||||
void convert(OOX::Vml::CGroup *vml_group);
|
||||
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
|
||||
void convert(OOX::Vml::CFormulas *vml_formulas);
|
||||
};
|
||||
|
||||
} // namespace Oox2Odf
|
||||
|
||||
@ -103,7 +103,16 @@ PPTX::Theme* DocxConverter::oox_theme()
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OOX::IFileContainer* DocxConverter::current_document()
|
||||
{
|
||||
if (oox_current_child_document)
|
||||
return oox_current_child_document;
|
||||
else
|
||||
{
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
return dynamic_cast<OOX::IFileContainer*>(oox_doc);
|
||||
}
|
||||
}
|
||||
NSCommon::smart_ptr<OOX::File> DocxConverter::find_file_by_id(std::wstring sId)
|
||||
{
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
@ -317,16 +326,16 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
// OOX::Logic::CShape* pShape = dynamic_cast<OOX::Logic::CShape*>(oox_unknown);
|
||||
// convert(pShape);
|
||||
//}break;
|
||||
//case OOX::et_w_pict:
|
||||
//{
|
||||
// OOX::Logic::CPicture* pPic = dynamic_cast<OOX::Logic::CPicture*>(oox_unknown);
|
||||
// convert(pPic);
|
||||
//}break;
|
||||
//case OOX::et_w_object:
|
||||
//{
|
||||
// OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
|
||||
// convert(pObj);
|
||||
//}break;
|
||||
case OOX::et_w_pict:
|
||||
{
|
||||
OOX::Logic::CPicture* pPic = dynamic_cast<OOX::Logic::CPicture*>(oox_unknown);
|
||||
convert(pPic);
|
||||
}break;
|
||||
case OOX::et_w_object:
|
||||
{
|
||||
OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
|
||||
convert(pObj);
|
||||
}break;
|
||||
case OOX::et_pic_pic:
|
||||
case OOX::et_pic:
|
||||
case OOX::et_p_pic:
|
||||
@ -353,23 +362,27 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
case OOX::et_w_commentReference:
|
||||
{
|
||||
OOX::Logic::CCommentReference* pCommRef = dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown);
|
||||
convert(pCommRef); //если нет Start - означает начало с предыдущего Run
|
||||
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown)); //если нет Start - означает начало с предыдущего Run
|
||||
}break;
|
||||
case OOX::et_w_footnoteReference:
|
||||
{
|
||||
OOX::Logic::CFootnoteReference* pRef= dynamic_cast<OOX::Logic::CFootnoteReference*>(oox_unknown);
|
||||
convert(pRef);
|
||||
convert(dynamic_cast<OOX::Logic::CFootnoteReference*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_endnoteReference:
|
||||
{
|
||||
OOX::Logic::CEndnoteReference* pRef= dynamic_cast<OOX::Logic::CEndnoteReference*>(oox_unknown);
|
||||
convert(pRef);
|
||||
convert(dynamic_cast<OOX::Logic::CEndnoteReference*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_endnoteRef:
|
||||
{
|
||||
//add ref ??? todoooo
|
||||
}break;
|
||||
case OOX::et_w_footnoteRef:
|
||||
{
|
||||
//add ref
|
||||
}break;
|
||||
case OOX::et_w_tbl:
|
||||
{
|
||||
OOX::Logic::CTbl* pTable= dynamic_cast<OOX::Logic::CTbl*>(oox_unknown);
|
||||
convert(pTable);
|
||||
convert(dynamic_cast<OOX::Logic::CTbl*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_tr:
|
||||
{
|
||||
@ -381,6 +394,12 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
OOX::Logic::CTc* pCell= dynamic_cast<OOX::Logic::CTc*>(oox_unknown);
|
||||
convert(pCell);
|
||||
}break;
|
||||
case OOX::et_w_bookmarkStart:
|
||||
{
|
||||
}break;
|
||||
case OOX::et_w_bookmarkEnd:
|
||||
{
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
OoxConverter::convert(oox_unknown);
|
||||
@ -394,12 +413,15 @@ void DocxConverter::convert(OOX::Logic::CSdt *oox_sdt)
|
||||
//nullable<OOX::Logic::CSdtEndPr > m_oSdtEndPr;
|
||||
//nullable<OOX::Logic::CSdtPr > m_oSdtPr;
|
||||
|
||||
if (oox_sdt->m_oSdtContent.IsInit())
|
||||
convert(oox_sdt->m_oSdtContent.GetPointer());
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
|
||||
{
|
||||
if (oox_sdt == NULL) return;
|
||||
|
||||
for (size_t i = 0; i < oox_sdt->m_arrItems.size(); i++)
|
||||
{
|
||||
for (unsigned int i=0; i< oox_sdt->m_oSdtContent->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(oox_sdt->m_oSdtContent->m_arrItems[i]);
|
||||
}
|
||||
convert(oox_sdt->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
@ -1271,6 +1293,15 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
|
||||
}
|
||||
|
||||
if (odt_context->notes_context()->is_started())
|
||||
{
|
||||
paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.5, odf_types::length::cm);
|
||||
paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.5, odf_types::length::cm);
|
||||
paragraph_properties->content_.fo_line_height_ = odf_types::percent(100.);
|
||||
paragraph_properties->content_.style_auto_text_indent_ = false;
|
||||
//loext:contextual-spacing="false"
|
||||
}
|
||||
|
||||
if (oox_paragraph_pr->m_oTabs.IsInit())
|
||||
{
|
||||
paragraph_properties->add_child_element(odf_context()->start_tabs());
|
||||
@ -2692,9 +2723,12 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
|
||||
int id = oox_anchor->m_oRelativeHeight->GetValue();
|
||||
odf_context()->drawing_context()->set_z_order(id);
|
||||
}
|
||||
|
||||
OoxConverter::convert(oox_anchor->m_oDocPr.GetPointer());
|
||||
|
||||
convert(&oox_anchor->m_oGraphic);
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
OoxConverter::convert(&oox_anchor->m_oGraphic);
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
|
||||
odf_context()->drawing_context()->check_anchor();
|
||||
}
|
||||
@ -2724,9 +2758,12 @@ void DocxConverter::convert(OOX::Drawing::CInline *oox_inline)
|
||||
|
||||
odt_context->drawing_context()->set_vertical_rel(2);//line
|
||||
odt_context->drawing_context()->set_vertical_pos(1);//middle
|
||||
|
||||
|
||||
OoxConverter::convert(oox_inline->m_oDocPr.GetPointer());
|
||||
convert(&oox_inline->m_oGraphic);
|
||||
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
OoxConverter::convert(&oox_inline->m_oGraphic);
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
@ -2781,11 +2818,19 @@ void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types
|
||||
if (!color)return;
|
||||
convert(color->m_oVal.GetPointer(), color->m_oThemeColor.GetPointer(),color->m_oThemeTint.GetPointer(),color->m_oThemeShade.GetPointer(), odf_color);
|
||||
}
|
||||
PPTX::Logic::ClrMap* DocxConverter::oox_clrMap()
|
||||
{
|
||||
//return current_clrMap; todoooo
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
if (!docx_settings) return NULL;
|
||||
|
||||
return docx_settings->m_oClrSchemeMapping.GetPointer();
|
||||
}
|
||||
void DocxConverter::convert_settings()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
if (!docx_settings) return;
|
||||
|
||||
if (docx_settings->m_oZoom.IsInit())
|
||||
@ -3017,7 +3062,7 @@ void DocxConverter::convert(OOX::Numbering::CAbstractNum* oox_num_style)
|
||||
if (oox_num_style->m_oAbstractNumId.IsInit() == false) return;
|
||||
|
||||
|
||||
odt_context->styles_context()->lists_styles().start_style(oox_num_style->m_oAbstractNumId->GetValue());
|
||||
odt_context->styles_context()->lists_styles().start_style(true, oox_num_style->m_oAbstractNumId->GetValue());
|
||||
//// Childs
|
||||
//std::vector<OOX::Numbering::CLvl > m_arrLvl;
|
||||
//nullable<ComplexTypes::Word::CMultiLevelType > m_oMultiLevelType;
|
||||
@ -3049,7 +3094,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
int type_list = odt_context->styles_context()->lists_styles().start_style_level(oox_num_lvl->m_oIlvl->GetValue(), oox_type_list );
|
||||
if (type_list < 0) return;
|
||||
|
||||
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
|
||||
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
|
||||
odf_writer::style_list_level_label_alignment * aligment_props = odt_context->styles_context()->lists_styles().get_list_level_alignment_properties();
|
||||
|
||||
if (level_props == NULL)return;
|
||||
@ -3101,8 +3146,8 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
}
|
||||
}else
|
||||
{
|
||||
aligment_props->fo_text_indent_ = odf_types::length(0,odf_types::length::cm);
|
||||
aligment_props->fo_margin_left_ = odf_types::length(0,odf_types::length::cm);
|
||||
aligment_props->fo_text_indent_ = odf_types::length(0, odf_types::length::cm);
|
||||
aligment_props->fo_margin_left_ = odf_types::length(0, odf_types::length::cm);
|
||||
|
||||
}
|
||||
}
|
||||
@ -3114,7 +3159,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
convert(oox_num_lvl->m_oRPr.GetPointer(), text_props);
|
||||
|
||||
//create text style for symbols list НА ЛОКАЛЬНОМ контексте - иначе пересечение имен стилей (todoo вытащить генерацию имен в общую часть)
|
||||
styles_context->create_style(L"",odf_types::style_family::Text, false, true, -1);
|
||||
styles_context->create_style(L"", odf_types::style_family::Text, false, true, -1);
|
||||
odf_writer::odf_style_state_ptr style_state = styles_context->last_state(odf_types::style_family::Text);
|
||||
if (style_state)
|
||||
{
|
||||
@ -3184,7 +3229,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
|
||||
}
|
||||
if (type_list == 2 || type_list == 3)
|
||||
{
|
||||
odt_context->styles_context()->lists_styles().set_bullet_image_size(size_bullet_number_marker);
|
||||
}
|
||||
|
||||
if (oox_num_lvl->m_oLvlRestart.IsInit() && oox_num_lvl->m_oLvlRestart->m_oVal.IsInit() && type_list == 1)
|
||||
{
|
||||
@ -3392,7 +3439,7 @@ void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start)
|
||||
|
||||
bool added = odt_context->start_comment(oox_comm_id);
|
||||
|
||||
if (added==false)
|
||||
if (added == false)
|
||||
{
|
||||
convert_comment(oox_comm_id);
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@ namespace OOX
|
||||
class CTcBorders;
|
||||
class CTblBorders;
|
||||
class CSdt;
|
||||
class CSdtContent;
|
||||
class CBackground;
|
||||
class CLockedCanvas;
|
||||
|
||||
@ -146,12 +147,15 @@ namespace Oox2Odf
|
||||
virtual void convertDocument();
|
||||
virtual void write(const std::wstring & path);
|
||||
|
||||
virtual OOX::IFileContainer *current_document();
|
||||
virtual odf_writer::odf_conversion_context *odf_context();
|
||||
virtual PPTX::Theme *oox_theme();
|
||||
virtual PPTX::Logic::ClrMap *oox_clrMap();
|
||||
virtual std::wstring find_link_by_id (std::wstring sId, int t);
|
||||
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId);
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
void convert(OOX::Logic::CSdtContent *oox_sdt);
|
||||
private:
|
||||
struct _section
|
||||
{
|
||||
@ -220,7 +224,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::Drawing::CAnchor *oox_anchor);
|
||||
void convert(OOX::Drawing::CInline *oox_inline);
|
||||
|
||||
|
||||
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
|
||||
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length) & odf_size);
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@ -59,7 +60,18 @@ namespace Oox2Odf
|
||||
{
|
||||
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
{
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
current_clrMap = NULL;
|
||||
current_slide = NULL;
|
||||
current_theme = NULL;
|
||||
current_tableStyles = NULL;
|
||||
|
||||
presentation = NULL;
|
||||
output_document = NULL;
|
||||
odp_context = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
pptx_document = new PPTX::Folder();
|
||||
if (!pptx_document->isValid(oox_path.GetPath())) // true ???
|
||||
@ -81,13 +93,6 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
|
||||
output_document = new odf_writer::package::odf_document(L"presentation");
|
||||
odp_context = new odf_writer::odp_conversion_context(output_document);
|
||||
|
||||
current_clrMap = NULL;
|
||||
current_slide = NULL;
|
||||
current_theme = NULL;
|
||||
current_tableStyles = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
if (UpdateProgress(290000))return;
|
||||
}
|
||||
PptxConverter::~PptxConverter()
|
||||
@ -122,7 +127,15 @@ PPTX::Logic::ClrMap* PptxConverter::oox_clrMap()
|
||||
{
|
||||
return current_clrMap;
|
||||
}
|
||||
|
||||
OOX::IFileContainer* PptxConverter::current_document()
|
||||
{
|
||||
if (oox_current_child_document)
|
||||
return oox_current_child_document;
|
||||
else if (current_slide)
|
||||
return current_slide;
|
||||
else
|
||||
return pptx_document;
|
||||
}
|
||||
NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile;
|
||||
@ -218,21 +231,20 @@ void PptxConverter::convert_styles()
|
||||
odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
|
||||
|
||||
if (text_properties)
|
||||
if (presentation->defaultTextStyle.IsInit())
|
||||
{
|
||||
text_properties->content_.fo_font_size_ = odf_types::font_size(odf_types::length(18, odf_types::length::pt));
|
||||
}
|
||||
|
||||
if (slide->theme.IsInit() && text_properties)
|
||||
{
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.latin.typeface.empty() == false)
|
||||
text_properties->content_.fo_font_family_ = slide->theme->themeElements.fontScheme.majorFont.latin.typeface;
|
||||
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.cs.typeface.empty() == false)
|
||||
text_properties->content_.style_font_family_complex_ = slide->theme->themeElements.fontScheme.majorFont.cs.typeface;
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[9].GetPointer(), paragraph_properties, text_properties); //defPPr
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false)
|
||||
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface;
|
||||
odp_context->styles_context()->create_default_style(odf_types::style_family::Paragraph);
|
||||
paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
|
||||
odp_context->styles_context()->create_default_style(odf_types::style_family::Text);
|
||||
text_properties = odp_context->styles_context()->last_state()->get_text_properties();
|
||||
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
}
|
||||
//convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
|
||||
|
||||
@ -259,6 +271,8 @@ void PptxConverter::convert_styles()
|
||||
odp_context->page_layout_context()->create_layer_sets();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PptxConverter::convert_settings()
|
||||
{
|
||||
|
||||
@ -294,24 +308,38 @@ void PptxConverter::convert_slides()
|
||||
{
|
||||
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
|
||||
}
|
||||
|
||||
current_theme = slide->theme.operator->();
|
||||
current_clrMap = NULL;
|
||||
|
||||
std::wstring master_style_name;
|
||||
std::wstring layout_style_name;
|
||||
|
||||
bool bShow = slide->show.get_value_or(true);
|
||||
bool bShowMasterAnim = slide->showMasterPhAnim.get_value_or(true);
|
||||
bool bShowMasterSp = slide->showMasterSp.get_value_or(true);
|
||||
|
||||
PPTX::Logic::TxStyles* current_txStyles = NULL;
|
||||
if (slide->Master.IsInit())
|
||||
{
|
||||
current_clrMap = &slide->Master->clrMap;
|
||||
current_clrMap = &slide->Master->clrMap;
|
||||
current_txStyles = slide->Master->txStyles.GetPointer();
|
||||
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename);
|
||||
std::wstring master_name = (bShowMasterSp ? slide->Master->m_sOutputFilename : L"") + slide->Layout->m_sOutputFilename;
|
||||
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(master_name);
|
||||
if (pFind == m_mapMasters.end())
|
||||
{
|
||||
master_style_name = L"MasterPage";
|
||||
|
||||
bool bShowLayoutMasterAnim = slide->Layout->showMasterPhAnim.get_value_or(true);
|
||||
bool bShowLayoutMasterSp = slide->Layout->showMasterSp.get_value_or(true);
|
||||
|
||||
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
|
||||
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
|
||||
|
||||
|
||||
master_style_name += L"_" ;
|
||||
|
||||
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get();
|
||||
else if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
|
||||
else
|
||||
@ -319,18 +347,23 @@ void PptxConverter::convert_slides()
|
||||
|
||||
odp_context->start_master_slide(master_style_name);
|
||||
convert_common();
|
||||
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
|
||||
{
|
||||
current_slide = slide->Master.operator->();
|
||||
convert_slide(&slide->Master->cSld, false);
|
||||
}
|
||||
|
||||
current_slide = slide->Master.operator->();
|
||||
|
||||
if (bShowLayoutMasterSp && bShowMasterSp)
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true);
|
||||
else
|
||||
convert(slide->Master->cSld.bg.GetPointer());
|
||||
|
||||
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
|
||||
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
current_slide = slide->Layout.operator->();
|
||||
convert_slide(&slide->Layout->cSld, true);
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
|
||||
//add note master
|
||||
odp_context->end_master_slide();
|
||||
|
||||
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name));
|
||||
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -365,23 +398,22 @@ void PptxConverter::convert_slides()
|
||||
|
||||
odp_context->current_slide().set_master_page (master_style_name);
|
||||
odp_context->current_slide().set_layout_page (layout_style_name);
|
||||
//nullable_bool show;
|
||||
//nullable_bool showMasterPhAnim;
|
||||
//nullable_bool showMasterSp;
|
||||
|
||||
convert_slide(slide->cSld.GetPointer(), true);
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
|
||||
convert (slide->comments.operator->());
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
convert (slide->timing.GetPointer(), slide->transition.GetPointer());
|
||||
|
||||
|
||||
//nullable<Logic::Transition> transition;
|
||||
//nullable<Logic::Timing> timing;
|
||||
|
||||
//smart_ptr<NotesSlide> Note;
|
||||
|
||||
//smart_ptr<PPTX::Comments> comments;
|
||||
|
||||
odp_context->end_slide();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::NotesSlide *oox_note)
|
||||
{
|
||||
if (!oox_note) return;
|
||||
}
|
||||
|
||||
void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
if (oox_unknown == NULL)return;
|
||||
@ -394,7 +426,51 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Comments *oox_comments)
|
||||
{
|
||||
if (!oox_comments) return;
|
||||
|
||||
for (size_t i = 0; i < oox_comments->m_arComments.size(); i++)
|
||||
{
|
||||
PPTX::Logic::Comment & oox_comment = oox_comments->m_arComments[i];
|
||||
|
||||
odp_context->start_comment(oox_comment.idx.get_value_or(-1));
|
||||
odp_context->start_comment_content();
|
||||
|
||||
if (oox_comment.pos_x.IsInit() && oox_comment.pos_y.IsInit())
|
||||
odp_context->comment_context()->set_position (*oox_comment.pos_x / 10., *oox_comment.pos_y / 10.); //pt
|
||||
|
||||
if (oox_comment.authorId.IsInit() && presentation->commentAuthors.IsInit())
|
||||
{
|
||||
for (size_t a = 0; a < presentation->commentAuthors->m_arAuthors.size(); a++)
|
||||
{
|
||||
PPTX::Logic::CommentAuthor & autor = presentation->commentAuthors->m_arAuthors[a];
|
||||
|
||||
if (autor.id.IsInit() && autor.id.get() == oox_comment.authorId.get())
|
||||
{
|
||||
odp_context->comment_context()->set_author(autor.name.get_value_or(L""));
|
||||
odp_context->comment_context()->set_initials(autor.initials.get_value_or(L""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oox_comment.dt.IsInit()) odp_context->comment_context()->set_date(*oox_comment.dt);
|
||||
if (oox_comment.text.IsInit()) odp_context->text_context()->add_text_content(*oox_comment.text);
|
||||
|
||||
odp_context->end_comment_content();
|
||||
odp_context->end_comment();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition)
|
||||
{
|
||||
if (!oox_timing) return;
|
||||
if (!oox_timing->tnLst.IsInit()) return;
|
||||
|
||||
for (size_t i = 0; i < oox_timing->tnLst->list.size(); i++)
|
||||
{
|
||||
//oox_timing->tnLst[0]
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TableProperties *oox_table_pr)
|
||||
{
|
||||
if (!oox_table_pr) return;
|
||||
@ -879,40 +955,101 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
|
||||
odp_context->end_drawings();
|
||||
}
|
||||
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholders)
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp)
|
||||
{
|
||||
if (oox_slide == NULL) return;
|
||||
|
||||
if (current_theme && current_clrMap)
|
||||
current_theme->SetColorMap(*current_clrMap);
|
||||
|
||||
|
||||
if (oox_slide->attrName.IsInit())
|
||||
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
|
||||
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
|
||||
bool bMaster = *odf_context()->drawing_context()->get_presentation();
|
||||
|
||||
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
|
||||
{
|
||||
smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
|
||||
smart_ptr<PPTX::Logic::Shape> pShape = pElem.smart_dynamic_cast<PPTX::Logic::Shape>();
|
||||
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
|
||||
if (pShape.IsInit())
|
||||
{
|
||||
pShape->FillLevelUp();
|
||||
if (!bPlaceholders && pShape->nvSpPr.nvPr.ph.is_init())
|
||||
continue;
|
||||
if (pShape->nvSpPr.nvPr.ph.is_init())
|
||||
{
|
||||
if (bFillUp)
|
||||
pShape->FillLevelUp();
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
|
||||
{
|
||||
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
PPTX::Logic::Shape update_shape;
|
||||
pShape->Merge(update_shape);
|
||||
//if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
// continue;
|
||||
|
||||
OoxConverter::convert(&update_shape);
|
||||
odf_context()->drawing_context()->set_placeholder_type(ph_type);
|
||||
}
|
||||
else
|
||||
odf_context()->drawing_context()->set_placeholder_type(0);
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
|
||||
odf_context()->drawing_context()->set_placeholder_id(pShape->nvSpPr.nvPr.ph->idx.get());
|
||||
|
||||
if (!bPlaceholders)
|
||||
continue;
|
||||
|
||||
PPTX::Logic::TextListStyle * listMasterStyle = NULL;
|
||||
|
||||
if (txStyles)
|
||||
{
|
||||
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
|
||||
if ((type == L"title") || (type == L"ctrTitle"))
|
||||
listMasterStyle = txStyles->titleStyle.GetPointer();
|
||||
else if ((type == L"body") || (type == L"subTitle") || (type == L"obj"))
|
||||
listMasterStyle = txStyles->bodyStyle.GetPointer();
|
||||
else if (type != L"")
|
||||
listMasterStyle = txStyles->otherStyle.GetPointer();
|
||||
}
|
||||
PPTX::Logic::Shape update_shape;
|
||||
|
||||
if (listMasterStyle)
|
||||
{
|
||||
update_shape.txBody = new PPTX::Logic::TxBody();
|
||||
|
||||
PPTX::Logic::TextListStyle *newListStyle = new PPTX::Logic::TextListStyle();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if(listMasterStyle->levels[i].is_init())
|
||||
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
|
||||
}
|
||||
update_shape.txBody->lstStyle.reset(newListStyle);
|
||||
}
|
||||
pShape->Merge(update_shape);
|
||||
OoxConverter::convert(&update_shape);
|
||||
}
|
||||
else if (pShape->txBody.IsInit() && presentation->defaultTextStyle.IsInit())
|
||||
{//default text style with master clrScheme
|
||||
PPTX::Logic::Shape update_shape;
|
||||
|
||||
update_shape.txBody = new PPTX::Logic::TxBody();
|
||||
|
||||
presentation->defaultTextStyle->Merge(update_shape.txBody->lstStyle);
|
||||
|
||||
pShape->Merge(update_shape);
|
||||
OoxConverter::convert(&update_shape);
|
||||
}
|
||||
else
|
||||
OoxConverter::convert(pShape.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
OoxConverter::convert(pElem.operator->());
|
||||
}
|
||||
//convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->());
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
convert(oox_slide->controls.GetPointer());
|
||||
}
|
||||
@ -940,7 +1077,11 @@ void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
odf_context()->drawing_context()->start_element(elm);
|
||||
|
||||
OoxConverter::convert(&pShape->nvSpPr.nvPr);
|
||||
odf_context()->drawing_context()->set_placeholder_type(type);
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
|
||||
odf_context()->drawing_context()->set_placeholder_id(*pShape->nvSpPr.nvPr.ph->idx);
|
||||
|
||||
OoxConverter::convert(pShape->spPr.xfrm.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->end_element();
|
||||
|
||||
@ -47,7 +47,9 @@ namespace OOX
|
||||
namespace PPTX
|
||||
{
|
||||
class TableStyles;
|
||||
class NotesSlide;
|
||||
class Presentation;
|
||||
class Comments;
|
||||
class Folder;
|
||||
|
||||
namespace Logic
|
||||
@ -63,6 +65,7 @@ namespace PPTX
|
||||
class TableCell;
|
||||
class TableCellProperties;
|
||||
class TcBdr;
|
||||
class TxStyles;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,19 +97,23 @@ namespace Oox2Odf
|
||||
virtual void convertDocument();
|
||||
virtual void write(const std::wstring & path);
|
||||
|
||||
virtual OOX::IFileContainer *current_document();
|
||||
virtual odf_writer::odf_conversion_context *odf_context();
|
||||
virtual PPTX::Theme *oox_theme();
|
||||
virtual PPTX::Logic::ClrMap *oox_clrMap();
|
||||
|
||||
|
||||
virtual std::wstring find_link_by_id (std::wstring sId, int t);
|
||||
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id (std::wstring sId);
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, bool bPlaceholders = true);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert (PPTX::Comments *oox_comments);
|
||||
void convert (PPTX::NotesSlide *oox_note);
|
||||
|
||||
void convert(PPTX::Logic::Bg *oox_background);
|
||||
void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
|
||||
|
||||
void convert(PPTX::Logic::Table *oox_table);
|
||||
void convert(PPTX::Logic::TableRow *oox_table_row);
|
||||
|
||||
@ -94,6 +94,15 @@ PPTX::Theme* XlsxConverter::oox_theme()
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
OOX::IFileContainer* XlsxConverter::current_document()
|
||||
{
|
||||
if (xlsx_current_container)
|
||||
return xlsx_current_container;
|
||||
else if (oox_current_child_document)
|
||||
return oox_current_child_document;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
smart_ptr<OOX::File> XlsxConverter::find_file_by_id(std::wstring sId)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile;
|
||||
@ -1718,7 +1727,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
|
||||
if (oox_anchor->m_oExt.IsInit())
|
||||
{
|
||||
}
|
||||
OoxConverter::convert(oox_anchor->m_oElement.GetPointer());
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
OoxConverter::convert(oox_anchor->m_oElement.GetPointer());
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
|
||||
@ -1748,236 +1759,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
|
||||
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
|
||||
}
|
||||
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CGroupShape* oox_group_shape)
|
||||
//{
|
||||
// if (!oox_group_shape)return;
|
||||
// if (oox_group_shape->m_arrItems.size() < 1) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_group();
|
||||
//
|
||||
// if (oox_group_shape->m_oNvGroupSpPr.IsInit())
|
||||
// {
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr.IsInit())
|
||||
// {
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
|
||||
// ods_context->drawing_context()->set_group_name(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName);
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
|
||||
// ods_context->drawing_context()->set_group_z_order(oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OoxConverter::convert(oox_group_shape->m_oGroupSpPr.GetPointer());
|
||||
//
|
||||
// for (unsigned int i=0; i < oox_group_shape->m_arrItems.size(); i++)
|
||||
// {
|
||||
// switch(oox_group_shape->m_arrItems[i]->getType())
|
||||
// {
|
||||
// case OOX::et_x_Shape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CShape* item = dynamic_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_ConnShape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CConnShape* item = dynamic_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_GroupShape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CGroupShape* item = dynamic_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_Pic:
|
||||
// {
|
||||
// OOX::Spreadsheet::CPic* item = dynamic_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// }
|
||||
// }
|
||||
// ods_context->drawing_context()->end_group();
|
||||
//}
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
|
||||
//{
|
||||
// if (!oox_shape)return;
|
||||
// if (!oox_shape->m_oSpPr.IsInit()) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// int type = -1;
|
||||
// if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
|
||||
// {
|
||||
// type = 1000;//6???
|
||||
// }
|
||||
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
|
||||
// {
|
||||
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
|
||||
// type =(geometry->m_oPrst.GetValue());
|
||||
// }
|
||||
//
|
||||
// if ((oox_shape->m_oNvSpPr.IsInit()) && (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()))
|
||||
// {
|
||||
// if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
|
||||
// type = 2000; //textBox
|
||||
// }
|
||||
//
|
||||
// if (type < 0)return;
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// if (type == 2000) ods_context->drawing_context()->start_text_box();
|
||||
// else ods_context->drawing_context()->start_shape(type);
|
||||
//
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// if (oox_shape->m_oNvSpPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); //имя, описалово, номер ...
|
||||
// convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности ... todooo
|
||||
// }
|
||||
// if (oox_shape->m_oShapeStyle.IsInit())
|
||||
// {
|
||||
// //доп эффекты
|
||||
//
|
||||
// }
|
||||
// if (oox_shape->m_oTxBody.IsInit())
|
||||
// {
|
||||
// ods_context->start_text_context();
|
||||
// OoxConverter::convert(oox_shape->m_oTxBody->m_oBodyPr.GetPointer());
|
||||
//
|
||||
// for (unsigned int i=0 ; i < oox_shape->m_oTxBody->m_arrItems.size();i++)
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oTxBody->m_arrItems[i]);
|
||||
// }
|
||||
// ods_context->drawing_context()->set_text( ods_context->text_context());
|
||||
// ods_context->end_text_context();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// if (type == 2000)ods_context->drawing_context()->end_text_box();
|
||||
// else ods_context->drawing_context()->end_shape();
|
||||
//
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
|
||||
//{
|
||||
// if (!oox_shape)return;
|
||||
// if (!oox_shape->m_oSpPr.IsInit()) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// int type = -1;
|
||||
// if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom)
|
||||
// {
|
||||
// type = 1000;//?????
|
||||
// }
|
||||
// else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset)
|
||||
// {
|
||||
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
|
||||
// {
|
||||
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
|
||||
// type = (int)(geometry->m_oPrst.GetValue());
|
||||
// }
|
||||
// }
|
||||
// if (type < 0)return;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ods_context->drawing_context()->start_shape(type);
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// //частенько приплывает из стиля заполенение объекта .. а он то одномерный :)
|
||||
// odf_context()->drawing_context()->start_area_properties();
|
||||
// odf_context()->drawing_context()->set_no_fill();
|
||||
// odf_context()->drawing_context()->end_area_properties();
|
||||
//
|
||||
// if (oox_shape->m_oNvConnSpPr.IsInit())
|
||||
// {
|
||||
// if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer());
|
||||
// }
|
||||
//
|
||||
// if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit())
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
// //avLst
|
||||
// }
|
||||
// ods_context->drawing_context()->end_shape();
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
|
||||
//{
|
||||
// if (!oox_picture)return;
|
||||
// if (!oox_picture->m_oBlipFill.IsInit()) return; // невeрная структура оох
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// std::wstring pathImage;
|
||||
// double Width=0, Height = 0;
|
||||
//
|
||||
// if (oox_picture->m_oBlipFill->m_oBlip.IsInit())
|
||||
// {
|
||||
// std::wstring sID = oox_picture->m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
|
||||
// pathImage = find_link_by_id(sID,1);
|
||||
//
|
||||
// if (pathImage.empty())
|
||||
// {
|
||||
// sID = oox_picture->m_oBlipFill->m_oBlip->m_oLink.GetValue();
|
||||
// //???
|
||||
// }
|
||||
// _graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
|
||||
// }
|
||||
// ods_context->start_image(pathImage);
|
||||
// {
|
||||
// if (oox_picture->m_oBlipFill->m_oTile.IsInit())
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_style_repeat(2);
|
||||
// }
|
||||
// if (oox_picture->m_oBlipFill->m_oStretch.IsInit())
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_style_repeat(1);
|
||||
// }
|
||||
// if (oox_picture->m_oBlipFill->m_oSrcRect.IsInit() && Width >0 && Height >0)
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_client_rect_inch(
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oL.GetValue()/100. * Width / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oT.GetValue()/100. * Height / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oR.GetValue()/100. * Width / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oB.GetValue()/100. * Height / currentSystemDPI );
|
||||
// }
|
||||
// if (oox_picture->m_oNvPicPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
|
||||
//
|
||||
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit())
|
||||
// {
|
||||
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks.IsInit())
|
||||
// {
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect)
|
||||
// //{
|
||||
// //}
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoCrop))
|
||||
// //{
|
||||
// //}
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoResize)
|
||||
// //{
|
||||
// //}
|
||||
// }
|
||||
// //m_oExtLst
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OoxConverter::convert(oox_picture->m_oSpPr.GetPointer(), oox_picture->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// }
|
||||
// ods_context->drawing_context()->end_image();
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//}
|
||||
//
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
|
||||
{
|
||||
if (!oox_cond_fmt)return;
|
||||
|
||||
@ -130,6 +130,7 @@ namespace Oox2Odf
|
||||
virtual void convertDocument();
|
||||
virtual void write(const std::wstring & path);
|
||||
|
||||
virtual OOX::IFileContainer *current_document();
|
||||
virtual odf_writer::odf_conversion_context *odf_context();
|
||||
virtual PPTX::Theme *oox_theme();
|
||||
virtual std::wstring find_link_by_id (std::wstring sId, int t);
|
||||
|
||||
@ -912,16 +912,7 @@ HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument
|
||||
m_pImageManager->m_nDocumentType = XMLWRITER_DOC_TYPE_DOCX;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CDrawingConverter::SetRelsPath(const std::wstring& bsRelsPath)
|
||||
{
|
||||
// чтобы не переоткрывать рельсы - посмотрим - может у нас уже есть такой??
|
||||
m_strCurrentRelsPath = bsRelsPath;
|
||||
return SetCurrentRelsPath();
|
||||
}
|
||||
std::wstring CDrawingConverter::GetRelsPath()
|
||||
{
|
||||
return m_strCurrentRelsPath;
|
||||
}
|
||||
|
||||
HRESULT CDrawingConverter::SetMediaDstPath(const std::wstring& bsMediaPath)
|
||||
{
|
||||
m_pBinaryWriter->m_pCommon->m_pImageManager->m_strDstMedia = (std::wstring)bsMediaPath;
|
||||
@ -1062,9 +1053,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::ObjectFromXml(const std::wstring& sXm
|
||||
XmlUtils::CXmlNode oNodeContent;
|
||||
oChilds.GetAt(0, oNodeContent);
|
||||
|
||||
std::wstring strCurrentRelsPath = m_strCurrentRelsPath;
|
||||
|
||||
if (L"dgm:relIds" == oNodeContent.GetName() && m_pBinaryWriter->m_pCommonRels->is_init())
|
||||
if (L"dgm:relIds" == oNodeContent.GetName() && m_pBinaryWriter->m_pCurrentContainer->is_init())
|
||||
{
|
||||
doc_LoadDiagram(&oElem, oNodeContent, ppMainProps, true);
|
||||
}
|
||||
@ -1597,7 +1586,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
|
||||
if (id_data.IsInit())
|
||||
{
|
||||
oFileData = (*m_pBinaryWriter->m_pCommonRels)->Find(*id_data);
|
||||
oFileData = (*m_pBinaryWriter->m_pCurrentContainer)->Find(*id_data);
|
||||
|
||||
if (oFileData.is_init())
|
||||
{
|
||||
@ -1616,7 +1605,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
}
|
||||
if (id_drawing.is_init())
|
||||
{
|
||||
oFileDrawing = (*m_pBinaryWriter->m_pCommonRels)->Find(*id_drawing);
|
||||
oFileDrawing = (*m_pBinaryWriter->m_pCurrentContainer)->Find(*id_drawing);
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
}
|
||||
if (!pDiagramDrawing && pDiagramData)
|
||||
@ -1641,8 +1630,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
{
|
||||
result->InitElem(new PPTX::Logic::SpTree(*pDiagramDrawing->m_oShapeTree));
|
||||
//to correct write blipFill rId to binary
|
||||
m_strCurrentRelsPath = pDiagramDrawing->GetReadPath().GetPath();
|
||||
SetCurrentRelsPath();
|
||||
SetRels(pDiagramDrawing);
|
||||
}
|
||||
else
|
||||
{//BG-FSC1.docx
|
||||
@ -2604,10 +2592,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
{
|
||||
std::wstring sId = oNodeTextData.GetAttribute(L"id");
|
||||
|
||||
if (sId.length() > 0 && m_pBinaryWriter->m_pCommonRels->IsInit())
|
||||
if (sId.length() > 0 && m_pBinaryWriter->m_pCurrentContainer->IsInit())
|
||||
{
|
||||
OOX::RId rId(sId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCommonRels)->legacyDiagramText(rId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCurrentContainer)->GetLegacyDiagramText(rId);
|
||||
|
||||
if (pExt.IsInit())
|
||||
{
|
||||
@ -4321,7 +4309,8 @@ HRESULT CDrawingConverter::LoadClrMap(const std::wstring& bsXml)
|
||||
|
||||
if (oNode.IsValid())
|
||||
{
|
||||
pClrMap->fromXMLW(oNode.ReadNode(L"w:clrSchemeMapping"));
|
||||
XmlUtils::CXmlNode nodeMap = oNode.ReadNode(L"w:clrSchemeMapping");
|
||||
pClrMap->fromXML(nodeMap);
|
||||
}
|
||||
|
||||
*m_pClrMap = pClrMap;
|
||||
@ -5275,27 +5264,19 @@ void CDrawingConverter::Clear()
|
||||
RELEASEOBJECT(pMem);
|
||||
}
|
||||
m_mapShapeTypes.clear();
|
||||
m_mapRels.clear();
|
||||
}
|
||||
|
||||
HRESULT CDrawingConverter::SetCurrentRelsPath()
|
||||
void CDrawingConverter::SetRels(smart_ptr<OOX::IFileContainer> container)
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<PPTX::CCommonRels>>::iterator pPair = m_mapRels.find(m_strCurrentRelsPath);
|
||||
|
||||
if (m_mapRels.end() == pPair)
|
||||
{
|
||||
smart_ptr<PPTX::CCommonRels> pCR = new PPTX::CCommonRels();
|
||||
m_mapRels.insert(std::pair<std::wstring, NSCommon::smart_ptr<PPTX::CCommonRels>>(m_strCurrentRelsPath, pCR));
|
||||
|
||||
pPair = m_mapRels.find(m_strCurrentRelsPath);
|
||||
|
||||
OOX::CPath filename = m_strCurrentRelsPath;
|
||||
pPair->second->_read(filename);
|
||||
}
|
||||
|
||||
*m_pBinaryWriter->m_pCommonRels = pPair->second;
|
||||
|
||||
return S_OK;
|
||||
*m_pBinaryWriter->m_pCurrentContainer = container;
|
||||
}
|
||||
void CDrawingConverter::SetRels(OOX::IFileContainer *container)
|
||||
{
|
||||
*m_pBinaryWriter->m_pCurrentContainer = smart_ptr<OOX::IFileContainer>(container);
|
||||
m_pBinaryWriter->m_pCurrentContainer->AddRef();
|
||||
}
|
||||
smart_ptr<OOX::IFileContainer> CDrawingConverter::GetRels()
|
||||
{
|
||||
return *m_pBinaryWriter->m_pCurrentContainer;
|
||||
}
|
||||
void CDrawingConverter::SetFontManager(CFontManager* pFontManager)
|
||||
{
|
||||
|
||||
@ -63,6 +63,7 @@ namespace BinDocxRW
|
||||
namespace OOX
|
||||
{
|
||||
class CContentTypes;
|
||||
class IFileContainer;
|
||||
}
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
@ -186,9 +187,7 @@ namespace NSBinPptxRW
|
||||
};
|
||||
|
||||
|
||||
std::map<std::wstring, CShape*> m_mapShapeTypes;
|
||||
std::map<std::wstring, NSCommon::smart_ptr<PPTX::CCommonRels>> m_mapRels;
|
||||
std::wstring m_strCurrentRelsPath;
|
||||
std::map<std::wstring, CShape*> m_mapShapeTypes;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter;
|
||||
int m_lNextId;
|
||||
@ -211,9 +210,11 @@ namespace NSBinPptxRW
|
||||
|
||||
~CDrawingConverter();
|
||||
|
||||
HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument);
|
||||
HRESULT SetRelsPath (const std::wstring& sRelsPath);
|
||||
std::wstring GetRelsPath ();
|
||||
void SetRels(OOX::IFileContainer *container);
|
||||
void SetRels(smart_ptr<OOX::IFileContainer> container);
|
||||
smart_ptr<OOX::IFileContainer> GetRels();
|
||||
|
||||
HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument);
|
||||
HRESULT SetMediaDstPath (const std::wstring& sMediaPath);
|
||||
HRESULT SetEmbedDstPath (const std::wstring& sEmbedPath);
|
||||
|
||||
|
||||
@ -82,7 +82,8 @@ namespace NSBinPptxRW
|
||||
|
||||
FontsEmbedded = 44,
|
||||
SlideNotesRels = 45,
|
||||
NotesRels = 46
|
||||
NotesRels = 46,
|
||||
NotesMastersRels= 47
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,11 +718,12 @@ namespace NSBinPptxRW
|
||||
}
|
||||
CBinaryFileWriter::CBinaryFileWriter()
|
||||
{
|
||||
m_pMainDocument = NULL;
|
||||
m_pCommon = new CCommonWriter();
|
||||
m_pCommonRels = new NSCommon::smart_ptr<PPTX::CCommonRels>();
|
||||
m_pTheme = new NSCommon::smart_ptr<PPTX::Theme>();
|
||||
m_pClrMap = new NSCommon::smart_ptr<PPTX::Logic::ClrMap>();
|
||||
m_pMainDocument = NULL;
|
||||
m_pCommon = new CCommonWriter();
|
||||
//m_pCommonRels = new NSCommon::smart_ptr<PPTX::CCommonRels>();
|
||||
m_pCurrentContainer = new NSCommon::smart_ptr<OOX::IFileContainer>();
|
||||
m_pTheme = new NSCommon::smart_ptr<PPTX::Theme>();
|
||||
m_pClrMap = new NSCommon::smart_ptr<PPTX::Logic::ClrMap>();
|
||||
|
||||
Clear();
|
||||
}
|
||||
@ -730,7 +731,8 @@ namespace NSBinPptxRW
|
||||
{
|
||||
RELEASEARRAYOBJECTS (m_pStreamData);
|
||||
RELEASEOBJECT (m_pCommon);
|
||||
RELEASEOBJECT (m_pCommonRels);
|
||||
//RELEASEOBJECT (m_pCommonRels);
|
||||
RELEASEOBJECT (m_pCurrentContainer);
|
||||
|
||||
RELEASEOBJECT (m_pTheme);
|
||||
RELEASEOBJECT (m_pClrMap);
|
||||
|
||||
@ -51,6 +51,7 @@ namespace OOX
|
||||
class OleObject;
|
||||
class CContentTypes;
|
||||
class WritingElement;
|
||||
class IFileContainer;
|
||||
}
|
||||
namespace NSCommon
|
||||
{
|
||||
@ -63,7 +64,6 @@ namespace NSCommon
|
||||
}
|
||||
namespace PPTX
|
||||
{
|
||||
class CCommonRels;
|
||||
class Theme;
|
||||
namespace Logic
|
||||
{
|
||||
@ -154,6 +154,7 @@ namespace NSBinPptxRW
|
||||
std::vector<LONG> m_oSlide_Layout_Rels;
|
||||
std::vector<LONG> m_oSlide_Notes_Rels;
|
||||
std::vector<LONG> m_oNote_Rels;
|
||||
std::vector<LONG> m_oNotesMasters_Rels;
|
||||
|
||||
NSShapeImageGen::CImageManager* m_pImageManager;
|
||||
|
||||
@ -225,7 +226,7 @@ namespace NSBinPptxRW
|
||||
CCommonWriter* m_pCommon;
|
||||
std::wstring m_strMainFolder;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::CCommonRels>* m_pCommonRels;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer>* m_pCurrentContainer;
|
||||
BinDocxRW::CDocxSerializer * m_pMainDocument;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme>* m_pTheme;
|
||||
|
||||
@ -147,13 +147,18 @@ namespace PPTX2EditorAdvanced
|
||||
|
||||
// проверяем theme
|
||||
size_t pPointerTh = (size_t)(noteMaster->theme_.operator ->());
|
||||
LONG nNotesMastersRelsIndex = -1;
|
||||
std::map<size_t, LONG>::const_iterator pSearchTh = pCommon->themes.find(pPointerTh);
|
||||
if (pSearchTh == pCommon->themes.end())
|
||||
{
|
||||
LONG lCountTh = (LONG)_themes.size();
|
||||
pCommon->themes [pPointerTh] = lCountTh;
|
||||
_themes.push_back(noteMaster->theme_);
|
||||
nNotesMastersRelsIndex = lCountTh;
|
||||
} else {
|
||||
nNotesMastersRelsIndex = pSearchTh->second;
|
||||
}
|
||||
oBinaryWriter.m_pCommon->m_oNotesMasters_Rels.push_back(nNotesMastersRelsIndex);
|
||||
}
|
||||
|
||||
// записываем все слайды
|
||||
@ -490,6 +495,21 @@ namespace PPTX2EditorAdvanced
|
||||
oBinaryWriter.EndRecord();
|
||||
// ------------------------------------------------
|
||||
|
||||
// NoteRels --------------------------------------
|
||||
oBinaryWriter.StartMainRecord(NSMainTables::NotesMastersRels);
|
||||
oBinaryWriter.StartRecord(NSMainTables::NotesMastersRels);
|
||||
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
_s_rels = oBinaryWriter.m_pCommon->m_oNotesMasters_Rels.size();
|
||||
for (size_t i = 0; i < _s_rels; ++i)
|
||||
{
|
||||
oBinaryWriter.WriteInt1(0, oBinaryWriter.m_pCommon->m_oNotesMasters_Rels[i]);
|
||||
}
|
||||
|
||||
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
oBinaryWriter.EndRecord();
|
||||
// ------------------------------------------------
|
||||
|
||||
|
||||
oBinaryWriter.EndRecord();
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(CommentAuthor)
|
||||
private:
|
||||
|
||||
nullable_int id;
|
||||
nullable_int last_idx;
|
||||
nullable_int clr_idx;
|
||||
@ -52,8 +52,6 @@ namespace PPTX
|
||||
nullable_string name;
|
||||
nullable_string initials;
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"id", id);
|
||||
@ -138,10 +136,9 @@ namespace PPTX
|
||||
|
||||
class Authors : public WrapperFile
|
||||
{
|
||||
private:
|
||||
public:
|
||||
std::vector<PPTX::Logic::CommentAuthor> m_arAuthors;
|
||||
|
||||
public:
|
||||
Authors()
|
||||
{
|
||||
}
|
||||
@ -152,8 +149,6 @@ namespace PPTX
|
||||
virtual ~Authors()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
@ -177,8 +172,6 @@ namespace PPTX
|
||||
{
|
||||
WrapperFile::write(filename, directory, content);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Presentation::FileTypes::CommentAuthors;
|
||||
@ -191,8 +184,6 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecordArray(0, 0, m_arAuthors);
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Comment)
|
||||
private:
|
||||
|
||||
nullable_int authorId;
|
||||
nullable_int idx;
|
||||
nullable_string dt;
|
||||
@ -59,8 +59,6 @@ namespace PPTX
|
||||
|
||||
nullable_string additional_data; // teamlab editor information!!!
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"authorId", authorId);
|
||||
@ -276,10 +274,9 @@ namespace PPTX
|
||||
|
||||
class Comments : public WrapperFile
|
||||
{
|
||||
private:
|
||||
public:
|
||||
std::vector<PPTX::Logic::Comment> m_arComments;
|
||||
|
||||
public:
|
||||
Comments()
|
||||
{
|
||||
}
|
||||
@ -291,7 +288,6 @@ namespace PPTX
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
@ -315,7 +311,6 @@ namespace PPTX
|
||||
WrapperFile::write(filename, directory, content);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Presentation::FileTypes::SlideComments;
|
||||
@ -328,8 +323,6 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecordArray(0, 0, m_arComments);
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "FileContainer.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "LegacyDiagramText.h"
|
||||
#include "FileFactory.h"
|
||||
#include "WrapperFile.h"
|
||||
|
||||
@ -241,13 +240,7 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
smart_ptr<PPTX::LegacyDiagramText> FileContainer::legacyDiagramText(const OOX::RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
if (pPair == m_mContainer.end ())
|
||||
return smart_ptr<LegacyDiagramText>();
|
||||
return pPair->second.smart_dynamic_cast<LegacyDiagramText>();
|
||||
}
|
||||
|
||||
void FileContainer::read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event)
|
||||
{
|
||||
OOX::CRels rels(filename);
|
||||
@ -304,25 +297,5 @@ namespace PPTX
|
||||
content.Registration(type().OverrideType(), directory, m_WrittenFileName);
|
||||
m_written = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
void CCommonRels::_read(const OOX::CRels& rels, const OOX::CPath& path)
|
||||
{
|
||||
size_t nCount = rels.m_arrRelations.size();
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
|
||||
|
||||
OOX::CPath normPath = CorrectPathRels(path, pRelation);
|
||||
|
||||
smart_ptr<OOX::File> _file = PPTX::FileFactory::CreateFilePPTX_OnlyMedia(normPath, *pRelation);
|
||||
Add(pRelation->rId(), _file);
|
||||
}
|
||||
}
|
||||
|
||||
void CCommonRels::_read(const OOX::CPath& filename)
|
||||
{
|
||||
OOX::CRels rels(filename);
|
||||
OOX::CPath path = filename.GetDirectory();
|
||||
_read(rels, path);
|
||||
}
|
||||
} // namespace PPTX
|
||||
|
||||
@ -52,7 +52,6 @@ namespace PPTX
|
||||
virtual ~FileContainer()
|
||||
{
|
||||
}
|
||||
smart_ptr<PPTX::LegacyDiagramText> legacyDiagramText (const OOX::RId& rId) const;
|
||||
|
||||
protected:
|
||||
void read(const OOX::CPath& filename);
|
||||
@ -71,16 +70,6 @@ namespace PPTX
|
||||
bool m_bCancelled;
|
||||
};
|
||||
|
||||
class CCommonRels : public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
CCommonRels() : PPTX::FileContainer()
|
||||
{
|
||||
}
|
||||
|
||||
void _read(const OOX::CPath& filename);
|
||||
void _read(const OOX::CRels& rels, const OOX::CPath& path);
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_IFILE_CONTAINER_INCLUDE_H_
|
||||
@ -143,52 +143,4 @@ namespace PPTX
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
}
|
||||
|
||||
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX_OnlyMedia(const OOX::CPath& norm_filename, OOX::Rels::CRelationShip& relation)
|
||||
{
|
||||
bool bIsDownload = false;
|
||||
std::wstring strFile = relation.Filename().GetPath();
|
||||
|
||||
int n1 = (int)strFile.find(_T("www"));
|
||||
int n2 = (int)strFile.find(_T("http"));
|
||||
int n3 = (int)strFile.find(_T("ftp"));
|
||||
int n4 = (int)strFile.find(_T("https://"));
|
||||
|
||||
//если nI сранивать не с 0, то будут проблемы
|
||||
//потому что в инсталяции мы кладем файлы в /var/www...
|
||||
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
|
||||
bIsDownload = true;
|
||||
|
||||
OOX::CPath filename = norm_filename;
|
||||
|
||||
if (bIsDownload)
|
||||
filename = relation.Filename();
|
||||
|
||||
std::wstring strT = relation.Type();
|
||||
|
||||
if (strT == OOX::FileTypes::Image ||
|
||||
strT == OOX::FileTypes::Chart)
|
||||
{
|
||||
return smart_ptr<OOX::File>(new OOX::Image(filename));
|
||||
}
|
||||
else if(strT == OOX::FileTypes::Data)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramData(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::DiagDrawing)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::HyperLink)
|
||||
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
|
||||
|
||||
else if(strT == OOX::FileTypes::LegacyDiagramText)
|
||||
return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::OleObject)
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject(filename));
|
||||
|
||||
else if ( strT == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
|
||||
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
}
|
||||
|
||||
} // namespace PPTX
|
||||
|
||||
@ -42,6 +42,5 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, OOX::Rels::CRelationShip& relation, FileMap& map);
|
||||
static const smart_ptr<OOX::File> CreateFilePPTX_OnlyMedia(const OOX::CPath& path, OOX::Rels::CRelationShip& relation);
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
@ -95,7 +95,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dx"), x)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dy"), y)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dz"), z)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -63,7 +63,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("w"), w)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("h"), h)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("prst"), prst)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -120,21 +120,29 @@ namespace PPTX
|
||||
oAttr.Write(_T("noResize"), noResize);
|
||||
oAttr.Write(_T("noSelect"), noSelect);
|
||||
|
||||
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(L"a:graphicFrameLocks", oAttr));
|
||||
std::wstring namespaceLocks = L"a";
|
||||
if (m_namespace == L"wp") namespaceLocks = L"wp";
|
||||
|
||||
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
std::wstring namespace_ = m_namespace;
|
||||
std::wstring namespace_ = m_namespace;
|
||||
std::wstring namespaceLock_ = L"a";
|
||||
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wp";
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
|
||||
{
|
||||
namespaceLock_ = L"wp";
|
||||
namespace_ = L"wp";
|
||||
}
|
||||
|
||||
pWriter->StartNode(namespace_ + L":cNvGraphicFramePr");
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("a:graphicFrameLocks"));
|
||||
pWriter->StartNode(namespaceLock_ + L":graphicFrameLocks");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
@ -147,7 +155,7 @@ namespace PPTX
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(_T("a:graphicFrameLocks"));
|
||||
pWriter->EndNode(namespaceLock_ + L":graphicFrameLocks");
|
||||
|
||||
pWriter->EndNode(namespace_ + L":cNvGraphicFramePr");
|
||||
}
|
||||
@ -228,4 +236,4 @@ namespace PPTX
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H
|
||||
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H
|
||||
|
||||
@ -78,7 +78,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("prst"), prst)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("fov"), fov)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("zoom"), zoom)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -88,7 +88,7 @@ namespace PPTX
|
||||
Limit::ColorSchemeIndex lColorIndex_folHlink;
|
||||
Limit::ColorSchemeIndex lColorIndex_hlink;
|
||||
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("accent1"), lColorIndex_accent1)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("accent2"), lColorIndex_accent2 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("accent3"), lColorIndex_accent3 )
|
||||
@ -98,10 +98,15 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bg1"), lColorIndex_bg1 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bg2"), lColorIndex_bg2 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx1"), lColorIndex_tx1 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx1"), lColorIndex_tx2 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx2"), lColorIndex_tx2 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("folHlink"), lColorIndex_folHlink )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hlink"), lColorIndex_hlink )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("t1"), lColorIndex_tx1 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("t2"), lColorIndex_tx2 )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("followedHyperlink"), lColorIndex_folHlink )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hyperlink"), lColorIndex_hlink )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex_accent1));
|
||||
ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex_accent2));
|
||||
@ -123,6 +128,23 @@ namespace PPTX
|
||||
ColorMap.clear();
|
||||
|
||||
Limit::ColorSchemeIndex lColorIndex;
|
||||
|
||||
if (m_name == L"w:clrSchemeMapping")
|
||||
{
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
|
||||
|
||||
lColorIndex._set(node.GetAttribute(_T("w:t1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:t2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:followedHyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:hyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
|
||||
}
|
||||
|
||||
lColorIndex._set(node.GetAttribute(_T("accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
|
||||
@ -138,37 +160,29 @@ namespace PPTX
|
||||
lColorIndex._set(node.GetAttribute(_T("hlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
|
||||
}
|
||||
|
||||
void fromXMLW(const XmlUtils::CXmlNode& cnode)
|
||||
{
|
||||
XmlUtils::CXmlNode& node = const_cast<XmlUtils::CXmlNode&> (cnode);
|
||||
|
||||
m_name = node.GetName();
|
||||
|
||||
ColorMap.clear();
|
||||
|
||||
Limit::ColorSchemeIndex lColorIndex;
|
||||
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:t1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:t2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:followedHyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
|
||||
lColorIndex._set(node.GetAttribute(_T("w:hyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
|
||||
}
|
||||
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
|
||||
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
|
||||
if (m_name == L"w:clrSchemeMapping")
|
||||
{
|
||||
oAttr.Write(pPair->first, pPair->second.get());
|
||||
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
|
||||
{
|
||||
std::wstring att_name = L"w:" + pPair->first;
|
||||
if (pPair->first == L"tx1") att_name = L"w:t1";
|
||||
else if (pPair->first == L"tx2") att_name = L"w:t2";
|
||||
else if (pPair->first == L"folHlink") att_name = L"w:followedHyperlink";
|
||||
else if (pPair->first == L"hlink") att_name = L"w:hyperlink";
|
||||
|
||||
oAttr.Write(att_name, pPair->second.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
|
||||
{
|
||||
oAttr.Write(pPair->first, pPair->second.get());
|
||||
}
|
||||
}
|
||||
|
||||
return XmlUtils::CreateNode(m_name, oAttr);
|
||||
@ -229,12 +243,9 @@ namespace PPTX
|
||||
pReader->Seek(_e);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
std::map<std::wstring, Limit::ColorSchemeIndex> ColorMap;
|
||||
|
||||
public:
|
||||
std::wstring m_name;
|
||||
std::wstring m_name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -496,13 +496,13 @@ namespace PPTX
|
||||
|
||||
static void HSL2RGB(unsigned char* HSL, unsigned char* RGB)
|
||||
{
|
||||
if ( HSL[1] == 0 )
|
||||
{
|
||||
RGB[0] = HSL[2];
|
||||
RGB[1] = HSL[2];
|
||||
RGB[2] = HSL[2];
|
||||
}
|
||||
else
|
||||
//if ( HSL[1] == 0 )
|
||||
//{
|
||||
// RGB[0] = HSL[2];
|
||||
// RGB[1] = HSL[2];
|
||||
// RGB[2] = HSL[2];
|
||||
//}
|
||||
//else
|
||||
{
|
||||
double H = double(HSL[0])/240.0;
|
||||
double S = double(HSL[1])/240.0;
|
||||
|
||||
@ -53,28 +53,36 @@ namespace PPTX
|
||||
{
|
||||
name = oReader.GetName();
|
||||
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if (XmlUtils::GetNameNoNS(name) == _T("alpha"))
|
||||
{
|
||||
ReadAttributes2( oReader );
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
}
|
||||
}
|
||||
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
nullable_string sTmp;
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), sTmp)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
if (val.is_init() && sTmp.is_init() && sTmp->find(wchar_t('%')) != -1)
|
||||
*val = (*val) * 1000;
|
||||
if (sTmp.is_init())
|
||||
{
|
||||
val = sTmp.get();
|
||||
if (val.is_init() && std::wstring::npos != sTmp->find(L"%"))
|
||||
{
|
||||
*val = (*val) * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
@ -86,7 +94,7 @@ namespace PPTX
|
||||
nullable_string sTmp;
|
||||
node.ReadAttributeBase(L"val", sTmp);
|
||||
|
||||
if (val.is_init() && sTmp.is_init() && sTmp->find(wchar_t('%')) != -1)
|
||||
if (val.is_init() && sTmp.is_init() && std::wstring::npos != sTmp->find(L"%"))
|
||||
*val = (*val) * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -60,7 +60,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
|
||||
@ -57,7 +57,7 @@ namespace PPTX
|
||||
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
if (6 == val.length())
|
||||
{
|
||||
|
||||
@ -172,7 +172,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
|
||||
virtual std::wstring toXML() const
|
||||
|
||||
@ -38,24 +38,23 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
std::wstring Control::GetVmlXmlBySpid(std::wstring spid, std::wstring & rels) const
|
||||
std::wstring Control::GetVmlXmlBySpid(std::wstring spid, smart_ptr<OOX::IFileContainer> & rels) const
|
||||
{
|
||||
std::wstring xml;
|
||||
rels = _T("");
|
||||
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::Slide>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
|
||||
{
|
||||
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
|
||||
return xml;
|
||||
@ -67,7 +66,7 @@ namespace PPTX
|
||||
std::wstring s = *spid;
|
||||
if (s.length() < 8) s = _T("_x0000_s") + s;
|
||||
|
||||
std::wstring rels;
|
||||
smart_ptr<OOX::IFileContainer> rels;
|
||||
std::wstring xml = GetVmlXmlBySpid(s, rels);
|
||||
|
||||
if (xml.length() > 0)
|
||||
@ -82,7 +81,7 @@ namespace PPTX
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = pImageManager;
|
||||
|
||||
oDrawingConverter.SetRelsPath(rels);
|
||||
oDrawingConverter.SetRels(rels);
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
@ -97,7 +96,7 @@ namespace PPTX
|
||||
std::wstring s = *spid;
|
||||
if (s.length() < 8) s = _T("_x0000_s") + s;
|
||||
|
||||
std::wstring rels;
|
||||
smart_ptr<OOX::IFileContainer> rels;
|
||||
std::wstring xml = GetVmlXmlBySpid(s, rels);
|
||||
|
||||
if (xml.length() > 0)
|
||||
@ -113,7 +112,7 @@ namespace PPTX
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
|
||||
oDrawingConverter.SetRelsPath(rels);
|
||||
oDrawingConverter.SetRels(rels);
|
||||
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
if (hRes == S_OK && oDrawingConverter.m_pBinaryWriter->GetPosition() > 10)
|
||||
|
||||
@ -50,7 +50,8 @@ namespace PPTX
|
||||
|
||||
public:
|
||||
void AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const ;
|
||||
std::wstring GetVmlXmlBySpid(std::wstring spid, std::wstring & rels) const ;
|
||||
|
||||
std::wstring GetVmlXmlBySpid(std::wstring spid, smart_ptr<OOX::IFileContainer> & rels) const ;
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const ;
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Start_No_NS ( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, L"name", name)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, L"type", type)
|
||||
WritingElement_ReadAttributes_End ( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS ( oReader )
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node);
|
||||
|
||||
@ -67,7 +67,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("thresh"), thresh)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("amt"), amt)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ namespace PPTX
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("a"), a)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("thresh"), thresh)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -69,7 +69,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("grow"), grow)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -83,7 +83,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("useA"), useA)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
|
||||
@ -67,7 +67,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), ref)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
|
||||
@ -83,7 +83,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ namespace PPTX
|
||||
{
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("hue"), hue)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sat"), sat)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lum"), lum)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Start_No_NS( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("bright"), bright)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("contrast"), contrast)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
|
||||
@ -99,7 +99,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user