mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 20:36:10 +08:00
Compare commits
15 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 419a01bd09 | |||
| 804a01cab3 | |||
| 931d6aa17c | |||
| 2861539949 | |||
| 281dad68fb | |||
| 04ba432cde | |||
| 61c943a3b2 | |||
| 9fdc7641b3 | |||
| 1029ee9101 | |||
| 9ef5bec2a5 | |||
| 93132eb8a0 | |||
| 9828c25e51 | |||
| db1204288b | |||
| 26c3d37be5 | |||
| 077ea08368 |
@ -156,7 +156,7 @@ namespace DocFileFormat
|
||||
file.CloseFile();
|
||||
|
||||
OOX::CPath path(sTempXmlFile);
|
||||
OOX::CDocument docEmbedded(path, path);
|
||||
OOX::CDocument docEmbedded(NULL, path, path);
|
||||
|
||||
bool res = false;
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); ++it)
|
||||
|
||||
@ -36,7 +36,7 @@ namespace BinDocxRW {
|
||||
|
||||
int Binary_VbaProjectTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject(NULL);
|
||||
m_oFileWriter.m_pVbaProject->fromPPTY(&m_oBufferedStream);
|
||||
|
||||
return c_oSerConstants::ReadOk;
|
||||
|
||||
@ -37,7 +37,17 @@
|
||||
|
||||
#include "../BinWriter/BinReaderWriterDefines.h"
|
||||
#include "../../XlsxSerializerCom/Writer/BinaryReader.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
|
||||
#include "../DocWrapper/XlsxSerializer.h"
|
||||
|
||||
#include "../../DesktopEditor/common/ASCVariant.h"
|
||||
@ -2981,7 +2991,7 @@ public:
|
||||
int Read()
|
||||
{
|
||||
return ReadTable(&Binary_OtherTableReader::ReadOtherContent, this);
|
||||
};
|
||||
}
|
||||
int ReadOtherContent(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
@ -2991,7 +3001,7 @@ public:
|
||||
}
|
||||
else if(c_oSerOtherTableTypes::DocxTheme == type)
|
||||
{
|
||||
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme();
|
||||
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme(NULL);
|
||||
pTheme->fromPPTY(&m_oBufferedStream);
|
||||
NSBinPptxRW::CXmlWriter xmlWriter;
|
||||
pTheme->toXmlWriter(&xmlWriter);
|
||||
@ -3000,7 +3010,7 @@ public:
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int ReadImageMapContent(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
@ -3043,7 +3053,7 @@ public:
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
};
|
||||
class Binary_CommentsTableReader : public Binary_CommonReader<Binary_CommentsTableReader>
|
||||
{
|
||||
@ -7258,7 +7268,7 @@ public:
|
||||
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());
|
||||
BinXlsxRW::BinaryChartReader oBinaryChartReader(m_oBufferedStream, oSaveParams, m_oFileWriter.m_pDrawingConverter);
|
||||
|
||||
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
|
||||
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace(NULL);
|
||||
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
|
||||
|
||||
//save xlsx
|
||||
|
||||
@ -37,12 +37,30 @@
|
||||
#include "../../Common/Base64.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
|
||||
#include "../../XlsxSerializerCom/Reader/BinaryWriter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
|
||||
#include "BinEquationWriter.h"
|
||||
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
|
||||
namespace BinDocxRW
|
||||
{
|
||||
class ParamsWriter
|
||||
|
||||
@ -32,7 +32,12 @@
|
||||
#include "ChartWriter.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/Styles.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
|
||||
|
||||
#define NUMID_START 160
|
||||
const wchar_t* gc_Cat = L"cat";
|
||||
@ -127,11 +132,11 @@ namespace BinXlsxRW{
|
||||
}
|
||||
ChartWriter::~ChartWriter()
|
||||
{
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
{
|
||||
delete itRow->second;
|
||||
}
|
||||
@ -141,30 +146,34 @@ namespace BinXlsxRW{
|
||||
void ChartWriter::toXlsx(OOX::Spreadsheet::CXlsx& oXlsx)
|
||||
{
|
||||
std::vector<std::wstring> aSharedStrings;
|
||||
//Sheet
|
||||
OOX::Spreadsheet::CWorkbook* pWorkbook = oXlsx.CreateWorkbook();
|
||||
pWorkbook->m_oSheets.Init();
|
||||
|
||||
oXlsx.CreateWorkbook();
|
||||
oXlsx.m_pWorkbook->m_oSheets.Init();
|
||||
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets = oXlsx.GetWorksheets();
|
||||
int nSheetId = 1;
|
||||
OOX::Spreadsheet::CWorksheet* pFirstWorksheet = NULL;
|
||||
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
const std::wstring& sSheetName = it->first;
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(mapWorksheets, sSheetName);
|
||||
|
||||
//find or generate black worksheet
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(oXlsx.m_arWorksheets, oXlsx.m_mapWorksheets, sSheetName);
|
||||
//fill data to worksheet
|
||||
toXlsxSheetdata(pWorksheet, *it->second, aSharedStrings);
|
||||
|
||||
OOX::Spreadsheet::CSheet* pSheet = new OOX::Spreadsheet::CSheet();
|
||||
pSheet->m_oName.Init();
|
||||
pSheet->m_oName->append(sSheetName);
|
||||
pSheet->m_oSheetId.Init();
|
||||
pSheet->m_oSheetId->SetValue(nSheetId++);
|
||||
|
||||
smart_ptr<OOX::File> oWorksheetFile = smart_ptr<OOX::File>(pWorksheet);
|
||||
const OOX::RId oRId = pWorkbook->Add(oWorksheetFile);
|
||||
const OOX::RId oRId = oXlsx.m_pWorkbook->Add(oWorksheetFile);
|
||||
pSheet->m_oRid.Init();
|
||||
pSheet->m_oRid->SetValue(oRId.get());
|
||||
pWorkbook->m_oSheets->m_arrItems.push_back(pSheet);
|
||||
mapWorksheets[pSheet->m_oName.get()] = pWorksheet;
|
||||
|
||||
oXlsx.m_pWorkbook->m_oSheets->m_arrItems.push_back(pSheet);
|
||||
|
||||
if(NULL == pFirstWorksheet)
|
||||
{
|
||||
@ -173,7 +182,7 @@ namespace BinXlsxRW{
|
||||
}
|
||||
|
||||
//SharedStrings
|
||||
OOX::Spreadsheet::CSharedStrings* pSharedStrings = oXlsx.CreateSharedStrings();
|
||||
oXlsx.CreateSharedStrings();
|
||||
for(size_t i = 0; i < aSharedStrings.size(); ++i)
|
||||
{
|
||||
OOX::Spreadsheet::CText* pText = new OOX::Spreadsheet::CText();
|
||||
@ -185,20 +194,20 @@ namespace BinXlsxRW{
|
||||
}
|
||||
OOX::Spreadsheet::CSi* pSi = new OOX::Spreadsheet::CSi();
|
||||
pSi->m_arrItems.push_back(pText);
|
||||
pSharedStrings->AddSi(pSi);
|
||||
oXlsx.m_pSharedStrings->AddSi(pSi);
|
||||
}
|
||||
pSharedStrings->m_oCount.Init();
|
||||
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_nCount);
|
||||
pSharedStrings->m_oUniqueCount.Init();
|
||||
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_nCount);
|
||||
oXlsx.m_pSharedStrings->m_oCount.Init();
|
||||
oXlsx.m_pSharedStrings->m_oCount->SetValue(oXlsx.m_pSharedStrings->m_nCount);
|
||||
oXlsx.m_pSharedStrings->m_oUniqueCount.Init();
|
||||
oXlsx.m_pSharedStrings->m_oUniqueCount->SetValue(oXlsx.m_pSharedStrings->m_nCount);
|
||||
//Styles
|
||||
OOX::Spreadsheet::CStyles* pStyles = oXlsx.CreateStyles();
|
||||
pStyles->m_oCellXfs.Init();
|
||||
oXlsx.CreateStyles();
|
||||
oXlsx.m_pStyles->m_oCellXfs.Init();
|
||||
for(size_t i = 0; i < m_aXfs.size(); ++i)
|
||||
{
|
||||
pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
|
||||
oXlsx.m_pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
|
||||
}
|
||||
pStyles->m_oNumFmts.Init();
|
||||
oXlsx.m_pStyles->m_oNumFmts.Init();
|
||||
|
||||
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
|
||||
{
|
||||
@ -207,12 +216,13 @@ namespace BinXlsxRW{
|
||||
pNumFmt->m_oFormatCode->append(it->first);
|
||||
pNumFmt->m_oNumFmtId.Init();
|
||||
pNumFmt->m_oNumFmtId->SetValue(NUMID_START + it->second);
|
||||
pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
|
||||
oXlsx.m_pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
|
||||
}
|
||||
pStyles->m_oNumFmts->m_oCount.Init();
|
||||
pStyles->m_oNumFmts->m_oCount->SetValue(pStyles->m_oNumFmts->m_arrItems.size());
|
||||
pStyles->m_oCellXfs->m_oCount.Init();
|
||||
pStyles->m_oCellXfs->m_oCount->SetValue(pStyles->m_oCellXfs->m_arrItems.size());
|
||||
oXlsx.m_pStyles->m_oNumFmts->m_oCount.Init();
|
||||
oXlsx.m_pStyles->m_oNumFmts->m_oCount->SetValue(oXlsx.m_pStyles->m_oNumFmts->m_arrItems.size());
|
||||
oXlsx.m_pStyles->m_oCellXfs->m_oCount.Init();
|
||||
oXlsx.m_pStyles->m_oCellXfs->m_oCount->SetValue(oXlsx.m_pStyles->m_oCellXfs->m_arrItems.size());
|
||||
|
||||
OOX::Spreadsheet::CDxf* pDxf = new OOX::Spreadsheet::CDxf();
|
||||
pDxf->m_oBorder.Init();
|
||||
pDxf->m_oBorder->m_oStart.Init();
|
||||
@ -239,15 +249,16 @@ namespace BinXlsxRW{
|
||||
pDxf->m_oBorder->m_oBottom->m_oColor.Init();
|
||||
pDxf->m_oBorder->m_oBottom->m_oColor->m_oIndexed.Init();
|
||||
pDxf->m_oBorder->m_oBottom->m_oColor->m_oIndexed->SetValue(12);
|
||||
pStyles->m_oDxfs.Init();
|
||||
pStyles->m_oDxfs->m_arrItems.push_back(pDxf);
|
||||
pStyles->m_oDxfs->m_oCount.Init();
|
||||
pStyles->m_oDxfs->m_oCount->SetValue(pStyles->m_oDxfs->m_arrItems.size());
|
||||
|
||||
oXlsx.m_pStyles->m_oDxfs.Init();
|
||||
oXlsx.m_pStyles->m_oDxfs->m_arrItems.push_back(pDxf);
|
||||
oXlsx.m_pStyles->m_oDxfs->m_oCount.Init();
|
||||
oXlsx.m_pStyles->m_oDxfs->m_oCount->SetValue(oXlsx.m_pStyles->m_oDxfs->m_arrItems.size());
|
||||
//Table
|
||||
//todo table в случае нескольких sheet или если серии разнесены по sheet
|
||||
if(m_aTableNames.size() > 0)
|
||||
{
|
||||
OOX::Spreadsheet::CTableFile* pTable = new OOX::Spreadsheet::CTableFile();
|
||||
OOX::Spreadsheet::CTableFile* pTable = new OOX::Spreadsheet::CTableFile(NULL);
|
||||
pTable->m_oTable.Init();
|
||||
pTable->m_oTable->m_oDisplayName.Init();
|
||||
pTable->m_oTable->m_oDisplayName->append(L"Table1");
|
||||
@ -290,9 +301,11 @@ namespace BinXlsxRW{
|
||||
{
|
||||
OOX::Spreadsheet::CTablePart* pTablePart = new OOX::Spreadsheet::CTablePart();
|
||||
NSCommon::smart_ptr<OOX::File> pTableFile(pTable);
|
||||
|
||||
const OOX::RId oRId = pFirstWorksheet->Add(pTableFile);
|
||||
pTablePart->m_oRId.Init();
|
||||
pTablePart->m_oRId->SetValue(oRId.get());
|
||||
|
||||
pFirstWorksheet->m_oTableParts.Init();
|
||||
pFirstWorksheet->m_oTableParts->m_arrItems.push_back(pTablePart);
|
||||
pFirstWorksheet->m_oTableParts->m_oCount.Init();
|
||||
@ -462,15 +475,15 @@ namespace BinXlsxRW{
|
||||
//проверяем можем ли создать таблицу
|
||||
if(m_mapSheets.size() > 0 && m_nRow1 > 0 && m_nRow2 > 0 && m_nCol1 > 0 && m_nCol2 > 0 && m_nRow1 < m_nRow2)
|
||||
{
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
|
||||
if(itRows != rows->end())
|
||||
{
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
std::vector<int> aIndexesCell;
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); ++it)
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
@ -490,14 +503,14 @@ namespace BinXlsxRW{
|
||||
}
|
||||
}
|
||||
}
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(std::vector<OOX::Spreadsheet::CWorksheet*>& arWorksheets, std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
{
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = NULL;
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator pFind = mapWorksheets.find(sName);
|
||||
|
||||
if (it == mapWorksheets.end())
|
||||
if (pFind == mapWorksheets.end())
|
||||
{
|
||||
pWorksheet = new OOX::Spreadsheet::CWorksheet();
|
||||
pWorksheet = new OOX::Spreadsheet::CWorksheet(NULL);
|
||||
pWorksheet->m_oSheetFormatPr.Init();
|
||||
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight.Init();
|
||||
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight->SetValue(15);
|
||||
@ -517,19 +530,20 @@ namespace BinXlsxRW{
|
||||
pWorksheet->m_oPageMargins->m_oFooter->FromInches(0.3);
|
||||
|
||||
mapWorksheets[sName] = pWorksheet;
|
||||
arWorksheets.push_back(pWorksheet);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWorksheet = it->second;
|
||||
pWorksheet = pFind->second;
|
||||
}
|
||||
return pWorksheet;
|
||||
}
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
{
|
||||
pWorksheet->m_oSheetData.Init();
|
||||
std::vector<int> aIndexesRow;
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
{
|
||||
aIndexesRow.push_back(it->first);
|
||||
}
|
||||
@ -544,10 +558,10 @@ namespace BinXlsxRW{
|
||||
pRow->m_oR.Init();
|
||||
pRow->m_oR->SetValue(nIndexRow);
|
||||
|
||||
const boost::unordered_map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
const std::map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
std::vector<int> aIndexesCell;
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); ++it)
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
@ -605,24 +619,24 @@ namespace BinXlsxRW{
|
||||
}
|
||||
void ChartWriter::parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format = NULL)
|
||||
{
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
|
||||
if(itSheets == m_mapSheets.end())
|
||||
{
|
||||
rows = new boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
rows = new std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
m_mapSheets.insert(std::make_pair(sheet, rows));
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = itSheets->second;
|
||||
}
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
|
||||
if(itRows == rows->end())
|
||||
{
|
||||
cells = new boost::unordered_map<int, OOX::Spreadsheet::CCell*>();
|
||||
cells = new std::map<int, OOX::Spreadsheet::CCell*>();
|
||||
rows->insert(std::make_pair(nRow, cells));
|
||||
}
|
||||
else
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace OOX
|
||||
@ -59,8 +60,8 @@ namespace BinXlsxRW {
|
||||
class ChartWriter
|
||||
{
|
||||
public:
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
boost::unordered_map<std::wstring, int> m_mapFormats;
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
boost::unordered_map<std::wstring, int> m_mapFormats;
|
||||
|
||||
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
|
||||
std::vector<std::wstring> m_aTableNames;
|
||||
@ -76,8 +77,9 @@ namespace BinXlsxRW {
|
||||
void parseChart(const OOX::Spreadsheet::CT_Chart* pChart);
|
||||
|
||||
private:
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
|
||||
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::vector<OOX::Spreadsheet::CWorksheet*>& arWorksheets, std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
|
||||
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
|
||||
|
||||
void parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
|
||||
OOX::Spreadsheet::CCell* parseCreateCell(const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
|
||||
void parseStrRef(const OOX::Spreadsheet::CT_StrRef* pStrRef, bool bUpdateRange, const wchar_t* cRangeName);
|
||||
|
||||
@ -39,6 +39,9 @@
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
|
||||
int BinDocxRW::g_nCurFormatVersion = 0;
|
||||
|
||||
BinDocxRW::CDocxSerializer::CDocxSerializer()
|
||||
@ -47,7 +50,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
|
||||
m_pCurFileWriter = NULL;
|
||||
|
||||
m_bIsNoBase64Save = false;
|
||||
m_bIsNoBase64 = false;
|
||||
m_bIsNoBase64 = false;
|
||||
m_bSaveChartAsImg = false;
|
||||
}
|
||||
BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
@ -292,7 +295,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
|
||||
OOX::CPath DocProps = std::wstring(_T("docProps"));
|
||||
|
||||
OOX::CApp* pApp = new OOX::CApp();
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(_T("OnlyOffice"));
|
||||
@ -306,7 +309,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
|
||||
delete pApp;
|
||||
}
|
||||
OOX::CCore* pCore = new OOX::CCore();
|
||||
OOX::CCore* pCore = new OOX::CCore(NULL);
|
||||
if (pCore)
|
||||
{
|
||||
pCore->SetCreator(_T(""));
|
||||
|
||||
@ -33,6 +33,12 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h"
|
||||
|
||||
#include "../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
|
||||
#include "../../Common/ASCUtils.h"
|
||||
|
||||
namespace DocWrapper {
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "ChartWriter.h"
|
||||
|
||||
#include "../BinReader/DefaultThemeWriter.h"
|
||||
//#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
|
||||
|
||||
namespace BinXlsxRW{
|
||||
int g_nCurFormatVersion = 0;
|
||||
@ -168,7 +169,7 @@ namespace BinXlsxRW{
|
||||
|
||||
//todo theme path
|
||||
BinXlsxRW::SaveParams oSaveParams(sThemePath, m_pExternalDrawingConverter->GetContentTypes());
|
||||
OOX::Spreadsheet::CChartSpace oChartSpace;
|
||||
OOX::Spreadsheet::CChartSpace oChartSpace(NULL);
|
||||
BinXlsxRW::BinaryChartReader oBinaryChartReader(*pReader, oSaveParams, m_pExternalDrawingConverter);
|
||||
|
||||
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace.m_oChartSpace);
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
ShowProgress="0"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
|
||||
@ -732,16 +732,38 @@ void docx_conversion_context::start_process_style_content()
|
||||
styles_context_.start();
|
||||
}
|
||||
|
||||
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)
|
||||
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)//from page layout
|
||||
{
|
||||
int count_columns = 1;
|
||||
bool sep_columns = false;
|
||||
|
||||
oox::section_context::_section & section = get_section_context().get();
|
||||
|
||||
if (!columns)
|
||||
{
|
||||
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
|
||||
{
|
||||
if (const odf_reader::style_content * content = secStyle->content())
|
||||
{
|
||||
if (odf_reader::style_section_properties * sectPr = content->get_style_section_properties())
|
||||
{
|
||||
columns = dynamic_cast<odf_reader::style_columns *>( sectPr->style_columns_.get());
|
||||
|
||||
section.margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
|
||||
section.margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
|
||||
}
|
||||
}
|
||||
if (section.is_dump_)
|
||||
{
|
||||
get_section_context().remove_section();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<double, double>> width_space;
|
||||
if (columns)
|
||||
{
|
||||
if ((columns->fo_column_count_) && (*columns->fo_column_count_ > 1))
|
||||
if (columns->fo_column_count_)
|
||||
{
|
||||
count_columns = *columns->fo_column_count_;
|
||||
}
|
||||
@ -750,44 +772,63 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
|
||||
if (columns_sep->style_style_ != _T("none"))
|
||||
sep_columns = true;
|
||||
}
|
||||
}
|
||||
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
|
||||
{
|
||||
if (const odf_reader::style_content * content = secStyle->content())
|
||||
{
|
||||
if (odf_reader::style_section_properties * sectPr = content->get_style_section_properties())
|
||||
{
|
||||
if (odf_reader::style_columns * columns = dynamic_cast<odf_reader::style_columns *>( sectPr->style_columns_.get() ))
|
||||
{
|
||||
if (columns->fo_column_count_)
|
||||
{
|
||||
count_columns = *columns->fo_column_count_;
|
||||
}
|
||||
if (odf_reader::style_column_sep * columns_sep = dynamic_cast<odf_reader::style_column_sep *>( columns->style_column_sep_.get() ))
|
||||
{
|
||||
if (columns_sep->style_style_ != _T("none"))
|
||||
sep_columns = true;
|
||||
}
|
||||
}
|
||||
|
||||
section.margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
|
||||
section.margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
|
||||
if (!columns->style_columns_.empty())
|
||||
{
|
||||
double page_width = 0;
|
||||
const odf_reader::page_layout_instance * pp = root()->odf_context().pageLayoutContainer().page_layout_first();
|
||||
if (pp)
|
||||
{
|
||||
odf_reader::style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
|
||||
if (attr_page.fo_page_width_)
|
||||
{
|
||||
page_width = attr_page.fo_page_width_->get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
if (attr_page.common_horizontal_margin_attlist_.fo_margin_left_)
|
||||
{
|
||||
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
if (attr_page.common_horizontal_margin_attlist_.fo_margin_right_)
|
||||
{
|
||||
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_right_->get_length().get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; page_width > 0, i < columns->style_columns_.size(); i++)
|
||||
{
|
||||
odf_reader::style_column * col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i].get());
|
||||
if (!col) continue;
|
||||
|
||||
double width = page_width * (col->style_rel_width_ ? col->style_rel_width_->get_value() / 65535. : 0);
|
||||
|
||||
double space = col->fo_end_indent_ ? col->fo_end_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
|
||||
if (i < columns->style_columns_.size() - 1)
|
||||
{
|
||||
col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i + 1].get());
|
||||
space += col->fo_start_indent_ ? col->fo_start_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
}
|
||||
|
||||
width_space.push_back(std::make_pair(width, space));
|
||||
}
|
||||
}
|
||||
if (section.is_dump_)
|
||||
{
|
||||
get_section_context().remove_section();
|
||||
}
|
||||
}
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:cols")
|
||||
{
|
||||
CP_XML_ATTR(L"w:equalWidth", L"true");
|
||||
CP_XML_ATTR(L"w:equalWidth", width_space.empty());
|
||||
CP_XML_ATTR(L"w:num", count_columns);
|
||||
CP_XML_ATTR(L"w:sep", sep_columns);
|
||||
CP_XML_ATTR(L"w:space",0);
|
||||
CP_XML_ATTR(L"w:space", 708);
|
||||
|
||||
for (size_t i = 0; i < width_space.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"w:col")
|
||||
{
|
||||
CP_XML_ATTR(L"w:w", (int)(width_space[i].first * 20));
|
||||
CP_XML_ATTR(L"w:space", (int)(width_space[i].second * 20));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -846,18 +887,18 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
//Tutor_Charlotte_Tutor_the_Entire_World_.odt
|
||||
if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_ || in_header_)
|
||||
&& !get_table_context().in_table() && !in_drawing)
|
||||
{//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
|
||||
CP_XML_NODE(L"w:pPr")
|
||||
{
|
||||
CP_XML_STREAM() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
}
|
||||
////Tutor_Charlotte_Tutor_the_Entire_World_.odt
|
||||
//if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_ || in_header_)
|
||||
// && !get_table_context().in_table() && !in_drawing)
|
||||
//{//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
|
||||
// CP_XML_NODE(L"w:pPr")
|
||||
// {
|
||||
// CP_XML_STREAM() << get_section_context().dump_;
|
||||
// get_section_context().dump_.clear();
|
||||
// }
|
||||
// finish_paragraph();
|
||||
// start_paragraph();
|
||||
//}
|
||||
|
||||
if (!paragraph_style.str().empty() || !ParentId.empty())
|
||||
{
|
||||
|
||||
@ -201,18 +201,24 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
|
||||
CP_XML_NODE(L"w:keepNext");
|
||||
CP_XML_NODE(L"w:framePr")
|
||||
{
|
||||
CP_XML_ATTR(L"w:dropCap", L"drop");
|
||||
if (Context.get_drop_cap_context().Scale > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"w:lines",Context.get_drop_cap_context().Scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"w:hSpace", Context.get_drop_cap_context().Space);
|
||||
}
|
||||
CP_XML_ATTR(L"w:wrap", L"around");
|
||||
CP_XML_ATTR(L"w:hAnchor", L"text");
|
||||
CP_XML_ATTR(L"w:vAnchor", L"text");
|
||||
CP_XML_ATTR(L"w:wrap", L"around");
|
||||
CP_XML_ATTR(L"w:dropCap", L"drop");
|
||||
CP_XML_ATTR(L"w:hSpace", Context.get_drop_cap_context().Space);
|
||||
CP_XML_ATTR(L"w:lines",Context.get_drop_cap_context().Scale);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"w:spacing")
|
||||
{
|
||||
CP_XML_ATTR(L"w:after", 0);
|
||||
if (Context.get_drop_cap_context().FontSize>0)
|
||||
if (Context.get_drop_cap_context().FontSize > 0)
|
||||
CP_XML_ATTR(L"w:line", Context.get_drop_cap_context().FontSize);
|
||||
else
|
||||
CP_XML_ATTR(L"w:line", 240);
|
||||
|
||||
@ -1236,12 +1236,19 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
|
||||
{
|
||||
int fontSize=0;
|
||||
if (Context.get_drop_cap_context().state()==2)
|
||||
{
|
||||
fontSize = process_font_size(fo_font_size_, Context.get_styles_context().get_current_processed_style(),false,
|
||||
Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7);//вместо 1 ДОЛЖНОБЫТЬ коэфф. межстрочного интервала!!!
|
||||
|
||||
if (fontSize < 1)
|
||||
fontSize = Context.get_drop_cap_context().FontSize / 7.52;
|
||||
}
|
||||
else
|
||||
{
|
||||
fontSize = process_font_size(fo_font_size_, Context.get_styles_context().get_current_processed_style());
|
||||
}
|
||||
|
||||
if (fontSize>0)
|
||||
if (fontSize > 0)
|
||||
{
|
||||
_rPr << L"<w:sz w:val=\"" << fontSize << "\" />";
|
||||
}
|
||||
|
||||
@ -734,7 +734,7 @@ void style_columns::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void style_columns::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if (L"style" == Ns && L"column" == Name)
|
||||
CP_CREATE_ELEMENT(style_column_);
|
||||
CP_CREATE_ELEMENT(style_columns_);
|
||||
else if (L"style" == Ns && L"column-sep" == Name)
|
||||
CP_CREATE_ELEMENT(style_column_sep_);
|
||||
else
|
||||
@ -750,11 +750,10 @@ const wchar_t * style_column::name = L"column";
|
||||
void style_column::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_, length(0.0, length::cm));
|
||||
|
||||
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_);
|
||||
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_);
|
||||
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_);
|
||||
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_);
|
||||
}
|
||||
|
||||
void style_column::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -764,7 +763,7 @@ void style_column::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_column_sep::ns = L"style";
|
||||
const wchar_t * style_column_sep::name = L":column-sep";
|
||||
const wchar_t * style_column_sep::name = L"column-sep";
|
||||
|
||||
void style_column_sep::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -1349,16 +1348,20 @@ void style_page_layout_properties::docx_serialize(std::wostream & strm, oox::doc
|
||||
{
|
||||
Context.process_section( CP_XML_STREAM(), columns);
|
||||
|
||||
bool next_page = Context.is_next_dump_page_properties();
|
||||
bool change_page_layout = Context.is_next_dump_page_properties();
|
||||
|
||||
CP_XML_NODE(L"w:type")
|
||||
{
|
||||
if (next_page) CP_XML_ATTR(L"w:val", L"nextPage");
|
||||
else CP_XML_ATTR(L"w:val", L"continuous");
|
||||
if (change_page_layout)
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", L"nextPage");
|
||||
}
|
||||
else
|
||||
CP_XML_ATTR(L"w:val", L"continuous");
|
||||
}
|
||||
|
||||
std::wstring masterPageName = Context.get_master_page_name();
|
||||
bool res = Context.get_headers_footers().write_sectPr(masterPageName, next_page, strm);
|
||||
bool res = Context.get_headers_footers().write_sectPr(masterPageName, change_page_layout, strm);
|
||||
|
||||
if (res == false)
|
||||
{
|
||||
@ -1369,7 +1372,7 @@ void style_page_layout_properties::docx_serialize(std::wostream & strm, oox::doc
|
||||
Context.remove_page_properties();
|
||||
Context.add_page_properties(masterPageNameLayout);
|
||||
|
||||
bool res = Context.get_headers_footers().write_sectPr(masterPageName, next_page, strm);
|
||||
bool res = Context.get_headers_footers().write_sectPr(masterPageName, change_page_layout, strm);
|
||||
}
|
||||
|
||||
oox::section_context::_section & section = Context.get_section_context().get();
|
||||
|
||||
@ -674,9 +674,6 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_footer_left);
|
||||
|
||||
/// style_columns
|
||||
/// style-columns
|
||||
/// style:columns
|
||||
class style_columns : public office_element_impl<style_columns>
|
||||
{
|
||||
public:
|
||||
@ -695,15 +692,12 @@ public:
|
||||
_CP_OPT(odf_types::length) fo_column_gap_;
|
||||
|
||||
office_element_ptr style_column_sep_;
|
||||
office_element_ptr_array style_column_;
|
||||
office_element_ptr_array style_columns_;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_columns);
|
||||
|
||||
/// style_column
|
||||
/// style-column
|
||||
/// style:column
|
||||
class style_column : public office_element_impl<style_column>
|
||||
{
|
||||
public:
|
||||
@ -719,18 +713,14 @@ private:
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::length) style_rel_width_;
|
||||
odf_types::length fo_start_indent_;
|
||||
odf_types::length fo_end_indent_;
|
||||
odf_types::length fo_space_before_;
|
||||
odf_types::length fo_space_after_;
|
||||
_CP_OPT(odf_types::length) fo_start_indent_;
|
||||
_CP_OPT(odf_types::length) fo_end_indent_;
|
||||
_CP_OPT(odf_types::length) fo_space_before_;
|
||||
_CP_OPT(odf_types::length) fo_space_after_;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_column);
|
||||
|
||||
/// style_column_sep
|
||||
/// style-column-sep
|
||||
/// style:column-sep
|
||||
class style_column_sep : public office_element_impl<style_column_sep>
|
||||
{
|
||||
public:
|
||||
@ -751,11 +741,9 @@ public:
|
||||
odf_types::vertical_align style_vertical_align_; //default top
|
||||
odf_types::color style_color_; // default #000000
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_column_sep);
|
||||
|
||||
|
||||
/// style:section-properties
|
||||
class style_section_properties : public office_element_impl<style_section_properties>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -126,8 +126,8 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
|
||||
if ((text_properties) && (text_properties->content().fo_font_size_))
|
||||
{
|
||||
Context.get_drop_cap_context().FontSize = styleContent->get_style_text_properties()->content().process_font_size(
|
||||
text_properties->content().fo_font_size_, Context.get_styles_context().get_current_processed_style(),false,
|
||||
7.25 * (Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7));//формула ачуметь !! - подбор вручную
|
||||
text_properties->content().fo_font_size_, Context.get_styles_context().get_current_processed_style(), false, //1.);
|
||||
7.25 * (Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7));//формула ачуметь !! - подбор вручную
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -185,6 +185,29 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
|
||||
Context.end_automatic_style();
|
||||
|
||||
Context.push_text_properties(styleContent->get_style_text_properties());
|
||||
|
||||
if (!Context.get_section_context().dump_.empty()
|
||||
&& !Context.get_table_context().in_table()
|
||||
&& (Context.get_process_note() == oox::docx_conversion_context::noNote)
|
||||
&& !in_drawing)
|
||||
{
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
if (Context.is_paragraph_header() )
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
|
||||
Context.output_stream() << L"</w:pPr>";
|
||||
Context.finish_paragraph();
|
||||
Context.start_paragraph();
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
Context.output_stream() << L"</w:pPr>";
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -326,18 +349,29 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
|
||||
|
||||
str=store_str.substr(str_start, str_size);
|
||||
}
|
||||
void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if ( content_.empty()) return;
|
||||
if ( content_.empty()) return 0;
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
while(index < content_.size()) // могут быть track-change, ...
|
||||
{
|
||||
if (content_[index]->get_type() == typeTextText ||
|
||||
content_[index]->get_type() == typeTextSpan)
|
||||
break;
|
||||
content_[index++]->docx_convert(Context);
|
||||
}
|
||||
|
||||
//в рассчет берутся только первые элементы !!! разные там break-и отменяют реэжим drop_cap!!- todooo сделать возможным множественным span
|
||||
if ( content_[0]->get_type() == typeTextText)
|
||||
if ( content_[index]->get_type() == typeTextText)
|
||||
{
|
||||
drop_cap_text_docx_convert(content_[0],Context);
|
||||
drop_cap_text_docx_convert(content_[index], Context);
|
||||
}
|
||||
else if (content_[0]->get_type() == typeTextSpan)
|
||||
else if (content_[index]->get_type() == typeTextSpan)
|
||||
{
|
||||
span* first_span_in_paragraph = dynamic_cast<span*>(content_[0].get());
|
||||
span* first_span_in_paragraph = dynamic_cast<span*>(content_[index].get());
|
||||
if (Context.get_drop_cap_context().FontSize < 1)
|
||||
{
|
||||
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_, style_family::Text,Context.process_headers_footers_);
|
||||
@ -350,19 +384,20 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
if ((text_properties) && (text_properties->content().fo_font_size_))
|
||||
{
|
||||
Context.get_drop_cap_context().FontSize = styleContent->get_style_text_properties()->content().process_font_size(
|
||||
text_properties->content().fo_font_size_, Context.get_styles_context().get_current_processed_style(),false,
|
||||
text_properties->content().fo_font_size_, Context.get_styles_context().get_current_processed_style(), false, //1);
|
||||
7.25 * (Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//в рассчет берутся только первые элементы !!! разные там break-и отменяют реэжим drop_cap!!
|
||||
if ((first_span_in_paragraph->content_.size()>0) &&
|
||||
if ((!first_span_in_paragraph->content_.empty()) &&
|
||||
(first_span_in_paragraph->content_[0]->get_type() == typeTextText))
|
||||
{
|
||||
drop_cap_text_docx_convert(first_span_in_paragraph->content_[0],Context);
|
||||
drop_cap_text_docx_convert(first_span_in_paragraph->content_[0], Context);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -404,8 +439,8 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
// проверяем не сменит ли следующий параграф свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
|
||||
// распечатать свойства секции
|
||||
//проверить ... не она ли основная - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
// распечатать свойства раздела
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
|
||||
|
||||
@ -434,12 +469,17 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
std::wstringstream strm;
|
||||
if (Context.process_page_properties(strm))
|
||||
{
|
||||
Context.get_section_context().dump_ = strm.str();
|
||||
}
|
||||
process_paragraph_drop_cap_attr(attrs_, Context);
|
||||
|
||||
size_t index = 0;
|
||||
if (Context.get_drop_cap_context().state() == 2)//active
|
||||
{
|
||||
drop_cap_docx_convert(Context);
|
||||
index = drop_cap_docx_convert(Context);
|
||||
|
||||
Context.finish_run();
|
||||
Context.finish_paragraph();
|
||||
@ -453,7 +493,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.add_note_reference();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
for (size_t i = index; i < content_.size(); i++)
|
||||
{
|
||||
if (Context.get_page_break())
|
||||
{
|
||||
@ -495,14 +535,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (is_empty)
|
||||
Context.output_stream() << emptyParagraphContent;
|
||||
|
||||
|
||||
Context.finish_paragraph();
|
||||
|
||||
std::wstringstream strm;
|
||||
if (Context.process_page_properties(strm))
|
||||
{
|
||||
Context.get_section_context().dump_ = strm.str();
|
||||
}
|
||||
}
|
||||
|
||||
void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert (oox::pptx_conversion_context & Context) ;
|
||||
|
||||
void drop_cap_docx_convert(oox::docx_conversion_context & Context);
|
||||
size_t drop_cap_docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
private:
|
||||
|
||||
@ -482,14 +482,12 @@ void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(lengt
|
||||
|
||||
if (width)
|
||||
{
|
||||
props->attlist_.fo_page_width_ =
|
||||
length(width->get_value_unit(length::cm), length::cm);
|
||||
props->attlist_.fo_page_width_ = length(width->get_value_unit(length::cm), length::cm);
|
||||
|
||||
current_page_width_ = width->get_value_unit(length::pt);
|
||||
}
|
||||
if (height)
|
||||
props->attlist_.fo_page_height_ =
|
||||
length(height->get_value_unit(length::cm),length::cm);
|
||||
props->attlist_.fo_page_height_ = length(height->get_value_unit(length::cm), length::cm);
|
||||
}
|
||||
void odf_page_layout_context::set_page_number_format(_CP_OPT(int) & type, _CP_OPT(int) & start)
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "styles.h"
|
||||
|
||||
#include "style_paragraph_properties.h"
|
||||
#include "style_text_properties.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -62,7 +63,17 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
|
||||
result->apply_from(parProps[i]->content_);
|
||||
}
|
||||
}
|
||||
void calc_text_properties_content(std::vector<style_text_properties*> & textProps, text_format_properties_content * result)
|
||||
{
|
||||
if (result == NULL)return;
|
||||
if (textProps.empty()) return;
|
||||
|
||||
for (int i = (int)textProps.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (textProps[i])
|
||||
result->apply_from(textProps[i]->content_);
|
||||
}
|
||||
}
|
||||
odf_style_context::odf_style_context()
|
||||
{
|
||||
//memset(style_family_counts_,0,sizeof(style_family_counts_));
|
||||
@ -424,12 +435,29 @@ office_element_ptr & odf_style_context::add_or_find(std::wstring name, style_fam
|
||||
|
||||
return style_state_list_.back()->get_office_element();
|
||||
}
|
||||
void odf_style_context::calc_text_properties(std::wstring style_name, odf_types::style_family::type family, text_format_properties_content * result)
|
||||
{
|
||||
std::vector<style_text_properties*> textProps;
|
||||
|
||||
while (!style_name.empty())
|
||||
{
|
||||
style *style_ = NULL;
|
||||
if (!find_odf_style(style_name, family, style_) || !style_)break;
|
||||
|
||||
if (style_text_properties * textProp = style_->content_.get_style_text_properties())
|
||||
textProps.push_back(textProp);
|
||||
|
||||
style_name = style_->style_parent_style_name_ ? *style_->style_parent_style_name_ : L"";
|
||||
|
||||
}
|
||||
calc_text_properties_content(textProps, result);
|
||||
}
|
||||
|
||||
void odf_style_context::calc_paragraph_properties(std::wstring style_name, style_family::type family, paragraph_format_properties * result)
|
||||
{
|
||||
std::vector<style_paragraph_properties*> parProps;
|
||||
|
||||
while (style_name.length()>0)
|
||||
while (!style_name.empty())
|
||||
{
|
||||
style *style_ = NULL;
|
||||
if (!find_odf_style(style_name, family, style_) || !style_)break;
|
||||
|
||||
@ -52,6 +52,7 @@ typedef shared_ptr<odf_style_context>::Type odf_style_context_ptr;
|
||||
|
||||
class style;
|
||||
class paragraph_format_properties;
|
||||
class text_format_properties_content;
|
||||
|
||||
class odf_style_context
|
||||
{
|
||||
@ -94,7 +95,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void calc_paragraph_properties(std::wstring style_name, odf_types::style_family::type family, paragraph_format_properties * result);
|
||||
|
||||
void calc_text_properties(std::wstring style_name, odf_types::style_family::type family, text_format_properties_content * result);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
std::wstring find_odf_style_name (int oox_id_style, odf_types::style_family::type family, bool root, bool automatic);//xlsx only
|
||||
bool find_odf_style_state(int oox_id_style, odf_types::style_family::type family, odf_style_state_ptr & state, bool root, bool automatic);//xlsx only
|
||||
|
||||
@ -507,7 +507,7 @@ void odt_conversion_context::add_section(bool continuous)
|
||||
}
|
||||
void odt_conversion_context::add_section_columns(int count, double space_pt, bool separator)
|
||||
{
|
||||
if (sections_.size() < 1 || count < 1) return;
|
||||
if (sections_.empty() || count < 1) return;
|
||||
|
||||
style* style_ = dynamic_cast<style*>(sections_.back().style_elm.get());
|
||||
if (!style_)return;
|
||||
@ -515,8 +515,10 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo
|
||||
style_section_properties * section_properties = style_->content_.get_style_section_properties();
|
||||
|
||||
create_element(L"style", L"columns",section_properties->style_columns_,this);
|
||||
|
||||
style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get());
|
||||
if (!columns)return;
|
||||
|
||||
sections_.back().count_columns = count;
|
||||
|
||||
columns->fo_column_count_ = count;
|
||||
@ -528,14 +530,14 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo
|
||||
style_column_sep* sep = dynamic_cast<style_column_sep*>(columns->style_column_sep_.get());
|
||||
if (sep)//default set
|
||||
{
|
||||
sep->style_width_ = length(0,length::cm);
|
||||
sep->style_width_ = length(0.035, length::cm);
|
||||
sep->style_height_ = percent(100);
|
||||
sep->style_vertical_align_ = vertical_align(vertical_align::Middle);
|
||||
sep->style_color_ = color(L"#000000");
|
||||
}
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::add_section_column(std::vector<std::pair<double,double>> width_space)
|
||||
void odt_conversion_context::add_section_column(std::vector<std::pair<double, double>> width_space)
|
||||
{
|
||||
if (sections_.size() < 1 || width_space.size() < 1) return;
|
||||
|
||||
@ -553,16 +555,15 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
|
||||
{
|
||||
if (width_space[i].first >= 0)
|
||||
|
||||
width_all += width_space[i].first/* + width_space[i].second*/;
|
||||
width_all += width_space[i].first + width_space[i].second;
|
||||
}
|
||||
|
||||
double curr = 0;
|
||||
int width_absolute = 0;
|
||||
|
||||
if (width_all < 1) return;
|
||||
|
||||
section_properties->style_editable_ = false;
|
||||
|
||||
double last_space = 0;
|
||||
|
||||
for (size_t i = 0; i < width_space.size() && width_all > 0 ; i++)
|
||||
{
|
||||
office_element_ptr col_elm;
|
||||
@ -571,18 +572,17 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
|
||||
style_column* col = dynamic_cast<style_column*>(col_elm.get());
|
||||
if (!col) continue;
|
||||
|
||||
int val = (width_space[i].first/* + width_space[i].second*/)* 65535. /width_all /*:65535 - width_absolute*/;
|
||||
int val = (width_space[i].first)* 65535. / width_all ;
|
||||
col->style_rel_width_ = odf_types::percent_rel(val);
|
||||
width_absolute += val;
|
||||
|
||||
//col->fo_start_indent_ = odf_types::length(curr,odf_types::length::pt);
|
||||
//curr += width_space[0].first;
|
||||
//
|
||||
//col->fo_end_indent_ = odf_types::length(curr,odf_types::length::pt);
|
||||
//curr += width_space[0].second;
|
||||
col->fo_start_indent_ = odf_types::length(last_space / 2, odf_types::length::pt);
|
||||
|
||||
col->fo_end_indent_ = odf_types::length(width_space[i].second / 2, odf_types::length::pt);
|
||||
|
||||
columns->add_child_element(col_elm);
|
||||
|
||||
last_space = width_space[i].second;
|
||||
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_field()
|
||||
|
||||
@ -115,6 +115,7 @@ public:
|
||||
void end_drop_cap ();
|
||||
bool in_drop_cap () {return drop_cap_state_.enabled;}
|
||||
style_text_properties* get_drop_cap_properties();
|
||||
int get_drop_cap_lines() {return drop_cap_state_.lines;}
|
||||
|
||||
bool start_comment (int oox_comment_id);
|
||||
void end_comment (int oox_comment_id);
|
||||
|
||||
@ -52,11 +52,15 @@
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
|
||||
|
||||
|
||||
@ -45,7 +45,10 @@
|
||||
#include "../OdfFormat/style_paragraph_properties.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Styles/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
@ -33,6 +33,18 @@
|
||||
#include "../utils.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Pict.h"
|
||||
@ -56,6 +68,8 @@
|
||||
|
||||
using namespace cpdoccore;
|
||||
|
||||
std::vector<double> current_font_size;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
@ -67,7 +81,7 @@ namespace Oox2Odf
|
||||
cols_1 = props1->m_oCols->m_oNum.IsInit() ? props1->m_oCols->m_oNum->GetValue() : 1;
|
||||
|
||||
if (!props1->m_oCols->m_arrColumns.empty())
|
||||
cols_1 = std::min(cols_1, props1->m_oCols->m_arrColumns.size());
|
||||
cols_1 = (std::min)(cols_1, props1->m_oCols->m_arrColumns.size());
|
||||
}
|
||||
if (props2)
|
||||
{
|
||||
@ -76,7 +90,7 @@ namespace Oox2Odf
|
||||
cols_2 = props2->m_oCols->m_oNum.IsInit() ? props2->m_oCols->m_oNum->GetValue() : 1;
|
||||
|
||||
if (!props2->m_oCols->m_arrColumns.empty())
|
||||
cols_2 = std::min(cols_2, props2->m_oCols->m_arrColumns.size());
|
||||
cols_2 = (std::min)(cols_2, props2->m_oCols->m_arrColumns.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -428,6 +442,8 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
odt_context->text_context()->set_KeepNextParagraph(false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
current_font_size.erase(current_font_size.begin() + 1, current_font_size.end());
|
||||
|
||||
bool bStyled = false;
|
||||
bool bStartNewParagraph = !odt_context->text_context()->get_KeepNextParagraph();
|
||||
|
||||
@ -567,8 +583,16 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
{
|
||||
if (odt_context->in_drop_cap())
|
||||
{
|
||||
convert(oox_paragraph->m_oParagraphProperty->m_oRPr.GetPointer(), odt_context->get_drop_cap_properties());
|
||||
//вообще то свойства правильные параграфа идут в следующем после буквицы параграфе
|
||||
odf_writer::style_text_properties *text_properties_drop_cap = odt_context->get_drop_cap_properties();
|
||||
convert(oox_paragraph->m_oParagraphProperty->m_oRPr.GetPointer(), text_properties_drop_cap);
|
||||
if (text_properties_drop_cap->content_.fo_font_size_)
|
||||
{
|
||||
double sz = text_properties_drop_cap->content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt);
|
||||
|
||||
sz = sz / 1.75 / odt_context->get_drop_cap_lines();
|
||||
text_properties_drop_cap->content_.fo_font_size_= odf_types::length(sz, odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1135,6 +1159,14 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
outline_level = *parent_paragraph_properties.content_.outline_level_;
|
||||
}
|
||||
//список тож явно ??? угу :( - выше + велосипед для хранения
|
||||
odf_writer::style_text_properties parent_text_properties;
|
||||
odt_context->styles_context()->calc_text_properties(style_name, odf_types::style_family::Paragraph, &parent_text_properties.content_);
|
||||
|
||||
if (parent_text_properties.content_.fo_font_size_)
|
||||
{
|
||||
current_font_size.push_back(parent_text_properties.content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (oox_paragraph_pr->m_oSpacing.IsInit())
|
||||
@ -1671,9 +1703,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
|
||||
std::vector<std::pair<double,double>> width_space;
|
||||
|
||||
for (size_t i =0; i< oox_section_pr->m_oCols->m_arrColumns.size(); i++)
|
||||
for (size_t i = 0; i< oox_section_pr->m_oCols->m_arrColumns.size(); i++)
|
||||
{
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i] == NULL) continue;
|
||||
|
||||
double space = default_space_pt;
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace.IsInit())
|
||||
space = oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace->ToPoints();
|
||||
@ -1684,10 +1717,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
|
||||
width_space.push_back(std::pair<double,double>(w, space));
|
||||
}
|
||||
//for (size_t i= oox_section_pr->m_oCols->m_arrColumns.size(); i< num_columns; i ++)
|
||||
//{
|
||||
// width_space.push_back(std::pair<double,double>(-1, default_space_pt));
|
||||
//}
|
||||
|
||||
odt_context->add_section_column(width_space);
|
||||
}
|
||||
}
|
||||
@ -2084,7 +2114,16 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
|
||||
if (oox_run_pr->m_oRStyle.IsInit() && oox_run_pr->m_oRStyle->m_sVal.IsInit())
|
||||
{
|
||||
odt_context->styles_context()->last_state()->set_parent_style_name(*oox_run_pr->m_oRStyle->m_sVal);
|
||||
std::wstring style_name = *oox_run_pr->m_oRStyle->m_sVal;
|
||||
odt_context->styles_context()->last_state()->set_parent_style_name(style_name);
|
||||
|
||||
odf_writer::style_text_properties parent_text_properties;
|
||||
odt_context->styles_context()->calc_text_properties(style_name, odf_types::style_family::Text, &parent_text_properties.content_);
|
||||
|
||||
if (parent_text_properties.content_.fo_font_size_)
|
||||
{
|
||||
current_font_size.push_back(parent_text_properties.content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
}
|
||||
}
|
||||
if (oox_run_pr->m_oBold.IsInit())
|
||||
{
|
||||
@ -2184,7 +2223,10 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
}
|
||||
if (oox_run_pr->m_oSz.IsInit() && oox_run_pr->m_oSz->m_oVal.IsInit())
|
||||
{
|
||||
OoxConverter::convert(oox_run_pr->m_oSz->m_oVal->ToPoints(), text_properties->content_.fo_font_size_);
|
||||
double font_size_pt = oox_run_pr->m_oSz->m_oVal->ToPoints();
|
||||
current_font_size.push_back(font_size_pt);
|
||||
|
||||
OoxConverter::convert(font_size_pt, text_properties->content_.fo_font_size_);
|
||||
}
|
||||
if (oox_run_pr->m_oKern.IsInit() && oox_run_pr->m_oKern->m_oVal.IsInit())
|
||||
{
|
||||
@ -2235,7 +2277,22 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
{
|
||||
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single);
|
||||
}
|
||||
if (oox_run_pr->m_oDStrike.IsInit() && oox_run_pr->m_oDStrike->m_oVal.ToBool())
|
||||
{
|
||||
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Double);
|
||||
}
|
||||
if (oox_run_pr->m_oSpacing.IsInit() && oox_run_pr->m_oSpacing->m_oVal.IsInit())
|
||||
{
|
||||
double spacing = oox_run_pr->m_oSpacing->m_oVal->ToPoints();
|
||||
text_properties->content_.fo_letter_spacing_ = odf_types::letter_spacing(odf_types::length(spacing, odf_types::length::pt));
|
||||
}
|
||||
if (oox_run_pr->m_oPosition.IsInit() && oox_run_pr->m_oPosition->m_oVal.IsInit())
|
||||
{
|
||||
double position_pt = oox_run_pr->m_oPosition->m_oVal->ToPoints();
|
||||
double percent = current_font_size.empty() ? 0 : position_pt / current_font_size.back() * 100;
|
||||
|
||||
text_properties->content_.style_text_position_ = odf_types::text_position(percent, 100.);
|
||||
}
|
||||
if (oox_run_pr->m_oBdr.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
@ -2703,6 +2760,9 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
|
||||
else if (oox_anchor->m_oWrapTight.IsInit())
|
||||
{
|
||||
odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Parallel);
|
||||
if (oox_anchor->m_oWrapTight->m_oWrapPolygon.IsInit())
|
||||
{
|
||||
}
|
||||
wrap_set = true;
|
||||
}
|
||||
else if (oox_anchor->m_oWrapTopAndBottom.IsInit())
|
||||
@ -2931,6 +2991,11 @@ void DocxConverter::convert_styles()
|
||||
for (size_t i=0; i< docx_styles->m_arrStyle.size(); i++)
|
||||
{
|
||||
if (docx_styles->m_arrStyle[i] == NULL) continue;
|
||||
|
||||
if (!current_font_size.empty())
|
||||
{
|
||||
current_font_size.erase(current_font_size.begin() + 1, current_font_size.end());
|
||||
}
|
||||
|
||||
convert(docx_styles->m_arrStyle[i]);
|
||||
|
||||
@ -2952,6 +3017,11 @@ void DocxConverter::convert_styles()
|
||||
|
||||
def_para_properties->apply_from(para_properties);
|
||||
def_text_properties->apply_from(text_properties);
|
||||
|
||||
if (def_text_properties->content_.fo_font_size_)
|
||||
{
|
||||
current_font_size.push_back(def_text_properties->content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
|
||||
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
pptx_document = new PPTX::Folder();
|
||||
pptx_document = new PPTX::Document();
|
||||
if (!pptx_document->isValid(oox_path.GetPath())) // true ???
|
||||
{
|
||||
delete pptx_document;
|
||||
|
||||
@ -45,12 +45,12 @@ namespace OOX
|
||||
}
|
||||
namespace PPTX
|
||||
{
|
||||
class Document;
|
||||
class TableStyles;
|
||||
class NotesSlide;
|
||||
class NotesMaster;
|
||||
class Presentation;
|
||||
class Comments;
|
||||
class Folder;
|
||||
|
||||
namespace Logic
|
||||
{
|
||||
@ -161,7 +161,7 @@ private:
|
||||
void convert(PPTX::Logic::SplitTransition *oox_transition);
|
||||
void convert(PPTX::Logic::ZoomTransition *oox_transition);
|
||||
|
||||
PPTX::Folder *pptx_document;
|
||||
PPTX::Document *pptx_document;
|
||||
PPTX::Presentation *presentation;
|
||||
cpdoccore::odf_writer::package::odf_document *output_document;
|
||||
|
||||
|
||||
@ -31,6 +31,16 @@
|
||||
*/
|
||||
#include "XlsxConverter.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Styles/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinkPath.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h"
|
||||
|
||||
#include "../OdfFormat/ods_conversion_context.h"
|
||||
|
||||
@ -89,7 +99,7 @@ odf_writer::odf_conversion_context* XlsxConverter::odf_context()
|
||||
PPTX::Theme* XlsxConverter::oox_theme()
|
||||
{
|
||||
if (xlsx_document)
|
||||
return xlsx_document->GetTheme();
|
||||
return xlsx_document->m_pTheme.operator->();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -159,10 +169,10 @@ void XlsxConverter::convert_sheets()
|
||||
{
|
||||
if (!ods_context) return;
|
||||
|
||||
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->GetWorkbook();
|
||||
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->m_pWorkbook;
|
||||
if (!Workbook) return;
|
||||
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = xlsx_document->GetWorksheets();
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*> &mapWorksheets = xlsx_document->m_mapWorksheets;
|
||||
|
||||
if(Workbook->m_oBookViews.IsInit())
|
||||
{
|
||||
@ -180,9 +190,9 @@ void XlsxConverter::convert_sheets()
|
||||
if(pSheet->m_oRid.IsInit())
|
||||
{
|
||||
std::wstring sSheetRId = pSheet->m_oRid.get2().ToString();
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pItWorksheet = arrWorksheets.find(sSheetRId);
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pFind = mapWorksheets.find(sSheetRId);
|
||||
|
||||
if (pItWorksheet->second)
|
||||
if (pFind != mapWorksheets.end())
|
||||
{
|
||||
ods_context->start_sheet();
|
||||
ods_context->current_table().set_table_name(pSheet->m_oName.get2());
|
||||
@ -190,7 +200,7 @@ void XlsxConverter::convert_sheets()
|
||||
pSheet->m_oState->GetValue() == SimpleTypes::Spreadsheet::visibleVeryHidden))
|
||||
ods_context->current_table().set_table_hidden(true);
|
||||
|
||||
convert(pItWorksheet->second);
|
||||
convert(pFind->second);
|
||||
ods_context->end_sheet();
|
||||
}
|
||||
}
|
||||
@ -444,10 +454,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CHyperlink *oox_hyperlink,OOX::Spr
|
||||
|
||||
std::wstring ref = oox_hyperlink->m_oRef.IsInit() ? oox_hyperlink->m_oRef.get() : L"";
|
||||
std::wstring link;
|
||||
if (oox_hyperlink->m_oRid.IsInit() && oox_sheet->GetCurRls())
|
||||
|
||||
if (oox_hyperlink->m_oRid.IsInit() && oox_sheet->m_pCurRels.IsInit())
|
||||
{
|
||||
OOX::Rels::CRelationShip* oRels = NULL;
|
||||
oox_sheet->GetCurRls()->GetRel( OOX::RId(oox_hyperlink->m_oRid->GetValue()), &oRels);
|
||||
oox_sheet->m_pCurRels->GetRel( OOX::RId(oox_hyperlink->m_oRid->GetValue()), &oRels);
|
||||
if(NULL != oRels && _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") == oRels->Type() )
|
||||
{
|
||||
if(oRels->IsExternal())
|
||||
@ -567,7 +578,7 @@ void XlsxConverter::convert_sharing_string(int number)
|
||||
{
|
||||
if (!ods_context) return;
|
||||
|
||||
const OOX::Spreadsheet::CSharedStrings *SharedStrings= xlsx_document->GetSharedStrings();
|
||||
const OOX::Spreadsheet::CSharedStrings *SharedStrings= xlsx_document->m_pSharedStrings;
|
||||
if (!SharedStrings) return;
|
||||
|
||||
if (number >=0 && number < SharedStrings->m_arrItems.size())
|
||||
@ -877,7 +888,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetPr *oox_sheet_pr)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CWorkbookView *oox_book_views)
|
||||
{
|
||||
if (!oox_book_views)return;
|
||||
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->GetWorkbook();
|
||||
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->m_pWorkbook;
|
||||
if (!Workbook) return;
|
||||
|
||||
ods_context->settings_context()->start_view();
|
||||
@ -1208,7 +1219,7 @@ void XlsxConverter::convert_styles()
|
||||
ods_context->styles_context()->create_default_style(odf_types::style_family::TableCell);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->m_pStyles;
|
||||
|
||||
if (!xlsx_styles)return;
|
||||
//todooo ?? стоит ли обращать на параметр Count ??
|
||||
@ -1632,7 +1643,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
|
||||
}
|
||||
if(color->m_oIndexed.IsInit())
|
||||
{
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->m_pStyles;
|
||||
|
||||
int ind = color->m_oIndexed->GetValue();
|
||||
|
||||
@ -1755,7 +1766,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_dx_id)
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool automatic, bool root)
|
||||
{
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->m_pStyles;
|
||||
|
||||
int id_parent = xfc_style->m_oXfId.IsInit() ? xfc_style->m_oXfId->GetValue() : -1;
|
||||
int fill_id = xfc_style->m_oFillId.IsInit() ? xfc_style->m_oFillId->GetValue() : -1;
|
||||
|
||||
@ -1616,7 +1616,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
|
||||
if (NSFile::CFileBinary::Exists(pathDiagramDrawing.GetPath()))
|
||||
{
|
||||
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(pathDiagramDrawing)));
|
||||
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(NULL, pathDiagramDrawing)));
|
||||
if (oFileDrawing.IsInit())
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
}
|
||||
|
||||
@ -45,13 +45,14 @@ typedef bool (*progress_operation) (void*, long, long);
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Folder;
|
||||
class Document;
|
||||
}
|
||||
|
||||
class CPPTXFile : public PPTX::IPPTXEvent
|
||||
{
|
||||
private:
|
||||
PPTX::Folder* m_pFolder;
|
||||
PPTX::Document* m_pPptxDocument;
|
||||
|
||||
std::wstring m_strTempDir;
|
||||
std::wstring m_strDirectory;
|
||||
|
||||
|
||||
@ -74,12 +74,12 @@ CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_direct
|
||||
m_fCallbackProgress = fCallbackProgress;
|
||||
m_pCallbackArg = pCallbackArg;
|
||||
|
||||
m_pFolder = NULL;
|
||||
m_pPptxDocument = NULL;
|
||||
}
|
||||
|
||||
CPPTXFile::~CPPTXFile()
|
||||
{
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
}
|
||||
HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring sXMLOptions)
|
||||
{
|
||||
@ -109,21 +109,21 @@ HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath
|
||||
localTempDir = sSrcFileName;
|
||||
}
|
||||
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
m_pFolder = new PPTX::Folder();
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
m_pPptxDocument = new PPTX::Document();
|
||||
|
||||
if(!m_pFolder->isValid(localTempDir))
|
||||
if(!m_pPptxDocument->isValid(localTempDir))
|
||||
{
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
}
|
||||
m_pFolder->read(localTempDir, (PPTX::IPPTXEvent*)this);
|
||||
m_pPptxDocument->read(localTempDir, (PPTX::IPPTXEvent*)this);
|
||||
if(GetPercent() < 1000000)
|
||||
{
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
}
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pFolder->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pPptxDocument->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
if (!presentation.is_init())
|
||||
{
|
||||
NSDirectory::DeleteDirectory(m_strTempDir, false);
|
||||
@ -139,12 +139,12 @@ HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath
|
||||
}
|
||||
HRESULT CPPTXFile::SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath, std::wstring sXMLOptions)
|
||||
{
|
||||
if (NULL == m_pFolder)
|
||||
if (NULL == m_pPptxDocument)
|
||||
return S_FALSE;
|
||||
|
||||
OOX::CPath oPath;
|
||||
oPath.m_strFilename = std::wstring(sSrcPath);
|
||||
m_pFolder->write(oPath);
|
||||
m_pPptxDocument->write(oPath);
|
||||
|
||||
std::wstring srcFilePath = sSrcPath;
|
||||
std::wstring dstFileName = sDstFileName;
|
||||
@ -187,7 +187,7 @@ HRESULT CPPTXFile::GetBluRayXml(std::wstring* pbstrDVDXml)
|
||||
}
|
||||
HRESULT CPPTXFile::get_DrawingXml(std::wstring* pVal)
|
||||
{
|
||||
if ((NULL == m_pFolder) || (NULL == pVal))
|
||||
if ((NULL == m_pPptxDocument) || (NULL == pVal))
|
||||
return S_FALSE;
|
||||
|
||||
return S_OK;
|
||||
@ -278,22 +278,22 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
{
|
||||
OOX::CPath pathInputDirectory = bsInput;
|
||||
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
m_pFolder = new PPTX::Folder();
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
m_pPptxDocument = new PPTX::Document();
|
||||
|
||||
if (!m_pFolder->isValid(pathInputDirectory.GetPath())) // true ???
|
||||
if (!m_pPptxDocument->isValid(pathInputDirectory.GetPath())) // true ???
|
||||
{
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
m_pFolder->read(pathInputDirectory.GetPath() + FILE_SEPARATOR_STR, (PPTX::IPPTXEvent*)this);
|
||||
m_pPptxDocument->read(pathInputDirectory.GetPath() + FILE_SEPARATOR_STR, (PPTX::IPPTXEvent*)this);
|
||||
if(GetPercent() < 1000000)
|
||||
{
|
||||
RELEASEOBJECT(m_pFolder);
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
}
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pFolder->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pPptxDocument->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
if (!presentation.is_init())
|
||||
{
|
||||
NSDirectory::DeleteDirectory(m_strTempDir, false);
|
||||
@ -329,7 +329,7 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
}
|
||||
}
|
||||
|
||||
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, pathDstFileOutput.GetPath(), m_bIsNoBase64);
|
||||
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pPptxDocument, m_strDirectory, pathDstFileOutput.GetPath(), m_bIsNoBase64);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ namespace PPTX2EditorAdvanced
|
||||
{
|
||||
using namespace NSBinPptxRW;
|
||||
|
||||
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile, bool bIsNoBase64)
|
||||
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Document& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile, bool bIsNoBase64)
|
||||
{
|
||||
// сначала соберем все объекты для конвертации и сформируем main-таблицы
|
||||
NSBinPptxRW::CCommonWriter* pCommon = oBinaryWriter.m_pCommon;
|
||||
|
||||
@ -65,6 +65,7 @@ namespace NSBinPptxRW
|
||||
std::vector<LONG> m_arNotesSlides_Master;
|
||||
std::vector<LONG> m_arNotesMasters_Theme;
|
||||
|
||||
PPTX::Document m_oDocument;
|
||||
PPTX::Presentation m_oPresentation;
|
||||
PPTX::TableStyles m_oTableStyles;
|
||||
OOX::CVmlDrawing m_oVmlDrawing;
|
||||
@ -78,7 +79,9 @@ namespace NSBinPptxRW
|
||||
|
||||
public:
|
||||
|
||||
CPPTXWriter()
|
||||
CPPTXWriter() : m_oPresentation(&m_oDocument), m_oTableStyles(&m_oDocument), m_oVmlDrawing(&m_oDocument),
|
||||
m_oApp(&m_oDocument), m_oCore(&m_oDocument), m_oViewProps(&m_oDocument), m_oPresProps(&m_oDocument), m_oDefaultNote(&m_oDocument)
|
||||
|
||||
{
|
||||
m_strDstFolder = _T("");
|
||||
m_bIsDefaultNoteMaster = true;
|
||||
@ -395,7 +398,7 @@ namespace NSBinPptxRW
|
||||
continue;
|
||||
}
|
||||
|
||||
PPTX::Theme elm;
|
||||
PPTX::Theme elm(&m_oDocument);
|
||||
m_arThemes.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
@ -434,7 +437,7 @@ namespace NSBinPptxRW
|
||||
|
||||
for (LONG i = 0; i < nCountMasters; ++i)
|
||||
{
|
||||
PPTX::SlideMaster elm;
|
||||
PPTX::SlideMaster elm(&m_oDocument);
|
||||
m_arSlideMasters.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
@ -484,7 +487,7 @@ namespace NSBinPptxRW
|
||||
|
||||
for (LONG i = 0; i < nCountLayouts; ++i)
|
||||
{
|
||||
PPTX::SlideLayout elm;
|
||||
PPTX::SlideLayout elm(&m_oDocument);
|
||||
m_arSlideLayouts.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
@ -521,7 +524,7 @@ namespace NSBinPptxRW
|
||||
|
||||
for (LONG i = 0; i < lCount; ++i)
|
||||
{
|
||||
PPTX::NotesSlide elm;
|
||||
PPTX::NotesSlide elm(&m_oDocument);
|
||||
m_arNotesSlides.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
@ -568,7 +571,7 @@ namespace NSBinPptxRW
|
||||
NSDirectory::CreateDirectory(pathFolder.GetPath());
|
||||
NSDirectory::CreateDirectory(pathFolderRels.GetPath());
|
||||
|
||||
PPTX::NotesMaster elm;
|
||||
PPTX::NotesMaster elm(&m_oDocument);
|
||||
m_arNotesMasters.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
@ -613,7 +616,7 @@ namespace NSBinPptxRW
|
||||
|
||||
for (LONG i = 0; i < nCountSlides; ++i)
|
||||
{
|
||||
PPTX::Slide elm;
|
||||
PPTX::Slide elm(&m_oDocument);
|
||||
m_arSlides.push_back(elm);
|
||||
|
||||
m_oReader.m_pRels->Clear();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
@ -267,51 +267,51 @@ namespace NSShapeImageGen
|
||||
if (width < 0 && height < 0) return GenerateImageID(strFile, L"", -1, -1, strAdditionalFile, typeAdditionalFile);
|
||||
return GenerateImageID(strFile, L"", (std::max)(1.0, width), (std::max)(1.0, height), strAdditionalFile, typeAdditionalFile);
|
||||
}
|
||||
CMediaInfo WriteMedia(const std::wstring& strFile)
|
||||
{
|
||||
bool bIsDownload = false;
|
||||
int n1 = (int)strFile.find (L"www");
|
||||
int n2 = (int)strFile.find (L"http");
|
||||
int n3 = (int)strFile.find (L"ftp");
|
||||
int n4 = (int)strFile.find (L"https");
|
||||
|
||||
CMediaInfo WriteMedia(const std::wstring& strFile)
|
||||
{
|
||||
bool bIsDownload = false;
|
||||
int n1 = (int)strFile.find (L"www");
|
||||
int n2 = (int)strFile.find (L"http");
|
||||
int n3 = (int)strFile.find (L"ftp");
|
||||
int n4 = (int)strFile.find (L"https");
|
||||
|
||||
//если nI сранивать не с 0, то будут проблемы
|
||||
//потому что в инсталяции мы кладем файлы в /var/www...
|
||||
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
|
||||
bIsDownload = true;
|
||||
|
||||
if (bIsDownload)
|
||||
{
|
||||
|
||||
std::wstring strFileUrl = strFile;
|
||||
|
||||
XmlUtils::replace_all(strFileUrl, L"\\", L"/");
|
||||
XmlUtils::replace_all(strFileUrl, L"http:/", L"http://");
|
||||
XmlUtils::replace_all(strFileUrl, L"https:/", L"https://");
|
||||
XmlUtils::replace_all(strFileUrl, L"ftp:/", L"ftp://");
|
||||
|
||||
|
||||
CMediaInfo oInfo;
|
||||
std::map<std::wstring, CMediaInfo>::iterator pPair = m_mapMediaFiles.find(strFileUrl);
|
||||
|
||||
if (pPair != m_mapMediaFiles.end())
|
||||
return pPair->second;
|
||||
|
||||
std::wstring strDownload;
|
||||
|
||||
bIsDownload = true;
|
||||
|
||||
if (bIsDownload)
|
||||
{
|
||||
|
||||
std::wstring strFileUrl = strFile;
|
||||
|
||||
XmlUtils::replace_all(strFileUrl, L"\\", L"/");
|
||||
XmlUtils::replace_all(strFileUrl, L"http:/", L"http://");
|
||||
XmlUtils::replace_all(strFileUrl, L"https:/", L"https://");
|
||||
XmlUtils::replace_all(strFileUrl, L"ftp:/", L"ftp://");
|
||||
|
||||
|
||||
CMediaInfo oInfo;
|
||||
std::map<std::wstring, CMediaInfo>::iterator pPair = m_mapMediaFiles.find(strFileUrl);
|
||||
|
||||
if (pPair != m_mapMediaFiles.end())
|
||||
return pPair->second;
|
||||
|
||||
std::wstring strDownload;
|
||||
|
||||
#ifndef DISABLE_FILE_DOWNLOADER
|
||||
|
||||
CFileDownloader oDownloader(strFileUrl, true);
|
||||
if (oDownloader.DownloadSync())
|
||||
{
|
||||
strDownload = oDownloader.GetFilePath();
|
||||
}
|
||||
|
||||
#endif return GenerateMediaID(strDownload, strFileUrl);
|
||||
}
|
||||
else
|
||||
return GenerateMediaID(strFile, L"");
|
||||
}
|
||||
|
||||
CFileDownloader oDownloader(strFileUrl, true);
|
||||
if (oDownloader.DownloadSync())
|
||||
{
|
||||
strDownload = oDownloader.GetFilePath();
|
||||
}
|
||||
#endif
|
||||
return GenerateMediaID(strDownload, strFileUrl);
|
||||
}
|
||||
|
||||
return GenerateMediaID(strFile, L"");
|
||||
}
|
||||
void SetFontManager(CFontManager* pFontManager)
|
||||
{
|
||||
m_pFontManager = pFontManager;
|
||||
|
||||
@ -46,10 +46,10 @@ namespace PPTX
|
||||
class App : public WrapperFile
|
||||
{
|
||||
public:
|
||||
App()
|
||||
App(OOX::Document* pMain) : WrapperFile(pMain)
|
||||
{
|
||||
}
|
||||
App(const OOX::CPath& filename, FileMap& map)
|
||||
App(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
@ -57,7 +57,6 @@ namespace PPTX
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
HeadingPairs.clear();
|
||||
@ -116,8 +115,6 @@ namespace PPTX
|
||||
{
|
||||
WrapperFile::write(filename, directory, content);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::FileTypes::App;
|
||||
@ -220,7 +217,7 @@ namespace PPTX
|
||||
pWriter->EndNode(_T("Properties"));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
nullable_string Template; // (Name of Document Template)
|
||||
nullable_int TotalTime; // (Total Edit Time Metadata Element)
|
||||
nullable_int Words; // (Word Count)
|
||||
|
||||
@ -139,10 +139,10 @@ namespace PPTX
|
||||
public:
|
||||
std::vector<PPTX::Logic::CommentAuthor> m_arAuthors;
|
||||
|
||||
Authors()
|
||||
Authors(OOX::Document* pMain) : WrapperFile(pMain)
|
||||
{
|
||||
}
|
||||
Authors(const OOX::CPath& filename, FileMap& map)
|
||||
Authors(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -277,10 +277,10 @@ namespace PPTX
|
||||
public:
|
||||
std::vector<PPTX::Logic::Comment> m_arComments;
|
||||
|
||||
Comments()
|
||||
Comments(OOX::Document* pMain) : WrapperFile(pMain)
|
||||
{
|
||||
}
|
||||
Comments(const OOX::CPath& filename, FileMap& map)
|
||||
Comments(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -46,10 +46,10 @@ namespace PPTX
|
||||
class Core : public WrapperFile
|
||||
{
|
||||
public:
|
||||
Core()
|
||||
Core(OOX::Document* pMain) : WrapperFile(pMain)
|
||||
{
|
||||
}
|
||||
Core(const OOX::CPath& filename, FileMap& map)
|
||||
Core(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -92,7 +92,6 @@ namespace PPTX
|
||||
|
||||
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path)
|
||||
{
|
||||
//OOX::IFileContainer::read(rels, path);
|
||||
}
|
||||
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
|
||||
{
|
||||
@ -104,9 +103,9 @@ namespace PPTX
|
||||
pSrcFile->type() == OOX::Presentation::FileTypes::NotesSlide) ? true : false;
|
||||
}
|
||||
|
||||
for (boost::unordered_map<std::wstring, OOX::Rels::CRelationShip*>::const_iterator it = rels.m_mapRelations.begin(); it != rels.m_mapRelations.end(); ++it)
|
||||
for (size_t i = 0; i < rels.m_arRelations.size(); ++i)
|
||||
{
|
||||
OOX::Rels::CRelationShip* pRelation = it->second;
|
||||
OOX::Rels::CRelationShip* pRelation = rels.m_arRelations[i];
|
||||
|
||||
OOX::CPath normPath = CorrectPathRels(path, pRelation);
|
||||
|
||||
@ -116,7 +115,7 @@ namespace PPTX
|
||||
pRelation->Type() == OOX::Presentation::FileTypes::Slide))
|
||||
{// + external audio, video ... - в обычных ...
|
||||
|
||||
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
|
||||
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(OOX::IFileContainer::m_pMainDocument, pRelation->Target()));
|
||||
|
||||
if (pRelation->Type() == OOX::Presentation::FileTypes::Slide)
|
||||
{
|
||||
@ -139,7 +138,7 @@ namespace PPTX
|
||||
{
|
||||
long percent = Event ? Event->GetPercent() : 0;
|
||||
|
||||
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map);
|
||||
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map, OOX::IFileContainer::m_pMainDocument);
|
||||
|
||||
if (file.IsInit() == false)
|
||||
continue;
|
||||
@ -178,8 +177,8 @@ namespace PPTX
|
||||
|
||||
void FileContainer::write(OOX::CRels& rels, const OOX::CPath& curdir, const OOX::CPath& directory, OOX::CContentTypes& content) const
|
||||
{
|
||||
boost::unordered_map<std::wstring, size_t> mNamePair;
|
||||
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
std::map<std::wstring, size_t> mNamePair;
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
|
||||
@ -230,7 +229,7 @@ namespace PPTX
|
||||
|
||||
void FileContainer::WrittenSetFalse()
|
||||
{
|
||||
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
|
||||
|
||||
@ -33,9 +33,12 @@
|
||||
#ifndef PPTX_IFILE_CONTAINER_INCLUDE_H_
|
||||
#define PPTX_IFILE_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/IFileContainer.h"
|
||||
#include "FileMap.h"
|
||||
#include "PPTXEvent.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/IFileContainer.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/External.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
@ -44,7 +47,7 @@ namespace PPTX
|
||||
class FileContainer : public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
FileContainer()
|
||||
FileContainer(OOX::Document *pMain) : OOX::IFileContainer(pMain)
|
||||
{
|
||||
m_lPercent = 0;
|
||||
m_bCancelled = false;
|
||||
@ -52,7 +55,32 @@ namespace PPTX
|
||||
virtual ~FileContainer()
|
||||
{
|
||||
}
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
protected:
|
||||
void read(const OOX::CPath& filename);
|
||||
void read(const OOX::CRels& rels, const OOX::CPath& path);
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& filename, OOX::Rels::CRelationShip& relation, FileMap& map)
|
||||
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& filename, OOX::Rels::CRelationShip& relation, FileMap& map, OOX::Document *pMain)
|
||||
{
|
||||
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false && !relation.IsExternal())
|
||||
{
|
||||
@ -79,67 +79,67 @@ namespace PPTX
|
||||
}
|
||||
|
||||
if (relation.Type() == OOX::FileTypes::App)
|
||||
return smart_ptr<OOX::File>(new PPTX::App(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::App(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::FileTypes::Core)
|
||||
return smart_ptr<OOX::File>(new PPTX::Core(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Core(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation ||
|
||||
relation.Type() == OOX::Presentation::FileTypes::PresentationMacro)
|
||||
return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Presentation(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::FileTypes::Theme)
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::SlideMaster)
|
||||
return smart_ptr<OOX::File>(new PPTX::SlideMaster(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::SlideMaster(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::SlideLayout)
|
||||
return smart_ptr<OOX::File>(new PPTX::SlideLayout(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::SlideLayout(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::Slide)
|
||||
return smart_ptr<OOX::File>(new PPTX::Slide(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Slide(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::HandoutMaster)
|
||||
return smart_ptr<OOX::File>(new PPTX::HandoutMaster(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::HandoutMaster(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::NotesMaster)
|
||||
return smart_ptr<OOX::File>(new PPTX::NotesMaster(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::NotesMaster(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::NotesSlide)
|
||||
return smart_ptr<OOX::File>(new PPTX::NotesSlide(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::NotesSlide(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::PresProps)
|
||||
return smart_ptr<OOX::File>(new PPTX::PresProps(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::PresProps(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::ViewProps)
|
||||
return smart_ptr<OOX::File>(new PPTX::ViewProps(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::ViewProps(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::TableStyles)
|
||||
return smart_ptr<OOX::File>(new PPTX::TableStyles(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::TableStyles(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::FileTypes::LegacyDiagramText)
|
||||
return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(filename));
|
||||
return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(pMain, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::VmlDrawing)
|
||||
return smart_ptr<OOX::File>(new OOX::CVmlDrawing(OOX::CPath(), filename));
|
||||
return smart_ptr<OOX::File>(new OOX::CVmlDrawing(pMain, OOX::CPath(), filename));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::CommentAuthors)
|
||||
return smart_ptr<OOX::File>(new PPTX::Authors(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Authors(pMain, filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::SlideComments)
|
||||
return smart_ptr<OOX::File>(new PPTX::Comments(filename, map));
|
||||
return smart_ptr<OOX::File>(new PPTX::Comments(pMain, filename, map));
|
||||
|
||||
else if (relation.Type() == OOX::FileTypes::Chart)
|
||||
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace(filename, filename));
|
||||
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace(pMain, filename, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::HyperLink)
|
||||
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
|
||||
return smart_ptr<OOX::File>(new OOX::HyperLink(pMain, relation.Target()));
|
||||
else if (relation.Type() == OOX::FileTypes::Image)
|
||||
return smart_ptr<OOX::File>(new OOX::Image(filename, relation.IsExternal()));
|
||||
return smart_ptr<OOX::File>(new OOX::Image(pMain, filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Audio)
|
||||
return smart_ptr<OOX::File>(new OOX::Audio(filename, relation.IsExternal()));
|
||||
return smart_ptr<OOX::File>(new OOX::Audio(pMain, filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Media)
|
||||
return smart_ptr<OOX::File>(new OOX::Media(filename, relation.IsExternal()));
|
||||
return smart_ptr<OOX::File>(new OOX::Media(pMain, filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Video)
|
||||
return smart_ptr<OOX::File>(new OOX::Video(filename, relation.IsExternal()));
|
||||
return smart_ptr<OOX::File>(new OOX::Video(pMain, filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Data)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramData(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramData(pMain, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::DiagDrawing)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(pMain, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::OleObject)
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject(pMain, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( pMain, filename, true ));
|
||||
else if (relation.Type() == OOX::FileTypes::VbaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( filename, filename ));
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( pMain, filename, filename ));
|
||||
else if (relation.Type() == OOX::FileTypes::JsaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( filename ));
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( pMain, filename ));
|
||||
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile(pMain));
|
||||
}
|
||||
|
||||
} // namespace PPTX
|
||||
|
||||
@ -45,7 +45,7 @@ namespace PPTX
|
||||
class FileFactory
|
||||
{
|
||||
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(const OOX::CPath& path, OOX::Rels::CRelationShip& relation, FileMap& map, OOX::Document *pMain);
|
||||
};
|
||||
} // namespace PPTX
|
||||
#endif // PPTX_FILEFACTORY_PPTX_INCLUDE_H_
|
||||
|
||||
@ -47,16 +47,16 @@
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
Folder::Folder()
|
||||
Document::Document() : FileContainer(this)
|
||||
{
|
||||
}
|
||||
|
||||
Folder::Folder(const OOX::CPath& path, IPPTXEvent* Event)
|
||||
Document::Document(const OOX::CPath& path, IPPTXEvent* Event) : FileContainer(this)
|
||||
{
|
||||
read(path, Event);
|
||||
}
|
||||
|
||||
void Folder::read(const OOX::CPath& path, IPPTXEvent* Event)
|
||||
void Document::read(const OOX::CPath& path, IPPTXEvent* Event)
|
||||
{
|
||||
OOX::CRels rels(path);
|
||||
PPTX::FileMap map;
|
||||
@ -165,7 +165,7 @@ namespace PPTX
|
||||
Event->Progress(0, 1000000);
|
||||
}
|
||||
|
||||
void Folder::write(const OOX::CPath& path)
|
||||
void Document::write(const OOX::CPath& path)
|
||||
{
|
||||
OOX::CSystemUtility::CreateDirectories(path);
|
||||
|
||||
@ -180,29 +180,29 @@ namespace PPTX
|
||||
FileContainer::WrittenSetFalse();
|
||||
}
|
||||
|
||||
void Folder::createFromTemplate(const OOX::CPath& path)
|
||||
void Document::createFromTemplate(const OOX::CPath& path)
|
||||
{
|
||||
//read(path);
|
||||
}
|
||||
|
||||
const bool Folder::isValid(const OOX::CPath& path) const
|
||||
const bool Document::isValid(const OOX::CPath& path) const
|
||||
{
|
||||
return true;//FileContainer::exist(OOX::Presentation::FileTypes::Presentation);
|
||||
}
|
||||
|
||||
void Folder::extractPictures(const OOX::CPath& path)
|
||||
void Document::extractPictures(const OOX::CPath& path)
|
||||
{
|
||||
OOX::CSystemUtility::CreateDirectories(path);
|
||||
FileContainer::ExtractPictures(path);
|
||||
}
|
||||
|
||||
void Folder::extractPictures(const OOX::CPath& source, const OOX::CPath& path)
|
||||
void Document::extractPictures(const OOX::CPath& source, const OOX::CPath& path)
|
||||
{
|
||||
//read(source);
|
||||
extractPictures(path);
|
||||
}
|
||||
|
||||
long Folder::CountFiles(const OOX::CPath& path)
|
||||
long Document::CountFiles(const OOX::CPath& path)
|
||||
{
|
||||
return OOX::CSystemUtility::GetFilesCount(path.GetDirectory(), true);
|
||||
}
|
||||
|
||||
@ -38,11 +38,11 @@
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Folder : public PPTX::FileContainer
|
||||
class Document : public OOX::Document, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
Folder();
|
||||
Folder(const OOX::CPath& path, IPPTXEvent* Event);
|
||||
Document();
|
||||
Document(const OOX::CPath& path, IPPTXEvent* Event);
|
||||
|
||||
void read(const OOX::CPath& path, IPPTXEvent* Event);
|
||||
void write(const OOX::CPath& path);
|
||||
|
||||
@ -47,10 +47,10 @@ namespace PPTX
|
||||
class HandoutMaster : public WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
HandoutMaster()
|
||||
HandoutMaster(OOX::Document* pMain): WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
HandoutMaster(const OOX::CPath& filename, FileMap& map)
|
||||
HandoutMaster(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -45,12 +45,12 @@ namespace PPTX
|
||||
//[MS-PPT] Section 2.9.1; DocumentTextInfoContainer
|
||||
{
|
||||
public:
|
||||
LegacyDiagramText()
|
||||
LegacyDiagramText(OOX::Document *pMain) : OOX::File(pMain)
|
||||
{
|
||||
m_Data = 0;
|
||||
m_DataSize = 0;
|
||||
}
|
||||
LegacyDiagramText(const OOX::CPath& filename)
|
||||
LegacyDiagramText(OOX::Document *pMain, const OOX::CPath& filename) : OOX::File(pMain)
|
||||
{
|
||||
m_Data = 0;
|
||||
m_DataSize = 0;
|
||||
|
||||
@ -162,6 +162,7 @@ namespace PPTX
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("p:controls"));
|
||||
pWriter->EndAttributes();
|
||||
|
||||
for (size_t i = 0; i < arrControls.size(); ++i)
|
||||
arrControls[i].toXmlWriter(pWriter);
|
||||
|
||||
@ -110,11 +110,9 @@ namespace PPTX
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*embed);
|
||||
if(parentFileIs<FileContainer>())
|
||||
return parentFileAs<FileContainer>().GetImagePathNameFromRId(*embed);
|
||||
|
||||
return _T("");
|
||||
}
|
||||
else if(link.IsInit())
|
||||
@ -126,11 +124,9 @@ namespace PPTX
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*link);
|
||||
if(parentFileIs<FileContainer>())
|
||||
return parentFileAs<FileContainer>().GetImagePathNameFromRId(*link);
|
||||
|
||||
return _T("");
|
||||
}
|
||||
return _T("");
|
||||
@ -140,12 +136,7 @@ namespace PPTX
|
||||
smart_ptr<OOX::OleObject> pOleObject;
|
||||
|
||||
if (pRels != NULL) pOleObject = pRels->Get<OOX::OleObject>(oRId);
|
||||
|
||||
else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<FileContainer>()) pOleObject = parentFileAs<FileContainer>().Get<OOX::OleObject>(oRId);
|
||||
|
||||
if (pOleObject.IsInit())
|
||||
return pOleObject->filename().m_strFilename;
|
||||
|
||||
@ -58,11 +58,8 @@ namespace PPTX
|
||||
}
|
||||
if(sLink.empty())
|
||||
{
|
||||
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
|
||||
if(parentFileIs<FileContainer>())
|
||||
sLink = parentFileAs<FileContainer>().GetLinkFromRId(rid);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all(sLink, L"\\", L"/");
|
||||
|
||||
@ -57,11 +57,8 @@ namespace PPTX
|
||||
}
|
||||
if(sLink.empty())
|
||||
{
|
||||
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
|
||||
if(parentFileIs<FileContainer>())
|
||||
sLink = parentFileAs<FileContainer>().GetLinkFromRId(rid);
|
||||
}
|
||||
|
||||
return sLink;
|
||||
|
||||
@ -42,6 +42,9 @@
|
||||
#include "Media/MediaFile.h"
|
||||
#include "Media/WavAudioFile.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
@ -81,7 +84,7 @@ namespace PPTX
|
||||
|
||||
if (m_OleObjectFile.IsInit() == false && !ole_bin.empty())
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(!mspackage.empty());
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, !mspackage.empty());
|
||||
m_OleObjectFile->set_filename (ole_bin, false);
|
||||
m_OleObjectFile->set_filename_cache (ole_image);
|
||||
}
|
||||
@ -327,14 +330,14 @@ namespace PPTX
|
||||
|
||||
if (embedded_type == 0) //unknown ms package
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
std::wstring strOlePath = pReader->GetString(_embed_data_size);
|
||||
m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name
|
||||
}
|
||||
else if (embedded_type == 1)
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
int id = pReader->m_lChartNumber++; //todoooo -> countEmbeddedObjects
|
||||
|
||||
@ -379,7 +382,7 @@ namespace PPTX
|
||||
|
||||
OOX::CPath DocProps = std::wstring(_T("docProps"));
|
||||
|
||||
OOX::CApp* pApp = new OOX::CApp();
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(_T("OnlyOffice"));
|
||||
@ -393,7 +396,7 @@ namespace PPTX
|
||||
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
|
||||
delete pApp;
|
||||
}
|
||||
OOX::CCore* pCore = new OOX::CCore();
|
||||
OOX::CCore* pCore = new OOX::CCore(NULL);
|
||||
if (pCore)
|
||||
{
|
||||
pCore->SetCreator(_T(""));
|
||||
@ -423,7 +426,7 @@ namespace PPTX
|
||||
}
|
||||
else if (embedded_type == 2)
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
int id = pReader->m_lChartNumber++; //todoooo -> countEmbeddedObjects
|
||||
|
||||
@ -435,9 +438,9 @@ namespace PPTX
|
||||
std::wstring sXmlOptions, sMediaPath, sEmbedPath;
|
||||
BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath);
|
||||
|
||||
boost::unordered_map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
|
||||
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
|
||||
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
|
||||
std::map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
|
||||
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
|
||||
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
|
||||
|
||||
oXlsx.m_mapEnumeratedGlobal.clear();
|
||||
|
||||
@ -1145,7 +1148,7 @@ namespace PPTX
|
||||
{
|
||||
double trim = 0.0;
|
||||
|
||||
if (parentFileIs<Slide>())
|
||||
if (parentFileIs<FileContainer>())
|
||||
{
|
||||
if (nvPicPr.nvPr.media.is<MediaFile>())
|
||||
{
|
||||
@ -1153,7 +1156,7 @@ namespace PPTX
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
|
||||
{
|
||||
if (std::wstring (_T("NULL")) == parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get()) ) // HAVE TRIM
|
||||
if (std::wstring (_T("NULL")) == parentFileAs<FileContainer>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get()) ) // HAVE TRIM
|
||||
{
|
||||
if(nvPicPr.nvPr.extLst.size())
|
||||
{
|
||||
@ -1172,15 +1175,15 @@ namespace PPTX
|
||||
{
|
||||
double trim = -1.0;
|
||||
|
||||
if (parentFileIs<Slide>())
|
||||
if (nvPicPr.nvPr.media.is<MediaFile>())
|
||||
{
|
||||
if (nvPicPr.nvPr.media.is<MediaFile>())
|
||||
if ((nvPicPr.nvPr.media.as<MediaFile>().name == _T("videoFile")) ||
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
|
||||
{
|
||||
if ((nvPicPr.nvPr.media.as<MediaFile>().name == _T("videoFile")) ||
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
|
||||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
|
||||
if (parentFileIs<FileContainer>())
|
||||
{
|
||||
if (std::wstring (_T("NULL")) == parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get())) // HAVE TRIM
|
||||
if (std::wstring (_T("NULL")) == parentFileAs<FileContainer>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get())) // HAVE TRIM
|
||||
{
|
||||
if(nvPicPr.nvPr.extLst.size())
|
||||
{
|
||||
|
||||
@ -39,6 +39,10 @@
|
||||
#include "SpPr.h"
|
||||
#include "ShapeStyle.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class OleObject;
|
||||
}
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Limit
|
||||
|
||||
@ -153,6 +153,18 @@ namespace PPTX
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (pReader->GetPos() < _end_rec)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
@ -161,12 +173,10 @@ namespace PPTX
|
||||
case 0:
|
||||
{
|
||||
Fill.fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
pReader->Seek(_end_rec);
|
||||
@ -175,6 +185,7 @@ namespace PPTX
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(m_name);
|
||||
pWriter->EndAttributes();
|
||||
Fill.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(m_name);
|
||||
}
|
||||
@ -244,6 +255,18 @@ namespace PPTX
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (pReader->GetPos() < _end_rec)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
@ -252,12 +275,10 @@ namespace PPTX
|
||||
case 0:
|
||||
{
|
||||
Color.fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
pReader->Seek(_end_rec);
|
||||
@ -266,6 +287,7 @@ namespace PPTX
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:highlight");
|
||||
pWriter->EndAttributes();
|
||||
Color.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(L"a:highlight");
|
||||
}
|
||||
@ -479,7 +501,6 @@ namespace PPTX
|
||||
pWriter->Write(rtl);
|
||||
pWriter->Write(uFill);
|
||||
pWriter->Write(uFillTx);
|
||||
pWriter->Write(uFillTx);
|
||||
pWriter->Write(highlight);
|
||||
|
||||
pWriter->EndNode(m_name);
|
||||
@ -599,101 +620,82 @@ namespace PPTX
|
||||
case 0:
|
||||
{
|
||||
altLang = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 1:
|
||||
{
|
||||
b = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
baseline = pReader->GetLong();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 3:
|
||||
{
|
||||
bmk = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 4:
|
||||
{
|
||||
cap = new Limit::TextCaps();
|
||||
cap->SetBYTECode(pReader->GetUChar());
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 5:
|
||||
{
|
||||
dirty = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
err = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 7:
|
||||
{
|
||||
i = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
kern = pReader->GetLong();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
kumimoji = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 10:
|
||||
{
|
||||
lang = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 11:
|
||||
{
|
||||
noProof = pReader->GetBool(); // noproof
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 12:
|
||||
{
|
||||
normalizeH = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 13:
|
||||
{
|
||||
smtClean = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 14:
|
||||
{
|
||||
smtId = pReader->GetLong();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 15:
|
||||
{
|
||||
spc = pReader->GetLong();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 16:
|
||||
{
|
||||
strike = new Limit::TextStrike();
|
||||
strike->SetBYTECode(pReader->GetUChar());
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 17:
|
||||
{
|
||||
sz = pReader->GetLong();
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 18:
|
||||
{
|
||||
u = new Limit::TextUnderline();
|
||||
u->SetBYTECode(pReader->GetUChar());
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -708,77 +710,69 @@ namespace PPTX
|
||||
{
|
||||
ln = new Logic::Ln();
|
||||
ln->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 1:
|
||||
{
|
||||
Fill.fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
EffectList.fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 3:
|
||||
{
|
||||
latin = new Logic::TextFont();
|
||||
latin->m_name = L"a:latin";
|
||||
latin->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 4:
|
||||
{
|
||||
ea = new Logic::TextFont();
|
||||
ea->m_name = L"a:ea";
|
||||
ea->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 5:
|
||||
{
|
||||
cs = new Logic::TextFont();
|
||||
cs->m_name = L"a:cs";
|
||||
cs->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
sym = new Logic::TextFont();
|
||||
sym->m_name = L"a:sym";
|
||||
sym->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case 7:
|
||||
{
|
||||
hlinkClick = new Logic::Hyperlink(L"hlinkClick");
|
||||
hlinkClick->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
hlinkClick->fromPPTY(pReader);
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
hlinkMouseOver = new Logic::Hyperlink(L"hlinkMouseOver");
|
||||
hlinkMouseOver->fromPPTY(pReader);
|
||||
}
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
rtl = new Logic::Rtl();
|
||||
rtl->fromPPTY(pReader);
|
||||
}
|
||||
}break;
|
||||
case 10:
|
||||
{
|
||||
uFill = new Logic::UFillTx(L"a:uFill");
|
||||
uFill->fromPPTY(pReader);
|
||||
}
|
||||
}break;
|
||||
case 11:
|
||||
{
|
||||
uFillTx = new Logic::UFillTx(L"a:uFillTx");
|
||||
uFillTx->fromPPTY(pReader);
|
||||
}
|
||||
}break;
|
||||
case 12:
|
||||
{
|
||||
highlight = new Logic::Highlight();
|
||||
highlight->fromPPTY(pReader);
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
|
||||
@ -38,6 +38,9 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
MathParaWrapper::~MathParaWrapper()
|
||||
{
|
||||
}
|
||||
MathParaWrapper& MathParaWrapper::operator=(const MathParaWrapper& oSrc)
|
||||
{
|
||||
//todo
|
||||
|
||||
@ -53,6 +53,8 @@ namespace PPTX
|
||||
WritingElement_AdditionConstructors(MathParaWrapper)
|
||||
|
||||
MathParaWrapper() {}
|
||||
virtual ~MathParaWrapper();
|
||||
|
||||
MathParaWrapper& operator=(const MathParaWrapper& oSrc);
|
||||
|
||||
virtual OOX::EElementType getType () const
|
||||
|
||||
@ -107,7 +107,7 @@ namespace PPTX
|
||||
|
||||
OOX::CPath pathDiagramDrawing = pathDiagramData.GetDirectory() + FILE_SEPARATOR_STR + L"drawing" + strId + L".xml";
|
||||
|
||||
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(pathDiagramDrawing)));
|
||||
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(NULL, pathDiagramDrawing)));
|
||||
if (oFileDrawing.IsInit())
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
}
|
||||
|
||||
@ -358,12 +358,12 @@ namespace PPTX
|
||||
|
||||
if (_type == SPTREE_TYPE_AUDIO)
|
||||
{
|
||||
OOX::Audio *pAudio = new OOX::Audio(pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
OOX::Audio *pAudio = new OOX::Audio(NULL, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
p->blipFill.additionalFile = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(pAudio));
|
||||
}
|
||||
else if (_type == SPTREE_TYPE_VIDEO)
|
||||
{
|
||||
OOX::Video* pVideo = new OOX::Video(pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
OOX::Video* pVideo = new OOX::Video(NULL, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
p->blipFill.additionalFile = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(pVideo));
|
||||
}
|
||||
|
||||
|
||||
@ -47,10 +47,10 @@ namespace PPTX
|
||||
class NotesMaster : public WrapperFile, public FileContainer
|
||||
{
|
||||
public:
|
||||
NotesMaster()
|
||||
NotesMaster(OOX::Document* pMain) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
NotesMaster(const OOX::CPath& filename, FileMap& map)
|
||||
NotesMaster(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -44,10 +44,10 @@ namespace PPTX
|
||||
class NotesSlide : public WrapperFile, public FileContainer
|
||||
{
|
||||
public:
|
||||
NotesSlide()
|
||||
NotesSlide(OOX::Document* pMain) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
NotesSlide(const OOX::CPath& filename, FileMap& map)
|
||||
NotesSlide(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
@ -88,25 +88,6 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename; //??? целесообразность ??
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(NSBinPptxRW::NSMainTables::NotesSlides);
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#ifndef PPTX_INCLUDE_H_
|
||||
#define PPTX_INCLUDE_H_
|
||||
|
||||
//#include "FileFactory.h"
|
||||
#include "Folder.h"
|
||||
#include "Presentation.h"
|
||||
#include "Slide.h"
|
||||
|
||||
@ -45,10 +45,10 @@ namespace PPTX
|
||||
class PresProps : public WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
PresProps()
|
||||
PresProps(OOX::Document* pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
PresProps(const OOX::CPath& filename, FileMap& map)
|
||||
PresProps(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -58,11 +58,11 @@ namespace PPTX
|
||||
class Presentation : public WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
Presentation()
|
||||
Presentation(OOX::Document *pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
}
|
||||
Presentation(const OOX::CPath& filename, FileMap& map)
|
||||
Presentation(OOX::Document *pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
read(filename, map);
|
||||
@ -336,7 +336,7 @@ namespace PPTX
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
commentAuthors = new PPTX::Authors();
|
||||
commentAuthors = new PPTX::Authors(File::m_pMainDocument);
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
}break;
|
||||
case 7:
|
||||
@ -346,7 +346,7 @@ namespace PPTX
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
m_pVbaProject = new OOX::VbaProject();
|
||||
m_pVbaProject = new OOX::VbaProject(File::m_pMainDocument);
|
||||
m_pVbaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pVbaProject.smart_dynamic_cast<OOX::File>();
|
||||
@ -356,7 +356,7 @@ namespace PPTX
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
m_pJsaProject = new OOX::JsaProject();
|
||||
m_pJsaProject = new OOX::JsaProject(File::m_pMainDocument);
|
||||
m_pJsaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
|
||||
|
||||
@ -49,9 +49,6 @@
|
||||
#include "NotesSlide.h"
|
||||
#include "TableStyles.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/External.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
|
||||
|
||||
@ -62,10 +59,10 @@ namespace PPTX
|
||||
class Slide : public WrapperFile, public FileContainer
|
||||
{
|
||||
public:
|
||||
Slide()
|
||||
Slide(OOX::Document* pMain) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
Slide(const OOX::CPath& filename, FileMap& map)
|
||||
Slide(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
@ -144,33 +141,6 @@ namespace PPTX
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
//-------------------------------------------------
|
||||
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual DWORD GetRGBAFromMap(const std::wstring& str)const
|
||||
{
|
||||
if(!(clrMapOvr.is_init()))
|
||||
@ -305,7 +275,7 @@ namespace PPTX
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
comments = new PPTX::Comments();
|
||||
comments = new PPTX::Comments(OOX::File::m_pMainDocument);
|
||||
comments->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -62,10 +62,10 @@ namespace PPTX
|
||||
class SlideLayout : public WrapperFile, public FileContainer
|
||||
{
|
||||
public:
|
||||
SlideLayout()
|
||||
SlideLayout(OOX::Document* pMain) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
SlideLayout(const OOX::CPath& filename, FileMap& map)
|
||||
SlideLayout(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
@ -185,32 +185,6 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual DWORD GetRGBAFromMap(const std::wstring& str)const
|
||||
{
|
||||
if(!(clrMapOvr.is_init()))
|
||||
|
||||
@ -51,8 +51,6 @@
|
||||
#include "Theme.h"
|
||||
#include "TableStyles.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
|
||||
|
||||
@ -61,10 +59,10 @@ namespace PPTX
|
||||
class SlideMaster : public WrapperFile, public FileContainer
|
||||
{
|
||||
public:
|
||||
SlideMaster()
|
||||
SlideMaster(OOX::Document* pMain) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
SlideMaster(const OOX::CPath& filename, FileMap& map)
|
||||
SlideMaster(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
@ -172,32 +170,6 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
//---------------------Colors from map---------------------------------------
|
||||
DWORD GetRGBAFromMap(const std::wstring& str)const
|
||||
|
||||
@ -43,10 +43,10 @@ namespace PPTX
|
||||
class TableStyles: public WrapperFile
|
||||
{
|
||||
public:
|
||||
TableStyles()
|
||||
TableStyles(OOX::Document* pMain) : WrapperFile(pMain)
|
||||
{
|
||||
}
|
||||
TableStyles(const OOX::CPath& filename, FileMap& map)
|
||||
TableStyles(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -43,6 +43,8 @@
|
||||
#include "Logic/ClrMap.h"
|
||||
|
||||
#include "Presentation.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
@ -52,27 +54,35 @@ namespace PPTX
|
||||
class Theme : public PPTX::WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
Theme()
|
||||
Theme(OOX::Document *pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
isThemeOverride = false;
|
||||
|
||||
OOX::CDocx* docx = dynamic_cast<OOX::CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pTheme = this;
|
||||
}
|
||||
Theme(const OOX::CPath& filename)
|
||||
Theme(OOX::Document *pMain, const OOX::CPath& filename) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
FileMap map;
|
||||
|
||||
isThemeOverride = false;
|
||||
m_map = NULL;
|
||||
|
||||
OOX::CDocx* docx = dynamic_cast<OOX::CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pTheme = this;
|
||||
|
||||
read(filename, map);
|
||||
}
|
||||
Theme(const OOX::CPath& filename, FileMap& map)
|
||||
Theme(OOX::Document *pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
isThemeOverride = false;
|
||||
m_map = NULL;
|
||||
|
||||
OOX::CDocx* docx = dynamic_cast<OOX::CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pTheme = this;
|
||||
|
||||
read(filename, map);
|
||||
}
|
||||
virtual ~Theme()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
@ -324,33 +334,6 @@ namespace PPTX
|
||||
{
|
||||
return GetABGRFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
}
|
||||
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
void GetLineStyle(int number, Logic::Ln& lnStyle)const
|
||||
{
|
||||
themeElements.fmtScheme.GetLineStyle(number, lnStyle);
|
||||
|
||||
@ -53,10 +53,10 @@ namespace PPTX
|
||||
class ViewProps : public WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
ViewProps()
|
||||
ViewProps(OOX::Document* pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
}
|
||||
ViewProps(const OOX::CPath& filename, FileMap& map)
|
||||
ViewProps(OOX::Document* pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
read(filename, map);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
class WrapperFile : public OOX::File
|
||||
{
|
||||
public:
|
||||
WrapperFile()
|
||||
WrapperFile(OOX::Document *pMain) : OOX::File(pMain)
|
||||
{
|
||||
m_written = false;
|
||||
m_WrittenFileName = _T("");
|
||||
|
||||
@ -830,6 +830,7 @@
|
||||
69656F521FC2FF800028C4BA /* PresetShapesHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69656DCA1FC2FF800028C4BA /* PresetShapesHeader.h */; };
|
||||
696791821D9E8B81002CA4BA /* MathParaWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 696791801D9E8B81002CA4BA /* MathParaWrapper.cpp */; };
|
||||
696791831D9E8B81002CA4BA /* MathParaWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 696791811D9E8B81002CA4BA /* MathParaWrapper.h */; };
|
||||
697DFC1E200F51A700F0A9AF /* WavAudioFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697DFC1D200F51A600F0A9AF /* WavAudioFile.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -1659,6 +1660,7 @@
|
||||
69656DCA1FC2FF800028C4BA /* PresetShapesHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresetShapesHeader.h; sourceTree = "<group>"; };
|
||||
696791801D9E8B81002CA4BA /* MathParaWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathParaWrapper.cpp; sourceTree = "<group>"; };
|
||||
696791811D9E8B81002CA4BA /* MathParaWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathParaWrapper.h; sourceTree = "<group>"; };
|
||||
697DFC1D200F51A600F0A9AF /* WavAudioFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WavAudioFile.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -2088,6 +2090,7 @@
|
||||
179A44801AC57B83005A27F7 /* AudioCD.h */,
|
||||
179A44811AC57B83005A27F7 /* MediaFile.h */,
|
||||
179A44821AC57B83005A27F7 /* WavAudioFile.h */,
|
||||
697DFC1D200F51A600F0A9AF /* WavAudioFile.cpp */,
|
||||
);
|
||||
path = Media;
|
||||
sourceTree = "<group>";
|
||||
@ -3585,6 +3588,7 @@
|
||||
17C1FCBB1ACC429D006B99B3 /* FileFactory.cpp in Sources */,
|
||||
17C1FCBC1ACC429D006B99B3 /* pptxformatlib.cpp in Sources */,
|
||||
17C1FCBD1ACC429D006B99B3 /* TxBody.cpp in Sources */,
|
||||
697DFC1E200F51A700F0A9AF /* WavAudioFile.cpp in Sources */,
|
||||
17C1FCBE1ACC429D006B99B3 /* EffectProperties.cpp in Sources */,
|
||||
17C1FCBF1ACC429D006B99B3 /* EffectLst.cpp in Sources */,
|
||||
695BC03A1C070DEF00817D7E /* ASCSVGWriter.cpp in Sources */,
|
||||
|
||||
@ -3113,18 +3113,6 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="VectorML"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\PPTXFormat\DocxFormat\Drawing\LegacyDiagramText.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PPTXFormat\DocxFormat\Drawing\VmlDrawing.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ViewProps"
|
||||
>
|
||||
|
||||
@ -33,7 +33,26 @@
|
||||
#include "../RtfDocument.h"
|
||||
#include "../RtfField.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
class RtfConvertationManager;
|
||||
|
||||
class OOXReader
|
||||
|
||||
@ -43,6 +43,8 @@
|
||||
#include "OOXFootnoteWriter.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
|
||||
#include "../../../../ASCOfficeDocxFile2/BinReader/DefaultThemeWriter.h"
|
||||
|
||||
@ -65,8 +67,8 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
|
||||
m_poSettingsWriter = new OOXSettingsWriter ( *this, m_oDocument );
|
||||
m_poStylesWriter = new OOXStylesWriter ( *this, m_oDocument );
|
||||
|
||||
m_poDocPropsApp = new OOX::CApp();
|
||||
m_poDocPropsCore = new OOX::CCore();
|
||||
m_poDocPropsApp = new OOX::CApp(NULL);
|
||||
m_poDocPropsCore = new OOX::CCore(NULL);
|
||||
|
||||
//default properties
|
||||
|
||||
|
||||
@ -38,6 +38,14 @@
|
||||
#include "TxtFormat/TxtFormat.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
//#include "../../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
|
||||
#include "Common//ToString.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
@ -32,6 +32,15 @@
|
||||
#include "ConvertTxt2Docx.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
//#include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
//#include "../../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
|
||||
#include "TxtFormat/TxtFormat.h"
|
||||
#include "TxtXmlEvent.h"
|
||||
|
||||
@ -79,7 +88,7 @@ namespace Txt2Docx
|
||||
return;
|
||||
}
|
||||
|
||||
Converter_Impl::Converter_Impl(int encoding)
|
||||
Converter_Impl::Converter_Impl(int encoding) : m_outputFile(NULL)
|
||||
{
|
||||
m_inputFile.m_nEncoding = encoding;
|
||||
|
||||
|
||||
@ -40,6 +40,9 @@
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
class CDrawingConverter;
|
||||
@ -212,11 +215,11 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
|
||||
OOX::CPath DocProps = std::wstring(_T("docProps"));
|
||||
|
||||
OOX::CApp* pApp = new OOX::CApp();
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(_T("OnlyOffice"));
|
||||
pApp->SetAppVersion(_T("5.0"));
|
||||
pApp->SetAppVersion(_T("5.07"));
|
||||
pApp->SetDocSecurity(0);
|
||||
pApp->SetScaleCrop(false);
|
||||
pApp->SetLinksUpToDate(false);
|
||||
@ -226,7 +229,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
|
||||
delete pApp;
|
||||
}
|
||||
OOX::CCore* pCore = new OOX::CCore();
|
||||
OOX::CCore* pCore = new OOX::CCore(NULL);
|
||||
if (pCore)
|
||||
{
|
||||
pCore->SetCreator(_T(""));
|
||||
|
||||
@ -36,16 +36,20 @@
|
||||
|
||||
namespace OLEPS
|
||||
{
|
||||
unsigned short code_page_ = 0;
|
||||
|
||||
PropertyCodePage::PropertyCodePage(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
PropertyCodePage::PropertyCodePage(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
: Property(prop_type)
|
||||
{
|
||||
code_page = 0;
|
||||
if (value_type == Property::VT_I2)
|
||||
{
|
||||
*stream >> code_page;
|
||||
}
|
||||
code_page_ = code_page;
|
||||
}
|
||||
PropertyTitle::PropertyTitle(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
PropertyStr::PropertyStr(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
: Property(prop_type)
|
||||
{
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
@ -56,128 +60,23 @@ PropertyTitle::PropertyTitle(const unsigned short value_type, XLS::CFStreamPtr s
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
title = STR::toStdWString(s, size, 0);
|
||||
value = STR::toStdWString(s, size, code_page_);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertySubject::PropertySubject(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0 )
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
subject = STR::toStdWString(s, size, 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyAuthor::PropertyAuthor(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s, size);
|
||||
author = STR::toStdWString(std::string(s,size), 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyKeywords::PropertyKeywords(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
keywords = STR::toStdWString(std::string(s,size), 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertyComments::PropertyComments(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
comments = STR::toStdWString(s, size, 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertyDateCreate::PropertyDateCreate(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
PropertyDTM::PropertyDTM(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
: Property(prop_type)
|
||||
{
|
||||
_UINT32 dwLowDateTime = 0, dwHighDateTime = 0;
|
||||
if (value_type == Property::VT_FILETIME)
|
||||
{
|
||||
*stream >> dwLowDateTime >> dwHighDateTime;
|
||||
}
|
||||
//todoooo
|
||||
}
|
||||
PropertyWordCount::PropertyWordCount(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
count = 0;
|
||||
if (value_type == Property::VT_I4)
|
||||
{
|
||||
*stream >> count;
|
||||
}
|
||||
else if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
value = STR::toStdWString(s, size, 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyCharCount::PropertyCharCount(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
{
|
||||
count = 0;
|
||||
if (value_type == Property::VT_I4)
|
||||
{
|
||||
*stream >> count;
|
||||
}
|
||||
else if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
_UINT32 size;
|
||||
*stream >> size;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
char *s = new char[size];
|
||||
stream->read(s,size);
|
||||
value = STR::toStdWString(s, size, 0);
|
||||
delete []s;
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyDocSecurity::PropertyDocSecurity(const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
PropertyInt::PropertyInt(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
: Property(prop_type)
|
||||
{
|
||||
value = 0;
|
||||
if (value_type == Property::VT_I4)
|
||||
@ -185,4 +84,17 @@ PropertyDocSecurity::PropertyDocSecurity(const unsigned short value_type, XLS::C
|
||||
*stream >> value;
|
||||
}
|
||||
}
|
||||
PropertyBool::PropertyBool(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream)
|
||||
: Property(prop_type)
|
||||
{
|
||||
value = false;
|
||||
if (value_type == Property::VT_BOOL)
|
||||
{
|
||||
_UINT32 v;
|
||||
*stream >> v;
|
||||
|
||||
if (v != 0)
|
||||
value = true;
|
||||
}
|
||||
}
|
||||
} // namespace OLEPS
|
||||
|
||||
@ -40,101 +40,48 @@ namespace OLEPS
|
||||
class PropertyCodePage : public Property
|
||||
{
|
||||
public:
|
||||
PropertyCodePage(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
PropertyCodePage(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
|
||||
static const unsigned int Type = 0x0001;
|
||||
static const unsigned short DefaultCodePage = 1250;
|
||||
unsigned int Type;
|
||||
|
||||
static const unsigned short DefaultCodePage = 1250;
|
||||
unsigned short code_page;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyCodePage> PropertyCodePagePtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyTitle : public Property
|
||||
class PropertyStr : public Property
|
||||
{
|
||||
public:
|
||||
PropertyTitle(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
PropertyStr(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
|
||||
static const unsigned int Type = 0x0002;
|
||||
|
||||
std::wstring title;
|
||||
std::wstring value;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyTitle> PropertyTitlePtr;
|
||||
typedef boost::shared_ptr<PropertyStr> PropertyStrPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertySubject : public Property
|
||||
class PropertyDTM : public Property
|
||||
{
|
||||
public:
|
||||
PropertySubject(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
PropertyDTM(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
|
||||
static const unsigned int Type = 0x0003;
|
||||
|
||||
std::wstring subject;
|
||||
std::wstring value;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertySubject> PropertySubjectPtr;
|
||||
typedef boost::shared_ptr<PropertyDTM> PropertyDTMPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyAuthor : public Property
|
||||
class PropertyInt : public Property
|
||||
{
|
||||
public:
|
||||
PropertyAuthor(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x0004;
|
||||
std::wstring author;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyAuthor> PropertyAuthorPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyKeywords : public Property
|
||||
{
|
||||
public:
|
||||
PropertyKeywords(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x0005;
|
||||
std::wstring keywords;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyKeywords> PropertyKeywordsPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyComments : public Property
|
||||
{
|
||||
public:
|
||||
PropertyComments(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x0006;
|
||||
std::wstring comments;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyComments> PropertyCommentsPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyDateCreate : public Property
|
||||
{
|
||||
public:
|
||||
PropertyDateCreate(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x000c;
|
||||
std::wstring dateCreate;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyDateCreate> PropertyDateCreatesPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyWordCount : public Property
|
||||
{
|
||||
public:
|
||||
PropertyWordCount(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x000f;
|
||||
PropertyInt(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
|
||||
_UINT32 count;
|
||||
std::wstring value;
|
||||
_UINT32 value;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyWordCount> PropertyWordCountPtr;
|
||||
typedef boost::shared_ptr<PropertyInt> PropertyIntPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyCharCount : public Property
|
||||
class PropertyBool : public Property
|
||||
{
|
||||
public:
|
||||
PropertyCharCount(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x0010;
|
||||
PropertyBool(unsigned int prop_type, const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
|
||||
_UINT32 count;
|
||||
std::wstring value;
|
||||
bool value;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyCharCount> PropertyCharCountPtr;
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class PropertyDocSecurity : public Property
|
||||
{
|
||||
public:
|
||||
PropertyDocSecurity(const unsigned short value_type, XLS::CFStreamPtr stream);
|
||||
static const unsigned int Type = 0x0013;
|
||||
_UINT32 value;
|
||||
};
|
||||
typedef boost::shared_ptr<PropertyDocSecurity> PropertyDocSecurityPtr;
|
||||
typedef boost::shared_ptr<PropertyDTM> PropertyDTMPtr;
|
||||
} // namespace OLEPS
|
||||
|
||||
@ -35,14 +35,15 @@
|
||||
|
||||
namespace OLEPS
|
||||
{
|
||||
|
||||
// The only necessity of this class is to place all properties into a single array
|
||||
class Property
|
||||
{
|
||||
public:
|
||||
Property();
|
||||
virtual ~Property() = 0;
|
||||
Property(unsigned int type) : Type(type) {}
|
||||
virtual ~Property()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int Type;
|
||||
enum ValueTypes
|
||||
{
|
||||
VT_I2 = 0x0002,
|
||||
|
||||
@ -52,37 +52,32 @@ PropertyPtr PropertyFactory::ReadProperty(const unsigned int prop_type, XLS::CFS
|
||||
*stream >> value_type;
|
||||
stream->seekFromCurForward(2); // Skip 2 reserved unsigned chars
|
||||
|
||||
value_type = value_type & 0x00ff;
|
||||
switch(prop_type)
|
||||
{
|
||||
case 0x01://CodePage::Type:
|
||||
return PropertyPtr(new PropertyCodePage(value_type, stream));
|
||||
case 0x02://TITLE
|
||||
return PropertyPtr(new PropertyTitle(value_type, stream));
|
||||
case 0x03://SUBJECT
|
||||
return PropertyPtr(new PropertySubject(value_type, stream));
|
||||
case 0x04://AUTHOR
|
||||
return PropertyPtr(new PropertyAuthor(value_type, stream));
|
||||
case 0x05://KEYWORDS
|
||||
return PropertyPtr(new PropertyKeywords(value_type, stream));
|
||||
case 0x06://COMMENTS
|
||||
return PropertyPtr(new PropertyComments(value_type, stream));
|
||||
case 0x0C://CREATE_DTM
|
||||
return PropertyPtr(new PropertyDateCreate(value_type, stream));
|
||||
case 0x0f://PIDSI_WORDCOUNT
|
||||
return PropertyPtr(new PropertyWordCount(value_type, stream));
|
||||
case 0x10://PIDSI_CHARCOUNT
|
||||
return PropertyPtr(new PropertyCharCount(value_type, stream));
|
||||
case 0x13://PIDSI_DOC_SECURITY
|
||||
return PropertyPtr(new PropertyDocSecurity(value_type, stream));
|
||||
|
||||
case 0x08://PIDSI_LASTAUTHOR
|
||||
case 0x0b://PIDSI_LASTPRINTED
|
||||
case 0x0d://PIDSI_LASTSAVE_DTM
|
||||
case 0x12://PIDSI_APPNAME
|
||||
case 0x16://??
|
||||
case 0x17://??
|
||||
default:
|
||||
return PropertyPtr();
|
||||
case 0x01:
|
||||
return PropertyPtr(new PropertyCodePage(prop_type, value_type, stream));
|
||||
default:
|
||||
{
|
||||
if (value_type == 0x001E)
|
||||
{
|
||||
return PropertyPtr(new PropertyStr(prop_type, value_type, stream));
|
||||
}
|
||||
else if (value_type == 0x0003)
|
||||
{
|
||||
return PropertyPtr(new PropertyInt(prop_type, value_type, stream));
|
||||
}
|
||||
else if (value_type == 0x000b)
|
||||
{
|
||||
return PropertyPtr(new PropertyBool(prop_type, value_type, stream));
|
||||
}
|
||||
else if (value_type == 0x0040)
|
||||
{
|
||||
return PropertyPtr(new PropertyDTM(prop_type, value_type, stream));
|
||||
}
|
||||
else
|
||||
return PropertyPtr();
|
||||
}break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -67,12 +67,12 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
|
||||
{
|
||||
if (stream->getStreamPointer() - property_set_offset > Size)
|
||||
break;
|
||||
PropertyPtr next_property = PropertyFactory::ReadProperty(prop_offsets[i].PropertyIdentifier, stream, property_set_offset + prop_offsets[i].Offset);
|
||||
if(next_property) // Skip the property if the corresponding class is not implemented
|
||||
PropertyPtr property_ = PropertyFactory::ReadProperty(prop_offsets[i].PropertyIdentifier, stream, property_set_offset + prop_offsets[i].Offset);
|
||||
if(property_) // Skip the property if the corresponding class is not implemented
|
||||
{
|
||||
properties.push_back(next_property);
|
||||
properties.insert(std::make_pair(property_->Type, property_));
|
||||
|
||||
PropertyCodePagePtr property_CodePage = boost::dynamic_pointer_cast<PropertyCodePage>(next_property);
|
||||
PropertyCodePagePtr property_CodePage = boost::dynamic_pointer_cast<PropertyCodePage>(property_);
|
||||
if(property_CodePage)
|
||||
{
|
||||
code_page = property_CodePage->code_page;
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "Property.h"
|
||||
#include "../../../Binary/BinSmartPointers.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace OLEPS
|
||||
@ -46,7 +47,11 @@ public:
|
||||
|
||||
const unsigned short GetCodePage();
|
||||
|
||||
std::map<unsigned int, PropertyPtr> properties;
|
||||
|
||||
private:
|
||||
unsigned short code_page;
|
||||
|
||||
#pragma pack(1)
|
||||
struct PropertyIdentifierAndOffset
|
||||
{
|
||||
@ -55,9 +60,6 @@ private:
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
private:
|
||||
std::vector<PropertyPtr> properties;
|
||||
unsigned short code_page; // no need to initialize because this info is a must for every SummaryInformation stream in a compound file
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<PropertySet> PropertySetPtr;
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Property.h"
|
||||
|
||||
namespace OLEPS
|
||||
{
|
||||
|
||||
Property::Property()
|
||||
{
|
||||
}
|
||||
|
||||
Property::~Property()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} // namespace OLEPS
|
||||
@ -781,7 +781,6 @@ SOURCES += \
|
||||
../XlsFormat/Logic/Biff_unions/SXFORMULA_bu.cpp \
|
||||
../XlsFormat/Logic/Biff_unions/SXOPER.cpp \
|
||||
../XlsFormat/Logic/Biff_unions/SXRANGE.cpp \
|
||||
../XlsFormat/Logic/SummaryInformationStream/Structures/Property_Structures.cpp \
|
||||
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertyFactory.cpp \
|
||||
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySet.cpp \
|
||||
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySetStream.cpp \
|
||||
|
||||
@ -760,7 +760,6 @@
|
||||
#include "../XlsFormat/Logic/Biff_unions/SXOPER.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_unions/SXRANGE.cpp"
|
||||
|
||||
#include "../XlsFormat/Logic/SummaryInformationStream/Structures/Property_Structures.cpp"
|
||||
#include "../XlsFormat/Logic/SummaryInformationStream/Structures/PropertyFactory.cpp"
|
||||
#include "../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySet.cpp"
|
||||
#include "../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySetStream.cpp"
|
||||
|
||||
@ -6529,10 +6529,6 @@
|
||||
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property_Structures.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\PropertyFactory.cpp"
|
||||
>
|
||||
|
||||
@ -59,6 +59,8 @@ SOURCES += \
|
||||
../Source/DocxFormat/Docx.cpp \
|
||||
../Source/XlsxFormat/Chart/ChartSerialize.cpp \
|
||||
../Source/XlsxFormat/Common.cpp \
|
||||
../Source/XlsxFormat/Xlsx.cpp \
|
||||
../Source/XlsxFormat/Worksheets/SheetData.cpp \
|
||||
../Source/DocxFormat/FileFactory.cpp \
|
||||
../Source/DocxFormat/IFileContainer.cpp \
|
||||
../Source/XlsxFormat/FileFactory_Spreadsheet.cpp \
|
||||
|
||||
@ -66,3 +66,5 @@
|
||||
#include "../Source/Common/ZIndex.cpp"
|
||||
#include "../Source/Common/SimpleTypes_Word.cpp"
|
||||
#include "../Source/SystemUtility/SystemUtility.cpp"
|
||||
#include "../Source/XlsxFormat/Xlsx.cpp"
|
||||
#include "../Source/XlsxFormat/Worksheets/SheetData.cpp"
|
||||
|
||||
@ -214,6 +214,7 @@
|
||||
690FE0821E9BBA23004B26D0 /* DiagramData.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0801E9BBA23004B26D0 /* DiagramData.h */; };
|
||||
690FE0831E9BBA23004B26D0 /* DiagramDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */; };
|
||||
691C3E131F20C3D500F1775E /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 691C3E121F20C3D500F1775E /* File.cpp */; };
|
||||
69B3ADA920120093000EC6A7 /* VmlDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 69B3ADA820120093000EC6A7 /* VmlDrawing.h */; };
|
||||
69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -433,6 +434,7 @@
|
||||
690FE0801E9BBA23004B26D0 /* DiagramData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramData.h; sourceTree = "<group>"; };
|
||||
690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramDrawing.h; sourceTree = "<group>"; };
|
||||
691C3E121F20C3D500F1775E /* File.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = File.cpp; sourceTree = "<group>"; };
|
||||
69B3ADA820120093000EC6A7 /* VmlDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VmlDrawing.h; sourceTree = "<group>"; };
|
||||
69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -590,6 +592,7 @@
|
||||
17E6A0921AC4262700F28F8B /* Styles.h */,
|
||||
17E6A0961AC4262700F28F8B /* Unit.h */,
|
||||
17E6A0971AC4262700F28F8B /* UnknowTypeFile.h */,
|
||||
69B3ADA820120093000EC6A7 /* VmlDrawing.h */,
|
||||
17E6A0981AC4262700F28F8B /* WritingElement.h */,
|
||||
);
|
||||
path = DocxFormat;
|
||||
@ -944,6 +947,7 @@
|
||||
17C1FBE61ACC4250006B99B3 /* ComplexTypes_Spreadsheet.h in Headers */,
|
||||
17C1FBE71ACC4250006B99B3 /* Workbook.h in Headers */,
|
||||
17C1FBE81ACC4250006B99B3 /* RunProperty.h in Headers */,
|
||||
69B3ADA920120093000EC6A7 /* VmlDrawing.h in Headers */,
|
||||
17C1FBEA1ACC4250006B99B3 /* Sheets.h in Headers */,
|
||||
17C1FBEB1ACC4250006B99B3 /* Index.h in Headers */,
|
||||
17C1FBEC1ACC4250006B99B3 /* dxf.h in Headers */,
|
||||
|
||||
@ -1472,6 +1472,10 @@
|
||||
RelativePath="..\Source\XlsxFormat\WritingElement.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Xlsx.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Xlsx.h"
|
||||
>
|
||||
@ -1667,6 +1671,10 @@
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\MergeCells.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\SheetData.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\SheetData.h"
|
||||
>
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#ifndef OOX_APP_INCLUDE_H_
|
||||
#define OOX_APP_INCLUDE_H_
|
||||
|
||||
#include "Docx.h"
|
||||
#include "File.h"
|
||||
#include "../Base/Nullable.h"
|
||||
#include "../Common/SimpleTypes_Word.h"
|
||||
@ -43,19 +44,21 @@ namespace OOX
|
||||
class CApp : public OOX::File
|
||||
{
|
||||
public:
|
||||
CApp()
|
||||
CApp(OOX::Document* pMain) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pApp = this;
|
||||
}
|
||||
CApp(const CPath& oPath)
|
||||
CApp(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pApp = this;
|
||||
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CApp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
XmlUtils::CXmlNode oProperties;
|
||||
@ -393,7 +396,6 @@ namespace OOX
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::App;
|
||||
|
||||
@ -45,20 +45,15 @@ namespace OOX
|
||||
class CBibliography : public OOX::File
|
||||
{
|
||||
public:
|
||||
CBibliography()
|
||||
CBibliography(OOX::Document* pMain) : OOX::File(pMain)
|
||||
{
|
||||
|
||||
}
|
||||
CBibliography(const CPath& oPath)
|
||||
CBibliography(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CBibliography()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const CPath& oFilePath)
|
||||
{
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
@ -297,11 +297,16 @@ namespace OOX
|
||||
class CComments : public OOX::File
|
||||
{
|
||||
public:
|
||||
CComments()
|
||||
CComments(OOX::Document *pMain) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pComments = this;
|
||||
}
|
||||
CComments(const CPath& oPath)
|
||||
CComments(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pComments = this;
|
||||
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CComments()
|
||||
@ -408,11 +413,16 @@ namespace OOX
|
||||
class CCommentsExt : public OOX::File
|
||||
{
|
||||
public:
|
||||
CCommentsExt()
|
||||
CCommentsExt(OOX::Document *pMain) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pCommentsExt = this;
|
||||
}
|
||||
CCommentsExt(const CPath& oPath)
|
||||
CCommentsExt(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pCommentsExt = this;
|
||||
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CCommentsExt()
|
||||
@ -568,11 +578,16 @@ namespace OOX
|
||||
class CPeople : public OOX::File
|
||||
{
|
||||
public:
|
||||
CPeople()
|
||||
CPeople(OOX::Document *pMain) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pPeople = this;
|
||||
}
|
||||
CPeople(const CPath& oPath)
|
||||
CPeople(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pPeople = this;
|
||||
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CPeople()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#ifndef OOX_CORE_INCLUDE_H_
|
||||
#define OOX_CORE_INCLUDE_H_
|
||||
|
||||
#include "Docx.h"
|
||||
#include "File.h"
|
||||
#include "../Base/Nullable.h"
|
||||
|
||||
@ -41,11 +42,16 @@ namespace OOX
|
||||
class CCore : public OOX::File
|
||||
{
|
||||
public:
|
||||
CCore()
|
||||
CCore(OOX::Document* pMain) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pCore = this;
|
||||
}
|
||||
CCore(const CPath& oPath)
|
||||
CCore(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pCore = this;
|
||||
|
||||
read( oPath );
|
||||
}
|
||||
virtual ~CCore()
|
||||
|
||||
@ -163,14 +163,14 @@ namespace OOX
|
||||
class CDiagramData : public OOX::File, public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
CDiagramData()
|
||||
CDiagramData(OOX::Document* pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
}
|
||||
CDiagramData(const CPath& uri)
|
||||
CDiagramData(OOX::Document* pMain, const CPath& uri) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
read(uri.GetDirectory(), uri);
|
||||
}
|
||||
CDiagramData(const CPath& oRootPath, const CPath& oPath)
|
||||
CDiagramData(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
|
||||
@ -191,14 +191,14 @@ namespace OOX
|
||||
class CDiagramDrawing : public OOX::File, public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
CDiagramDrawing()
|
||||
CDiagramDrawing(OOX::Document* pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
}
|
||||
CDiagramDrawing(const CPath& uri)
|
||||
CDiagramDrawing(OOX::Document* pMain, const CPath& uri) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
read(uri.GetDirectory(), uri);
|
||||
}
|
||||
CDiagramDrawing(const CPath& oRootPath, const CPath& oPath)
|
||||
CDiagramDrawing(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
|
||||
@ -199,13 +199,19 @@ namespace OOX
|
||||
class CDocument : public OOX::File, public IFileContainer
|
||||
{
|
||||
public:
|
||||
CDocument()
|
||||
CDocument(OOX::Document *pMain) : File(pMain), IFileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocument = this;
|
||||
}
|
||||
CDocument(const CPath& oRootPath, const CPath& oPath)
|
||||
CDocument(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath) : File(pMain), IFileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocument = this;
|
||||
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
@ -615,7 +621,7 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
Logic::CParagraph* pPara = (Logic::CParagraph*)pNewElement;
|
||||
|
||||
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink( sNameHref ) );
|
||||
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink(File::m_pMainDocument, sNameHref ) );
|
||||
const OOX::RId rId = Add( oHyperlink );
|
||||
|
||||
// TO DO: Сделать добавление гиперссылок в параграфах
|
||||
@ -629,7 +635,7 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
{
|
||||
OOX::Logic::CParagraph* pPara = (OOX::Logic::CParagraph*)m_arrItems.back();
|
||||
|
||||
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink( sNameHref ) );
|
||||
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink( File::m_pMainDocument, sNameHref ) );
|
||||
const OOX::RId rId = Add( oHyperlink );
|
||||
|
||||
// TO DO: Сделать добавление гиперссылок в параграфах
|
||||
|
||||
@ -31,94 +31,50 @@
|
||||
*/
|
||||
#include "Docx.h"
|
||||
|
||||
#include "App.h"
|
||||
#include "Core.h"
|
||||
#include "Document.h"
|
||||
#include "FontTable.h"
|
||||
#include "Numbering.h"
|
||||
#include "Comments.h"
|
||||
#include "Styles.h"
|
||||
#include "Footnote.h"
|
||||
#include "Endnote.h"
|
||||
#include "Settings/WebSettings.h"
|
||||
#include "Settings/Settings.h"
|
||||
#include "External/HyperLink.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "Media/ActiveX.h"
|
||||
#include "Media/VbaProject.h"
|
||||
#include "Media/JsaProject.h"
|
||||
#include "HeaderFooter.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
|
||||
namespace OOX {
|
||||
|
||||
bool CDocx::Read(const CPath& oFilePath)
|
||||
{
|
||||
// Ищем "/_rels/.rels" и читаем все файлы по рельсам
|
||||
OOX::CRels oRels( oFilePath / FILE_SEPARATOR_STR );
|
||||
IFileContainer::Read( oRels, oFilePath, oFilePath );
|
||||
bool CDocx::Read(const CPath& oFilePath)
|
||||
{
|
||||
// Ищем "/_rels/.rels" и читаем все файлы по рельсам
|
||||
OOX::CRels oRels( oFilePath / FILE_SEPARATOR_STR );
|
||||
IFileContainer::Read( oRels, oFilePath, oFilePath );
|
||||
|
||||
// Выполняем дополнительные действия для более удобной работы с файлом
|
||||
|
||||
// Ищем основной документ
|
||||
smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document);
|
||||
if (pFile.IsInit() == false)
|
||||
{
|
||||
pFile = Find(OOX::FileTypes::DocumentMacro);
|
||||
}
|
||||
if (pFile.IsInit())
|
||||
m_pDocument = dynamic_cast<OOX::CDocument*>(pFile.operator->());
|
||||
|
||||
if ( m_pDocument )
|
||||
{
|
||||
// Ищем таблицу шрифтов
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::FontTable );
|
||||
if ( pFile.IsInit() )
|
||||
m_pFontTable = dynamic_cast<OOX::CFontTable*>(pFile.operator->());
|
||||
|
||||
// Ищем таблицу нумераций
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::Numbering );
|
||||
if ( pFile.IsInit())
|
||||
m_pNumbering = dynamic_cast<OOX::CNumbering*>(pFile.operator->());
|
||||
|
||||
// Ищем таблицу стилей
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::Style );
|
||||
if ( pFile.IsInit())
|
||||
m_pStyles = dynamic_cast<OOX::CStyles*>(pFile.operator->());
|
||||
|
||||
// Ищем сноски для страниц
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::FootNote );
|
||||
if ( pFile.IsInit())
|
||||
m_pFootnotes = dynamic_cast<OOX::CFootnotes*>(pFile.operator->());
|
||||
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::EndNote );
|
||||
if ( pFile.IsInit())
|
||||
m_pEndnotes = dynamic_cast<OOX::CEndnotes*>(pFile.operator->());
|
||||
|
||||
// Ищем файл с наcтройками
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::Setting );
|
||||
if ( pFile.IsInit() )
|
||||
m_pSettings = dynamic_cast<OOX::CSettings*>(pFile.operator->());
|
||||
|
||||
// Ищем файл с комментариями
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::Comments );
|
||||
if ( pFile.IsInit())
|
||||
m_pComments = dynamic_cast<OOX::CComments*>(pFile.operator->());
|
||||
|
||||
// Ищем файл с комментариями Ext
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::CommentsExt );
|
||||
if ( pFile.IsInit())
|
||||
m_pCommentsExt = dynamic_cast<OOX::CCommentsExt*>(pFile.operator->());
|
||||
|
||||
// Ищем файл с авторами
|
||||
pFile = m_pDocument->Find( OOX::FileTypes::People );
|
||||
if ( pFile.IsInit())
|
||||
m_pPeople = dynamic_cast<OOX::CPeople*>(pFile.operator->());
|
||||
|
||||
//OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName());
|
||||
//IFileContainer::Read(rels, oFilePath);
|
||||
|
||||
// Ищем файл с темами
|
||||
pFile = m_pDocument->Find(OOX::FileTypes::Theme);
|
||||
if (pFile.IsInit())
|
||||
m_pTheme = dynamic_cast<PPTX::Theme*>(pFile.operator->());
|
||||
|
||||
pFile = m_pDocument->Find(OOX::FileTypes::VbaProject);
|
||||
if (pFile.IsInit())
|
||||
m_pVbaProject = dynamic_cast<OOX::VbaProject*>(pFile.operator->());
|
||||
}
|
||||
|
||||
// Ищем настройки
|
||||
pFile = Find( OOX::FileTypes::App );
|
||||
if ( pFile.IsInit())
|
||||
m_pApp = dynamic_cast<OOX::CApp*>(pFile.operator->());
|
||||
|
||||
pFile = Find( OOX::FileTypes::Core );
|
||||
if ( pFile.IsInit())
|
||||
m_pCore = dynamic_cast<OOX::CCore*>(pFile.operator->());
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
OOX::CHdrFtr *CDocx::GetHeaderOrFooter(const OOX::RId& rId) const
|
||||
{
|
||||
if ( m_pDocument )
|
||||
{
|
||||
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
|
||||
|
||||
smart_ptr<OOX::File> pFile = pDocumentContainer->Find( rId );
|
||||
if ( pFile.IsInit() && ( OOX::FileTypes::Header == pFile->type() || OOX::FileTypes::Footer == pFile->type() ) )
|
||||
return (OOX::CHdrFtr*)pFile.operator->();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,38 +38,36 @@
|
||||
#include "Rels.h"
|
||||
#include "IFileContainer.h"
|
||||
#include "FileTypes.h"
|
||||
#include "App.h"
|
||||
#include "Core.h"
|
||||
#include "Document.h"
|
||||
#include "FontTable.h"
|
||||
#include "Numbering.h"
|
||||
#include "Comments.h"
|
||||
#include "Styles.h"
|
||||
#include "Footnote.h"
|
||||
#include "Endnote.h"
|
||||
#include "Settings/WebSettings.h"
|
||||
#include "Settings/Settings.h"
|
||||
#include "External/HyperLink.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "Media/ActiveX.h"
|
||||
#include "Media/VbaProject.h"
|
||||
#include "Media/JsaProject.h"
|
||||
#include "HeaderFooter.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Theme;
|
||||
}
|
||||
namespace OOX
|
||||
{
|
||||
class CDocx : public OOX::IFileContainer
|
||||
class CApp;
|
||||
class CCore;
|
||||
class CDocument;
|
||||
class CFontTable;
|
||||
class CNumbering;
|
||||
class CStyles;
|
||||
class CFootnotes;
|
||||
class CEndnotes;
|
||||
class CSettings;
|
||||
class CComments;
|
||||
class CCommentsExt;
|
||||
class CPeople;
|
||||
class VbaProject;
|
||||
class CHdrFtr;
|
||||
|
||||
class CDocx : public OOX::Document, public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
|
||||
CDocx()
|
||||
CDocx() : OOX::IFileContainer(dynamic_cast<OOX::Document*>(this))
|
||||
{
|
||||
m_pDocument = NULL;
|
||||
m_pFontTable = NULL;
|
||||
@ -86,7 +84,7 @@ namespace OOX
|
||||
m_pPeople = NULL;
|
||||
m_pVbaProject = NULL;
|
||||
}
|
||||
CDocx(const CPath& oFilePath)
|
||||
CDocx(const CPath& oFilePath) : OOX::IFileContainer(this)
|
||||
{
|
||||
m_pDocument = NULL;
|
||||
m_pFontTable = NULL;
|
||||
@ -186,22 +184,9 @@ namespace OOX
|
||||
return m_pTheme;
|
||||
}
|
||||
|
||||
OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const
|
||||
{
|
||||
if ( m_pDocument )
|
||||
{
|
||||
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
|
||||
|
||||
smart_ptr<OOX::File> pFile = pDocumentContainer->Find( rId );
|
||||
if ( pFile.IsInit() && ( OOX::FileTypes::Header == pFile->type() || OOX::FileTypes::Footer == pFile->type() ) )
|
||||
return (OOX::CHdrFtr*)pFile.operator->();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const;
|
||||
|
||||
|
||||
OOX::CApp *m_pApp;
|
||||
OOX::CCore *m_pCore;
|
||||
|
||||
|
||||
@ -39,6 +39,10 @@ namespace OOX
|
||||
{
|
||||
namespace Drawing
|
||||
{
|
||||
CCompatExt::~CCompatExt()
|
||||
{
|
||||
}
|
||||
|
||||
COfficeArtExtension::~COfficeArtExtension()
|
||||
{
|
||||
m_oSparklineGroups.reset();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user