Compare commits

...

6 Commits

Author SHA1 Message Date
281dad68fb . 2018-01-19 14:42:32 +03:00
04ba432cde x2t version 2.4.508 2018-01-19 14:14:33 +03:00
61c943a3b2 up 2018-01-19 13:46:06 +03:00
9fdc7641b3 . 2018-01-18 15:24:33 +03:00
1029ee9101 OoxToBinary - modify preparing to binary write 2018-01-18 15:13:21 +03:00
9ef5bec2a5 [ios] fixed build 2018-01-17 12:43:03 +03:00
139 changed files with 2042 additions and 1868 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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";
@ -142,29 +147,32 @@ namespace BinXlsxRW{
{
std::vector<std::wstring> aSharedStrings;
//Sheet
OOX::Spreadsheet::CWorkbook* pWorkbook = oXlsx.CreateWorkbook();
pWorkbook->m_oSheets.Init();
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 (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 +181,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 +193,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 +215,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 +248,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 +300,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();
@ -490,14 +502,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,10 +529,11 @@ 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;
}

View File

@ -34,6 +34,7 @@
#include <string>
#include <vector>
#include <map>
#include <boost/unordered_map.hpp>
namespace OOX
@ -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 std::map<int, std::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);

View File

@ -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(""));

View File

@ -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 {

View File

@ -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);

View File

@ -887,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())
{

View File

@ -1348,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)
{
@ -1368,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();

View File

@ -439,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);

View File

@ -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"

View File

@ -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
{

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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->());
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -44,7 +44,7 @@ namespace PPTX
class FileContainer : public OOX::IFileContainer
{
public:
FileContainer()
FileContainer(OOX::Document *pMain) : OOX::IFileContainer(pMain)
{
m_lPercent = 0;
m_bCancelled = false;

View File

@ -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

View File

@ -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_

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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();

View File

@ -39,6 +39,10 @@
#include "SpPr.h"
#include "ShapeStyle.h"
namespace OOX
{
class OleObject;
}
namespace PPTX
{
namespace Limit

View File

@ -38,6 +38,9 @@ namespace PPTX
{
namespace Logic
{
MathParaWrapper::~MathParaWrapper()
{
}
MathParaWrapper& MathParaWrapper::operator=(const MathParaWrapper& oSrc)
{
//todo

View File

@ -53,6 +53,8 @@ namespace PPTX
WritingElement_AdditionConstructors(MathParaWrapper)
MathParaWrapper() {}
virtual ~MathParaWrapper();
MathParaWrapper& operator=(const MathParaWrapper& oSrc);
virtual OOX::EElementType getType () const

View File

@ -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->());
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -33,7 +33,6 @@
#ifndef PPTX_INCLUDE_H_
#define PPTX_INCLUDE_H_
//#include "FileFactory.h"
#include "Folder.h"
#include "Presentation.h"
#include "Slide.h"

View File

@ -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);
}

View File

@ -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>();

View File

@ -62,10 +62,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);
}
@ -305,7 +305,7 @@ namespace PPTX
}
case 4:
{
comments = new PPTX::Comments();
comments = new PPTX::Comments(OOX::File::m_pMainDocument);
comments->fromPPTY(pReader);
break;
}

View File

@ -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);
}

View File

@ -61,10 +61,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);
}

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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("");

View File

@ -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 */,

View File

@ -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"
>

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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;

View File

@ -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(""));

View File

@ -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 \

View File

@ -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"

View File

@ -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 */,

View File

@ -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"
>

View File

@ -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;

View File

@ -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;

View File

@ -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()

View File

@ -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()

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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: Сделать добавление гиперссылок в параграфах

View File

@ -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->());
// Ищем файл с наройками
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;
}
}

View File

@ -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;

View File

@ -39,6 +39,10 @@ namespace OOX
{
namespace Drawing
{
CCompatExt::~CCompatExt()
{
}
COfficeArtExtension::~COfficeArtExtension()
{
m_oSparklineGroups.reset();

View File

@ -53,24 +53,20 @@ namespace OOX
CCompatExt()
{
}
virtual ~CCompatExt()
{
}
virtual ~CCompatExt();
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
//todo
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return _T("");
}
@ -156,8 +152,6 @@ namespace OOX
}
virtual ~COfficeArtExtension();
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("uri"), m_sUri );

View File

@ -47,11 +47,16 @@ namespace OOX
{
public:
CEndnotes()
CEndnotes(OOX::Document *pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pEndnotes = this;
}
CEndnotes(const CPath& oRootPath, const CPath& oPath)
CEndnotes(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pEndnotes = this;
read( oRootPath, oPath );
}
virtual ~CEndnotes()

View File

@ -42,10 +42,10 @@ namespace OOX
class External : public File
{
public:
External()
External(OOX::Document* pMain) : File(pMain)
{
}
External(const CPath& uri)
External(OOX::Document* pMain, const CPath& uri) : File(pMain)
{
read(uri);
}

View File

@ -41,11 +41,11 @@ namespace OOX
class HyperLink : public External
{
public:
HyperLink()
HyperLink(OOX::Document* pMain) : External(pMain)
{
bHyperlink = true;
}
HyperLink(const CPath& uri)
HyperLink(OOX::Document* pMain, const CPath& uri) : External(pMain)
{
bHyperlink = true;
read(uri);

View File

@ -43,12 +43,12 @@ namespace OOX
class File
{
public:
File(){
File(OOX::Document *pMain) : m_pMainDocument(pMain)
{
m_bDoNotAddRels = false;
}
virtual ~File(){}
public:
virtual void read(const CPath& filename) = 0;
virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const = 0;
@ -58,13 +58,15 @@ namespace OOX
std::wstring m_sOutputFilename;
bool m_bDoNotAddRels;
OOX::Document *m_pMainDocument;
};
class FileGlobalEnumerated : public File
{
private:
int m_nGlobalNumber;
public:
FileGlobalEnumerated()
FileGlobalEnumerated(OOX::Document* pMain) : File(pMain)
{
m_nGlobalNumber = 0;
}

View File

@ -64,7 +64,7 @@
namespace OOX
{
const smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const OOX::CPath& oPath, const OOX::Rels::CRelationShip& oRelation)
const smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const OOX::CPath& oPath, const OOX::Rels::CRelationShip& oRelation, OOX::Document *pMain)
{
OOX::CPath oRelationFilename = oRelation.Filename();
CPath oFileName;
@ -74,79 +74,79 @@ namespace OOX
oFileName = oPath / oRelationFilename;
if ( oRelation.Type() == FileTypes::Document || oRelation.Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDocument( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName ));
return smart_ptr<OOX::File>(new CFontTable( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Style)
return smart_ptr<OOX::File>(new CStyles( oFileName ));
return smart_ptr<OOX::File>(new CStyles( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Bibliography)
return smart_ptr<OOX::File>(new CBibliography( oFileName ));
return smart_ptr<OOX::File>(new CBibliography( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::FootNote)
return smart_ptr<OOX::File>(new CFootnotes( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CFootnotes( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::EndNote)
return smart_ptr<OOX::File>(new CEndnotes( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CEndnotes( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::WebSetting)
return smart_ptr<OOX::File>(new CWebSettings( oFileName ));
return smart_ptr<OOX::File>(new CWebSettings( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Numbering)
return smart_ptr<OOX::File>(new CNumbering( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CNumbering( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Header)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Footer)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Comments)
return smart_ptr<OOX::File>(new CComments( oFileName ));
return smart_ptr<OOX::File>(new CComments( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::CommentsExt )
return smart_ptr<OOX::File>(new CCommentsExt( oFileName ));
return smart_ptr<OOX::File>(new CCommentsExt( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::People )
return smart_ptr<OOX::File>(new CPeople( oFileName ));
return smart_ptr<OOX::File>(new CPeople( pMain, oFileName ));
//common
else if ( oRelation.Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName ));
return smart_ptr<OOX::File>(new CSettings( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::App )
return smart_ptr<OOX::File>(new CApp( oFileName ));
return smart_ptr<OOX::File>(new CApp( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
return smart_ptr<OOX::File>(new CCore( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Theme)
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
return smart_ptr<OOX::File>(new PPTX::Theme( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
return smart_ptr<OOX::File>(new PPTX::Theme( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::HyperLink)
return smart_ptr<OOX::File>(new HyperLink( oRelation.Target()));
return smart_ptr<OOX::File>(new HyperLink( pMain, oRelation.Target()));
else if ( oRelation.Type() == FileTypes::OleObject)
return smart_ptr<OOX::File>(new OleObject( oFileName ));
return smart_ptr<OOX::File>(new OleObject( pMain, oFileName ));
else if ( oRelation.Type() == FileTypes::Image)
return smart_ptr<OOX::File>(new Image( oFileName, oRelation.IsExternal() ));
return smart_ptr<OOX::File>(new Image( pMain, oFileName, oRelation.IsExternal() ));
else if ( oRelation.Type() == FileTypes::Audio)
return smart_ptr<OOX::File>(new Audio( oFileName, oRelation.IsExternal() ));
return smart_ptr<OOX::File>(new Audio( pMain, oFileName, oRelation.IsExternal() ));
else if ( oRelation.Type() == FileTypes::Video)
return smart_ptr<OOX::File>(new Video( oFileName, oRelation.IsExternal() ));
return smart_ptr<OOX::File>(new Video( pMain, oFileName, oRelation.IsExternal() ));
else if (oRelation.Type() == FileTypes::Data)
return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDiagramData( pMain, oRootPath, oFileName ));
else if (oRelation.Type() == FileTypes::DiagDrawing)
return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDiagramDrawing( pMain, oRootPath, oFileName ));
else if (oRelation.Type() == FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
return smart_ptr<OOX::File>(new OleObject( pMain, oFileName, true ));
else if ( oRelation.Type() == OOX::FileTypes::VmlDrawing )
return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CVmlDrawing( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_xml)
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( oRootPath, oFileName));
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( pMain, oRootPath, oFileName));
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_bin)
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( oFileName ));
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( pMain, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new OOX::VbaProject( pMain, oRootPath, oFileName ));
//else if ( oRelation.Type() == OOX::FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else if ( oRelation.Type() == FileTypes::JsaProject)
return smart_ptr<OOX::File>(new JsaProject( oFileName ));
return smart_ptr<OOX::File>(new JsaProject( pMain, oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
return smart_ptr<OOX::File>( new UnknowTypeFile(pMain) );
}
const smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const OOX::CPath& oPath, OOX::Rels::CRelationShip* pRelation)
const smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const OOX::CPath& oPath, OOX::Rels::CRelationShip* pRelation, OOX::Document* pMain)
{
if (pRelation == NULL) return smart_ptr<OOX::File>( new UnknowTypeFile() );
if (pRelation == NULL) return smart_ptr<OOX::File>( new UnknowTypeFile(pMain) );
OOX::CPath oRelationFilename = pRelation->Filename();
CPath oFileName;
@ -156,80 +156,80 @@ namespace OOX
oFileName = oPath / oRelationFilename;
if ( pRelation->Type() == FileTypes::App )
return smart_ptr<OOX::File>(new CApp( oFileName ));
return smart_ptr<OOX::File>(new CApp( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
return smart_ptr<OOX::File>(new CCore( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Document || pRelation->Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDocument( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Theme)
{
if(NSFile::CFileBinary::Exists(oFileName.GetPath()))
{
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
return smart_ptr<OOX::File>(new PPTX::Theme( pMain, oFileName ));
}
else
{
return smart_ptr<OOX::File>( new UnknowTypeFile() );
return smart_ptr<OOX::File>( new UnknowTypeFile(pMain) );
}
}
else if ( pRelation->Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
return smart_ptr<OOX::File>(new PPTX::Theme( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName ));
return smart_ptr<OOX::File>(new CSettings( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName ));
return smart_ptr<OOX::File>(new CFontTable( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Style)
return smart_ptr<OOX::File>(new CStyles( oFileName ));
return smart_ptr<OOX::File>(new CStyles( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Bibliography)
return smart_ptr<OOX::File>(new CBibliography( oFileName ));
return smart_ptr<OOX::File>(new CBibliography( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::FootNote)
return smart_ptr<OOX::File>(new CFootnotes( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CFootnotes( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::EndNote)
return smart_ptr<OOX::File>(new CEndnotes( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CEndnotes( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::WebSetting)
return smart_ptr<OOX::File>(new CWebSettings( oFileName ));
return smart_ptr<OOX::File>(new CWebSettings( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::HyperLink)
return smart_ptr<OOX::File>(new HyperLink( pRelation->Target()));
return smart_ptr<OOX::File>(new HyperLink( pMain, pRelation->Target()));
else if ( pRelation->Type() == FileTypes::OleObject)
return smart_ptr<OOX::File>(new OleObject( oFileName ));
return smart_ptr<OOX::File>(new OleObject( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::Image)
return smart_ptr<OOX::File>(new Image( oFileName, pRelation->IsExternal() ));
return smart_ptr<OOX::File>(new Image( pMain, oFileName, pRelation->IsExternal() ));
else if ( pRelation->Type() == FileTypes::Audio)
return smart_ptr<OOX::File>(new Audio( oFileName, pRelation->IsExternal() ));
return smart_ptr<OOX::File>(new Audio( pMain, oFileName, pRelation->IsExternal() ));
else if ( pRelation->Type() == FileTypes::Video)
return smart_ptr<OOX::File>(new Video( oFileName, pRelation->IsExternal() ));
return smart_ptr<OOX::File>(new Video( pMain, oFileName, pRelation->IsExternal() ));
else if ( pRelation->Type() == FileTypes::Numbering)
return smart_ptr<OOX::File>(new CNumbering( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CNumbering( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Header)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Footer)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Comments)
return smart_ptr<OOX::File>(new CComments( oFileName ));
return smart_ptr<OOX::File>(new CComments( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::CommentsExt )
return smart_ptr<OOX::File>(new CCommentsExt( oFileName ));
return smart_ptr<OOX::File>(new CCommentsExt( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::People )
return smart_ptr<OOX::File>(new CPeople( oFileName ));
return smart_ptr<OOX::File>(new CPeople( pMain, oFileName ));
else if (pRelation->Type() == FileTypes::Data)
return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDiagramData( pMain, oRootPath, oFileName ));
else if (pRelation->Type() == FileTypes::DiagDrawing)
return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new CDiagramDrawing( pMain, oRootPath, oFileName ));
else if (pRelation->Type() == FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
return smart_ptr<OOX::File>(new OleObject( pMain, oFileName, true ));
else if ( pRelation->Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::ActiveX_xml)
return smart_ptr<OOX::File>(new ActiveX_xml( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new ActiveX_xml( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::ActiveX_bin)
return smart_ptr<OOX::File>(new ActiveX_bin( oFileName ));
return smart_ptr<OOX::File>(new ActiveX_bin( pMain, oFileName ));
else if ( pRelation->Type() == FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
return smart_ptr<OOX::File>(new OOX::VbaProject( pMain, oRootPath, oFileName ));
//else if ( pRelation->Type() == FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else if ( pRelation->Type() == FileTypes::JsaProject)
return smart_ptr<OOX::File>(new JsaProject( oFileName ));
return smart_ptr<OOX::File>(new JsaProject( pMain, oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
return smart_ptr<OOX::File>( new UnknowTypeFile(pMain) );
}
} // namespace OOX

View File

@ -38,6 +38,7 @@
namespace OOX
{
class Document;
class File;
namespace Rels
{
@ -47,8 +48,8 @@ namespace OOX
namespace OOX
{
const NSCommon::smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const CPath& oPath, const OOX::Rels::CRelationShip& oRelation);
const NSCommon::smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const CPath& oPath, OOX::Rels::CRelationShip* pRelation);
const NSCommon::smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const CPath& oPath, const OOX::Rels::CRelationShip& oRelation, OOX::Document *pMain);
const NSCommon::smart_ptr<OOX::File> CreateFile(const OOX::CPath& oRootPath, const CPath& oPath, OOX::Rels::CRelationShip* pRelation, OOX::Document *pMain);
} // namespace OOX
#endif // OOX_FILE_FACTORY_INCLUDE_H_

View File

@ -40,18 +40,24 @@
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
#include "../SystemUtility/File.h"
namespace OOX
{
class CFontTable : public OOX::File
{
public:
CFontTable()
CFontTable(OOX::Document *pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pFontTable = this;
}
CFontTable(const CPath &oFilePath)
CFontTable(OOX::Document *pMain, const CPath &oFilePath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pFontTable = this;
read( oFilePath );
}

View File

@ -47,11 +47,16 @@ namespace OOX
{
public:
CFootnotes()
CFootnotes(OOX::Document *pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pFootnotes = this;
}
CFootnotes(const CPath& oRootPath, const CPath& oPath)
CFootnotes(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pFootnotes = this;
read( oRootPath, oPath );
}
virtual ~CFootnotes()

View File

@ -59,11 +59,11 @@ namespace OOX
class CHdrFtr : public OOX::File, public IFileContainer
{
public:
CHdrFtr()
CHdrFtr(OOX::Document *pMain) : OOX::File(pMain), IFileContainer(pMain)
{
m_eType = et_Unknown;
}
CHdrFtr(const CPath& oRootPath, const CPath& oFilePath)
CHdrFtr(OOX::Document *pMain, const CPath& oRootPath, const CPath& oFilePath) : OOX::File(pMain), IFileContainer(pMain)
{
m_eType = et_Unknown;
read( oRootPath, oFilePath );

View File

@ -48,24 +48,21 @@
namespace OOX
{
boost::unordered_map<std::wstring, size_t> IFileContainer::m_mapEnumeratedGlobal;
std::map<std::wstring, size_t> IFileContainer::m_mapEnumeratedGlobal;
UnknowTypeFile IFileContainer::Unknown;
UnknowTypeFile IFileContainer::Unknown(NULL);
IFileContainer::IFileContainer()
IFileContainer::IFileContainer(OOX::Document* pMain) : m_pMainDocument(pMain)
{
m_bSpreadsheets = false;
m_lMaxRid = 0;
m_pCurRels = NULL;
}
IFileContainer::~IFileContainer()
{
RELEASEOBJECT(m_pCurRels);
}
void IFileContainer::Read (const OOX::CPath& oRootPath, const OOX::CPath& oPath)
{
// Находим связи(рельсы) с данным файлом
RELEASEOBJECT(m_pCurRels);
m_pCurRels = new OOX::CRels(oPath);
// Читаем все файлы по рельсам
@ -75,19 +72,19 @@ namespace OOX
void IFileContainer::Read (const OOX::CRels& oRels, const OOX::CPath& oRootPath, const OOX::CPath& oPath)
{
for (boost::unordered_map<std::wstring, Rels::CRelationShip*>::const_iterator it = oRels.m_mapRelations.begin(); it != oRels.m_mapRelations.end(); ++it)
for (size_t i = 0; i < oRels.m_arRelations.size(); ++i)
{
if (!it->second) continue;
if (!oRels.m_arRelations[i]) continue;
smart_ptr<OOX::File> pFile;
if (m_bSpreadsheets)
pFile = OOX::Spreadsheet::CreateFile( oRootPath, oPath, it->second );
pFile = OOX::Spreadsheet::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
if (pFile.IsInit() == false || pFile->type() == FileTypes::Unknow)
pFile = OOX::CreateFile( oRootPath, oPath, it->second );
pFile = OOX::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
Add( it->second->rId(), pFile );
Add( oRels.m_arRelations[i]->rId(), pFile );
}
}
@ -102,7 +99,7 @@ namespace OOX
}
void IFileContainer::Write(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent) const
{
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;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
@ -117,7 +114,7 @@ namespace OOX
if(false == pFile->m_sOutputFilename.empty())
oName.SetName(pFile->m_sOutputFilename, false);
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
if(m_mNoWriteContainer.end() == itFind)
{
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
@ -145,9 +142,9 @@ namespace OOX
void IFileContainer::Commit (const OOX::CPath& oPath)
{
boost::unordered_map<std::wstring, size_t> mNamepair;
std::map<std::wstring, size_t> mNamepair;
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
smart_ptr<OOX::File> pFile = it->second;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
@ -161,7 +158,7 @@ namespace OOX
OOX::CPath oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = mNamepair.find( oName.m_strFilename );
std::map<std::wstring, size_t>::const_iterator pNamePair = mNamepair.find( oName.m_strFilename );
if (pNamePair == mNamepair.end())
mNamepair [oName.m_strFilename] = 1;
@ -188,9 +185,9 @@ namespace OOX
}
void IFileContainer::Finalize(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent)
{
boost::unordered_map<std::wstring, size_t> mNamepair;
std::map<std::wstring, size_t> mNamepair;
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
smart_ptr<OOX::File> pFile = it->second;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
@ -202,13 +199,13 @@ namespace OOX
OOX::CPath oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
boost::unordered_map<std::wstring, size_t>::iterator pNamePair = mNamepair.find( oName.m_strFilename );
std::map<std::wstring, size_t>::iterator pNamePair = mNamepair.find( oName.m_strFilename );
if ( pNamePair == mNamepair.end() )
mNamepair [oName.m_strFilename] = 1;
else
oName = oName + pNamePair->first;
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(it->first);
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(it->first);
if(m_mNoWriteContainer.end() == itFind)
{
@ -239,7 +236,7 @@ namespace OOX
void IFileContainer::ExtractPictures (const OOX::CPath& oPath) const
{
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
smart_ptr<OOX::File> pFile = it->second;
@ -260,7 +257,7 @@ namespace OOX
}
const bool IFileContainer::IsExist(const FileType& oType) const
{
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
if (oType == it->second->type())
return true;
@ -270,7 +267,7 @@ namespace OOX
}
const bool IFileContainer::IsExist(const RId& rId) const
{
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.find(rId.get());
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.find(rId.get());
return (it != m_mContainer.end());
}
@ -282,7 +279,7 @@ namespace OOX
}
std::wstring IFileContainer::IsExistHyperlink(smart_ptr<OOX::HyperLink>& pHyperLink)
{
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)
{
if(OOX::FileTypes::HyperLink == pPair->second->type())
{
@ -295,7 +292,7 @@ namespace OOX
}
const bool IFileContainer::IsExternal(const OOX::RId& rId) const
{
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mContainer.find(rId.get());
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mContainer.find(rId.get());
if (pFind != m_mContainer.end())
{
@ -315,7 +312,7 @@ namespace OOX
smart_ptr<OOX::File> IFileContainer::Get(const FileType& oType)
{
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
if (oType == it->second->type())
return it->second;
@ -326,7 +323,7 @@ namespace OOX
void IFileContainer::Get(const FileType& oType, std::vector<smart_ptr<OOX::File>> & files)
{
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)
{
if ( oType == pPair->second->type() )
files.push_back(pPair->second);
@ -350,13 +347,13 @@ namespace OOX
if(true == bEnumeratedGlobal)
{
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find (pFile->type().OverrideType());
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find (pFile->type().OverrideType());
if (pNamePair != m_mapEnumeratedGlobal.end())
nIndex = pNamePair->second;
}
else
{
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapAddNamePair.find (pFile->type().OverrideType());
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapAddNamePair.find (pFile->type().OverrideType());
if (pNamePair != m_mapAddNamePair.end())
nIndex = pNamePair->second;
}
@ -406,31 +403,22 @@ namespace OOX
smart_ptr<OOX::File> IFileContainer::Find(const FileType& oType) const
{
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)
{
if ( oType == pPair->second->type() )
return pPair->second;
}
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile() );
}
void IFileContainer::FindAllByType(const FileType& oType, boost::unordered_map<std::wstring, smart_ptr<OOX::File>>& aOutput) const
{
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
{
if ( oType == pPair->second->type() )
{
aOutput [pPair->first] = pPair->second;
}
}
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
smart_ptr<OOX::File> IFileContainer::Find(const OOX::RId& rId) const
{
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if ( pPair != m_mContainer.end())
return pPair->second;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile() );
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
template<typename T>
@ -441,11 +429,11 @@ namespace OOX
}
smart_ptr<OOX::File> IFileContainer::operator [](const OOX::RId rId)
{
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if ( pPair != m_mContainer.end())
return pPair->second;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile() );
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
smart_ptr<OOX::File> IFileContainer::operator [](const FileType& oType)
@ -463,7 +451,7 @@ namespace OOX
}
int IFileContainer::GetGlobalNumberByType(const std::wstring& sOverrideType)
{
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find( sOverrideType );
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find( sOverrideType );
int nRes = 0;
if(pNamePair != m_mapEnumeratedGlobal.end())
nRes = pNamePair->second;

View File

@ -44,12 +44,7 @@ namespace OOX
class FileType;
class CRels;
class CContentTypes;
class Image;
class HyperLink;
class OleObject;
class ActiveX_xml;
class ActiveX_bin;
}
namespace PPTX
@ -62,15 +57,17 @@ namespace OOX
class IFileContainer
{
public:
IFileContainer();
IFileContainer(OOX::Document* pMain);
virtual ~IFileContainer();
bool m_bSpreadsheets;
static boost::unordered_map<std::wstring, size_t> m_mapEnumeratedGlobal;
bool m_bSpreadsheets;
static std::map<std::wstring, size_t> m_mapEnumeratedGlobal;
OOX::Document* m_pMainDocument;
smart_ptr<OOX::CRels> m_pCurRels;
protected:
boost::unordered_map<std::wstring, smart_ptr<OOX::File>> m_mContainer;
boost::unordered_map<std::wstring, std::wstring> m_mNoWriteContainer;
size_t m_lMaxRid;
std::map<std::wstring, smart_ptr<OOX::File>> m_mContainer;
std::map<std::wstring, std::wstring> m_mNoWriteContainer;
size_t m_lMaxRid;
void Read (const OOX::CRels& oRels, const OOX::CPath& oRootPath, const CPath& oPath);
void Write (const OOX::CPath& oFileName, const CPath& oDir, OOX::CContentTypes& oContent) const;
@ -87,16 +84,11 @@ namespace OOX
template<class TypeOut>
smart_ptr<TypeOut> Get (const RId& rId) const
{
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
return smart_ptr<TypeOut>();
return pPair->second.smart_dynamic_cast<TypeOut>();
}
OOX::CRels* GetCurRls()
{
return m_pCurRels;
}
template<typename T>
const bool IsExist() const;
@ -128,9 +120,9 @@ namespace OOX
protected:
static UnknowTypeFile Unknown;
private:
boost::unordered_map<std::wstring, size_t> m_mapAddNamePair;
OOX::CRels* m_pCurRels;
const RId GetMaxRId();
std::map<std::wstring, size_t> m_mapAddNamePair;
const RId GetMaxRId();
};
} // namespace OOX

View File

@ -93,11 +93,11 @@ namespace OOX
class ActiveX_xml : public File, public OOX::IFileContainer
{
public:
ActiveX_xml()
ActiveX_xml(OOX::Document *pMain) : File(pMain), OOX::IFileContainer(pMain)
{
m_bDocument = false;
}
ActiveX_xml(const CPath& oRootPath, const CPath& filename)
ActiveX_xml(OOX::Document *pMain, const CPath& oRootPath, const CPath& filename) : File(pMain), OOX::IFileContainer(pMain)
{
m_bDocument = false;
read( oRootPath, filename );
@ -195,10 +195,10 @@ namespace OOX
class ActiveX_bin : public Media
{
public:
ActiveX_bin(bool bDocument = true) : Media (bDocument)
ActiveX_bin(OOX::Document *pMain, bool bDocument = true) : Media (pMain, bDocument)
{
}
ActiveX_bin(const OOX::CPath& filename)
ActiveX_bin(OOX::Document *pMain, const OOX::CPath& filename) : Media (pMain)
{
read(filename);
}

View File

@ -40,10 +40,10 @@ namespace OOX
class Audio : public Media
{
public:
Audio(bool bDocument = true) : Media (bDocument)
Audio(OOX::Document* pMain, bool bDocument = true) : Media (pMain, bDocument)
{
}
Audio(const CPath& filename, bool bExternal = false) : Media(filename, bExternal)
Audio(OOX::Document* pMain, const CPath& filename, bool bExternal = false) : Media(pMain, filename, bExternal)
{
}
virtual ~Audio()

View File

@ -40,10 +40,10 @@ namespace OOX
class Image : public Media
{
public:
Image(bool bDocument = true) : Media (bDocument)
Image(OOX::Document* pMain, bool bDocument = true) : Media (pMain, bDocument)
{
}
Image(const CPath& filename, bool bExternal = false) : Media(filename, bExternal)
Image(OOX::Document* pMain, const CPath& filename, bool bExternal = false) : Media(pMain, filename, bExternal)
{
}
virtual ~Image()

View File

@ -41,10 +41,10 @@ namespace OOX
class JsaProject : public Media
{
public:
JsaProject()
JsaProject( OOX::Document *pMain ) : Media(pMain)
{
}
JsaProject(const CPath& filename)
JsaProject(OOX::Document *pMain, const CPath& filename) : Media(pMain)
{
read(filename);
}

View File

@ -42,12 +42,12 @@ namespace OOX
class Media : public File
{
public:
Media(bool bDocument = true)
Media(OOX::Document *pMain, bool bDocument = true) : File(pMain)
{
m_bExternal = false;
m_bDocument = bDocument;
}
Media(const CPath& filename, bool bExternal = false)
Media(OOX::Document *pMain, const CPath& filename, bool bExternal = false) : File(pMain)
{
m_bExternal = bExternal;
m_filename = filename;

View File

@ -41,11 +41,11 @@ namespace OOX
class OleObject : public Media
{
public:
OleObject(bool bMsPackage = false, bool bDocument = true) : Media (bDocument)
OleObject(OOX::Document *pMain, bool bMsPackage = false, bool bDocument = true) : Media (pMain, bDocument)
{
m_bMsPackage = bMsPackage;
}
OleObject(const OOX::CPath& filename, bool bMsPackage = false)
OleObject(OOX::Document *pMain, const OOX::CPath& filename, bool bMsPackage = false) : Media (pMain)
{
m_bMsPackage = bMsPackage;
read(filename);

View File

@ -33,6 +33,7 @@
#ifndef OOX_VBA_PROJECT_INCLUDE_H_
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "../Docx.h"
#include "Media.h"
#include "../../../../../ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h"
#include "../../../../../ASCOfficePPTXFile/Editor/imagemanager.h"
@ -45,11 +46,16 @@ namespace OOX
class VbaProject : public Media, public OOX::IFileContainer
{
public:
VbaProject( )
VbaProject( OOX::Document *pMain ) : Media(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pVbaProject = this;
}
VbaProject(const CPath& oRootPath, const CPath& filename)
VbaProject(OOX::Document *pMain, const CPath& oRootPath, const CPath& filename) : Media(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pVbaProject = this;
read( oRootPath, filename );
}
virtual void read(const CPath& oRootPath, const CPath& oPath)

View File

@ -41,10 +41,10 @@ namespace OOX
class Video : public Media
{
public:
Video(bool bDocument = true) : Media (bDocument)
Video(OOX::Document* pMain, bool bDocument = true) : Media (pMain, bDocument)
{
}
Video(const CPath& filename, bool bExternal = false) : Media(filename, bExternal)
Video(OOX::Document* pMain, const CPath& filename, bool bExternal = false) : Media(pMain, filename, bExternal)
{
}
virtual ~Video()

View File

@ -808,11 +808,16 @@ namespace OOX
class CNumbering : public OOX::File, public IFileContainer
{
public:
CNumbering()
CNumbering(OOX::Document *pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pNumbering = this;
}
CNumbering(const CPath& oRootPath, const CPath& oPath)
CNumbering(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pNumbering = this;
read( oRootPath, oPath );
}
virtual ~CNumbering()

View File

@ -45,8 +45,6 @@
#include "../../../../DesktopEditor/common/File.h"
#include <boost/unordered_map.hpp>
namespace OOX
{
namespace Rels
@ -172,13 +170,12 @@ namespace OOX
}
~CRels()
{
for (boost::unordered_map<std::wstring, Rels::CRelationShip*>::iterator it = m_mapRelations.begin(); it != m_mapRelations.end(); ++it)
for (size_t i = 0; i < m_arRelations.size(); ++i)
{
if ( it->second ) delete it->second;
it->second = NULL;
if ( m_arRelations[i] ) delete m_arRelations[i];
}
m_arRelations.clear();
m_mapRelations.clear();
}
void Read (const CPath& oFilePath)
@ -210,6 +207,8 @@ namespace OOX
if (pRel)
{
std::wstring rid = pRel->rId().get();
m_arRelations.push_back(pRel);
m_mapRelations.insert(std::make_pair( rid, pRel) );
}
}
@ -234,6 +233,8 @@ namespace OOX
if (pRel)
{
std::wstring rid = pRel->rId().get();
m_arRelations.push_back(pRel);
m_mapRelations.insert(std::make_pair( rid, pRel) );
}
}
@ -244,67 +245,75 @@ namespace OOX
}
void Write(const CPath& oFilePath) const
{
if ( !m_mapRelations.empty() )
if ( m_mapRelations.empty() )return;
CPath oFile = CreateFileName( oFilePath );
CSystemUtility::CreateDirectories( oFile.GetDirectory() );
XmlUtils::CXmlWriter oWriter;
oWriter.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
oWriter.WriteNodeBegin( _T("Relationships"), true );
oWriter.WriteAttribute( _T("xmlns"), _T("http://schemas.openxmlformats.org/package/2006/relationships") );
oWriter.WriteNodeEnd( _T("Relationships"), true, false );
for (size_t i = 0; i < m_arRelations.size(); ++i)
{
CPath oFile = CreateFileName( oFilePath );
CSystemUtility::CreateDirectories( oFile.GetDirectory() );
XmlUtils::CXmlWriter oWriter;
oWriter.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
oWriter.WriteNodeBegin( _T("Relationships"), true );
oWriter.WriteAttribute( _T("xmlns"), _T("http://schemas.openxmlformats.org/package/2006/relationships") );
oWriter.WriteNodeEnd( _T("Relationships"), true, false );
for (boost::unordered_map<std::wstring, Rels::CRelationShip*>::const_iterator it = m_mapRelations.begin(); it != m_mapRelations.end(); ++it)
{
if ( it->second )
oWriter.WriteString( it->second->toXML() );
}
oWriter.WriteNodeEnd(_T("Relationships") );
NSFile::CFileBinary::SaveToFile(oFile.GetPath(), oWriter.GetXmlString());
if ( m_arRelations[i] )
oWriter.WriteString( m_arRelations[i]->toXML() );
}
oWriter.WriteNodeEnd(_T("Relationships") );
NSFile::CFileBinary::SaveToFile(oFile.GetPath(), oWriter.GetXmlString());
}
void Registration(const RId& rId, const FileType& oType, const CPath& oPath)
{
if( !( FileTypes::Unknow == oType ) )
{
std::wstring strFileName = oPath.m_strFilename;
std::wstring strDir = oPath.GetDirectory() + _T("");
if( FileTypes::Unknow == oType ) return;
if ( L"" == oPath.GetExtention() )
std::wstring strFileName = oPath.m_strFilename;
std::wstring strDir = oPath.GetDirectory() + _T("");
Rels::CRelationShip* pRel = NULL;
if ( L"" == oPath.GetExtention() )
{
if ( oType.RelationType() == L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" )
{
if ( oType.RelationType() == L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" )
{
strFileName += L".bin";
m_mapRelations.insert( std::make_pair( rId.get(), new Rels::CRelationShip( rId, oType.RelationType(), strDir + strFileName )) );
}
else if ( oType.RelationType() == L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" )
{
strFileName += L".wmf" ;
m_mapRelations.insert( std::make_pair( rId.get(), new Rels::CRelationShip( rId, oType.RelationType(), strDir + strFileName )) );
}
strFileName += L".bin";
pRel = new Rels::CRelationShip( rId, oType.RelationType(), strDir + strFileName );
}
else
else if ( oType.RelationType() == L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" )
{
m_mapRelations.insert( std::make_pair( rId.get(), new Rels::CRelationShip( rId, oType.RelationType(), oPath.GetPath())));
strFileName += L".wmf" ;
pRel = new Rels::CRelationShip( rId, oType.RelationType(), strDir + strFileName );
}
}
else
{
pRel = new Rels::CRelationShip( rId, oType.RelationType(), oPath.GetPath());
}
if (pRel)
{
m_arRelations.push_back(pRel);
m_mapRelations.insert( std::make_pair( rId.get(), pRel));
}
}
void Registration(const RId& rId, const smart_ptr<External> pExternal)
{
m_mapRelations.insert( std::make_pair( rId.get(), new Rels::CRelationShip( rId, pExternal )) );
Rels::CRelationShip* pRel = new Rels::CRelationShip( rId, pExternal );
m_arRelations.push_back(pRel);
m_mapRelations.insert( std::make_pair( rId.get(), pRel) );
}
void GetRel(const RId& rId, Rels::CRelationShip** ppRelationShip)
{
(*ppRelationShip) = NULL;
boost::unordered_map<std::wstring, Rels::CRelationShip*>::iterator pFind = m_mapRelations.find(rId.get());
std::map<std::wstring, Rels::CRelationShip*>::iterator pFind = m_mapRelations.find(rId.get());
if (pFind != m_mapRelations.end())
{
(*ppRelationShip) = pFind->second;
@ -326,7 +335,8 @@ namespace OOX
public:
boost::unordered_map<std::wstring, Rels::CRelationShip*> m_mapRelations;
std::vector<Rels::CRelationShip*> m_arRelations;
std::map<std::wstring, Rels::CRelationShip*> m_mapRelations;
};
} // namespace OOX

View File

@ -2821,11 +2821,16 @@ namespace OOX
class CSettings : public OOX::File
{
public:
CSettings()
CSettings(OOX::Document *pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pSettings = this;
}
CSettings(const CPath& oPath)
CSettings(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pSettings = this;
read( oPath );
}
virtual ~CSettings()

View File

@ -146,10 +146,10 @@ namespace OOX
class CWebSettings : public OOX::File
{
public:
CWebSettings()
CWebSettings(OOX::Document *pMain) : OOX::File(pMain)
{
}
CWebSettings(const CPath& oPath)
CWebSettings(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
{
read( oPath );
}

View File

@ -772,11 +772,16 @@ namespace OOX
{
public:
CStyles()
CStyles(OOX::Document *pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pStyles = this;
}
CStyles(const CPath& oPath)
CStyles(OOX::Document *pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pStyles = this;
read( oPath );
}
virtual ~CStyles()

Some files were not shown because too many files have changed in this diff Show More