mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-17 21:36:11 +08:00
Compare commits
5 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 58f8d13d71 | |||
| d6413057e2 | |||
| 008382213b | |||
| dd5b4a719b | |||
| 3d198bc211 |
@ -164,7 +164,7 @@ namespace DocFileFormat
|
||||
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
|
||||
|
||||
std::list<std::wstring> entries = storageInp->entries(path);
|
||||
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++)
|
||||
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it)
|
||||
{
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ (*it));
|
||||
if (stream_inp == NULL)continue;
|
||||
|
||||
@ -90,7 +90,7 @@ namespace DocFileFormat
|
||||
std::list<std::wstring> entries, entries_sort;
|
||||
entries = m_pStorage->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
@ -104,8 +104,8 @@ namespace DocFileFormat
|
||||
entries_sort.push_front(name);
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
@ -159,13 +159,13 @@ namespace DocFileFormat
|
||||
OOX::CDocument docEmbedded(path, path);
|
||||
|
||||
bool res = false;
|
||||
for (std::list<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); ++it)
|
||||
{
|
||||
if ((*it)->getType() == OOX::et_w_p)
|
||||
{
|
||||
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(*it);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
|
||||
for (std::vector<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
|
||||
(paragraph) && (jt != paragraph->m_arrItems.end()); jt++)
|
||||
{
|
||||
if ((*jt)->getType() == OOX::et_m_oMath)
|
||||
@ -178,7 +178,7 @@ namespace DocFileFormat
|
||||
{
|
||||
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(*jt);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
|
||||
for (std::vector<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
|
||||
(mathPara) && (kt != mathPara->m_arrItems.end()); kt++)
|
||||
{
|
||||
if ((*kt)->getType() == OOX::et_m_oMath)
|
||||
|
||||
@ -559,7 +559,7 @@ namespace DocFileFormat
|
||||
|
||||
//std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); ++it)
|
||||
//{
|
||||
// if (storageIn->isDirectory(*it))
|
||||
// {
|
||||
@ -603,7 +603,7 @@ namespace DocFileFormat
|
||||
std::list<std::wstring> entries, entries_files, entries_dir;
|
||||
entries = storageIn->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
@ -372,7 +372,7 @@ public:
|
||||
class rPr
|
||||
{
|
||||
private:
|
||||
std::map<std::wstring, int>& m_mapFonts;
|
||||
boost::unordered_map<std::wstring, int>& m_mapFonts;
|
||||
public:
|
||||
bool Bold;
|
||||
bool Italic;
|
||||
@ -445,7 +445,7 @@ public:
|
||||
|
||||
bool bDoNotWriteNullProp;
|
||||
public:
|
||||
rPr(std::map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
rPr(boost::unordered_map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
{
|
||||
Reset();
|
||||
|
||||
@ -1787,8 +1787,8 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
|
||||
};
|
||||
class CComments
|
||||
{
|
||||
std::map<int, CComment*> m_mapComments;
|
||||
std::map<std::wstring, CComment*> m_mapAuthors;
|
||||
boost::unordered_map<int, CComment*> m_mapComments;
|
||||
boost::unordered_map<std::wstring, CComment*> m_mapAuthors;
|
||||
public:
|
||||
IdCounter m_oFormatIdCounter;
|
||||
IdCounter m_oParaIdCounter;
|
||||
@ -1798,7 +1798,7 @@ public:
|
||||
}
|
||||
~CComments()
|
||||
{
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
@ -1822,7 +1822,7 @@ public:
|
||||
CComment* get(int nInd)
|
||||
{
|
||||
CComment* pRes = NULL;
|
||||
std::map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
|
||||
boost::unordered_map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
|
||||
if(m_mapComments.end() != pair)
|
||||
pRes = pair->second;
|
||||
return pRes;
|
||||
@ -1834,7 +1834,7 @@ public:
|
||||
std::wstring writeContent()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writeTemplates(CComment::writeContent));
|
||||
}
|
||||
@ -1843,7 +1843,7 @@ public:
|
||||
std::wstring writeContentExt()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writeTemplates(CComment::writeContentExt));
|
||||
}
|
||||
@ -1852,7 +1852,7 @@ public:
|
||||
std::wstring writePeople()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writePeople(it->second));
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../DesktopEditor/fontengine/FontManager.h"
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
@ -48,7 +49,7 @@ namespace Writers
|
||||
CApplicationFonts m_oApplicationFonts;
|
||||
CFontManager* m_pFontManager;
|
||||
public:
|
||||
std::map<std::wstring, int> m_mapFonts;
|
||||
boost::unordered_map<std::wstring, int> m_mapFonts;
|
||||
|
||||
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir):m_sDir(sDir)
|
||||
{
|
||||
@ -81,7 +82,7 @@ namespace Writers
|
||||
bool bCalibri = false;
|
||||
bool bTimes = false;
|
||||
bool bCambria = false;
|
||||
for (std::map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
{
|
||||
const std::wstring& sFontName = it->first;
|
||||
if(_T("Calibri") == sFontName)
|
||||
|
||||
@ -3024,18 +3024,18 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.EndRecord();
|
||||
|
||||
}
|
||||
void Write(std::list<OOX::WritingElement*> & aElems)
|
||||
void Write(std::vector<OOX::WritingElement*> & aElems)
|
||||
{
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteDocumentContent(aElems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteDocumentContent(const std::list<OOX::WritingElement*> & aElems)
|
||||
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for ( std::list<OOX::WritingElement*>::const_iterator it = aElems.begin(); it != aElems.end(); it++)
|
||||
for ( size_t i = 0; i < aElems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = aElems[i];
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
@ -3184,12 +3184,13 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
|
||||
}
|
||||
void WriteParagraphContent(const std::list<OOX::WritingElement*> & content, bool bHyperlink = false)
|
||||
void WriteParagraphContent(const std::vector<OOX::WritingElement*> & content, bool bHyperlink = false)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = content.begin(); it != content.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for ( size_t i = 0; i < content.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = content[i];
|
||||
|
||||
switch (item->getType())
|
||||
{
|
||||
case OOX::et_w_fldSimple:
|
||||
@ -3836,8 +3837,8 @@ namespace BinDocxRW
|
||||
bool bWasText = false;
|
||||
int nRecordType = 0;
|
||||
|
||||
std::list<OOX::WritingElement*>::iterator nIndexStart = pRun->m_arrItems.begin();
|
||||
std::list<OOX::WritingElement*>::iterator nIndexEnd = pRun->m_arrItems.end();
|
||||
std::vector<OOX::WritingElement*>::iterator nIndexStart = pRun->m_arrItems.begin();
|
||||
std::vector<OOX::WritingElement*>::iterator nIndexEnd = pRun->m_arrItems.end();
|
||||
|
||||
if (bMathRun)
|
||||
nRecordType = c_oSer_OMathContentType::Run;
|
||||
@ -3845,9 +3846,9 @@ namespace BinDocxRW
|
||||
nRecordType = c_oSerParType::Run;
|
||||
|
||||
//Разбиваем массив по знаку et_w_sym
|
||||
for (std::list<OOX::WritingElement*>::iterator it = pRun->m_arrItems.begin(); it != nIndexEnd; it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = nIndexStart; it != nIndexEnd; ++it)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = (*it);
|
||||
|
||||
if(OOX::et_w_sym == item->getType())
|
||||
{
|
||||
@ -3859,7 +3860,7 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
nCurPos = m_oBcw.WriteItemStart(nRecordType);
|
||||
std::list<OOX::WritingElement*>::iterator it_next = it; it_next++;
|
||||
std::vector<OOX::WritingElement*>::iterator it_next = it; it_next++;
|
||||
WritePreparedRun( pRun, bHyperlink, it, it_next);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
nIndexStart = it; nIndexStart++;
|
||||
@ -3874,11 +3875,11 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteMathArgNodes(const std::list<OOX::WritingElement*>& m_arrItems)
|
||||
void WriteMathArgNodes(const std::vector<OOX::WritingElement*>& arrItems)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for (size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
@ -4046,7 +4047,7 @@ namespace BinDocxRW
|
||||
|
||||
LONG lCol = 0;
|
||||
//TODO убрать, тк при отсутствии m:mcs, к-во столбцов должно разруливаться динамически в скрипте
|
||||
for (std::list<OOX::WritingElement*>::iterator jt = pMatrix->m_arrItems.begin(); jt != pMatrix->m_arrItems.end(); jt++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator jt = pMatrix->m_arrItems.begin(); jt != pMatrix->m_arrItems.end(); jt++)
|
||||
{
|
||||
OOX::WritingElement* item = *jt;
|
||||
if (item->getType() == OOX::et_m_mr)
|
||||
@ -4496,11 +4497,11 @@ namespace BinDocxRW
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteMathDelimiter(const std::list<OOX::WritingElement*> & arrItems, LONG &lColumn)
|
||||
void WriteMathDelimiter(const std::vector<OOX::WritingElement*> & arrItems, LONG &lColumn)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
@ -4616,11 +4617,12 @@ namespace BinDocxRW
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteMathEqArr(const std::list<OOX::WritingElement*> & arrItems, LONG& lRow)
|
||||
void WriteMathEqArr(const std::vector<OOX::WritingElement*> & arrItems, LONG& lRow)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
switch(eType)
|
||||
@ -4844,12 +4846,13 @@ namespace BinDocxRW
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteMathMatrix(const std::list<OOX::WritingElement*> & arrItems, LONG &lRow, LONG &lCol)
|
||||
void WriteMathMatrix(const std::vector<OOX::WritingElement*> & arrItems, LONG &lRow, LONG &lCol)
|
||||
{
|
||||
bool bColumn = false;
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
switch(eType)
|
||||
@ -4946,9 +4949,9 @@ namespace BinDocxRW
|
||||
{
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathBottomNodesType::Mcs);
|
||||
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = pMcs.m_arrItems.begin(); it != pMcs.m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < pMcs.m_arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = pMcs.m_arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos1 = 0;
|
||||
@ -5007,11 +5010,12 @@ namespace BinDocxRW
|
||||
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteMathMr(const std::list<OOX::WritingElement*> & arrItems)
|
||||
void WriteMathMr(const std::vector<OOX::WritingElement*> & arrItems)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
if (eType == OOX::et_m_e)
|
||||
@ -5089,11 +5093,12 @@ namespace BinDocxRW
|
||||
WriteMathArgNodes(pOMath.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteMathOMathPara(const std::list<OOX::WritingElement*> & arrItems)
|
||||
void WriteMathOMathPara(const std::vector<OOX::WritingElement*> & arrItems)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
int nCurPos = 0;
|
||||
if (eType == OOX::et_m_oMath)
|
||||
@ -5505,7 +5510,7 @@ namespace BinDocxRW
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WritePreparedRun(OOX::Logic::CRun *pRun, bool bHyperlink, std::list<OOX::WritingElement*>::iterator &start, std::list<OOX::WritingElement*>::iterator &end)
|
||||
void WritePreparedRun(OOX::Logic::CRun *pRun, bool bHyperlink, std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end)
|
||||
{
|
||||
if (!pRun) return;
|
||||
|
||||
@ -5543,12 +5548,12 @@ namespace BinDocxRW
|
||||
|
||||
//Content пишется начиная от индекса nIndexStart и заканчивая предшествующим элементом для nIndexStop
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::Content);
|
||||
WriteRunContent(pRun->m_arrItems, start, end, bHyperlink);
|
||||
WriteRunContent( start, end, bHyperlink);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteRunContent(std::list<OOX::WritingElement*>& m_arrItems, std::list<OOX::WritingElement*>::iterator &start, std::list<OOX::WritingElement*>::iterator &end, bool bHyperlink = false)
|
||||
void WriteRunContent(std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end, bool bHyperlink = false)
|
||||
{
|
||||
for ( std::list<OOX::WritingElement*>::iterator it = start; it != end; it++ )
|
||||
for ( std::vector<OOX::WritingElement*>::iterator it = start; it != end; ++it )
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
switch (item->getType())
|
||||
@ -6533,13 +6538,15 @@ namespace BinDocxRW
|
||||
|
||||
RELEASEOBJECT(pTblPr);
|
||||
}
|
||||
bool ValidateRow(const std::list<OOX::WritingElement *> & arrItems)
|
||||
bool ValidateRow(const std::vector<OOX::WritingElement *> & arrItems)
|
||||
{
|
||||
//Проверяем чтобы не все ячейки в ряду были вертикально замержены
|
||||
bool bRes = true;
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
if(OOX::et_w_tc == item->getType())
|
||||
{
|
||||
OOX::Logic::CTc* tc = static_cast<OOX::Logic::CTc*>(item);
|
||||
@ -6581,11 +6588,12 @@ namespace BinDocxRW
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void GetTableSize(std::list<OOX::WritingElement *> & rows, int& nRows, int& nCols, OOX::Logic::CTableProperty** ppTblPr)
|
||||
void GetTableSize(std::vector<OOX::WritingElement *> & rows, int& nRows, int& nCols, OOX::Logic::CTableProperty** ppTblPr)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::iterator it = rows.begin(); it != rows.end(); it++)
|
||||
for(size_t i = 0; i < rows.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = rows[i];
|
||||
|
||||
if(OOX::et_w_tblPr == item->getType())
|
||||
{
|
||||
*ppTblPr = new OOX::Logic::CTableProperty();
|
||||
@ -6605,8 +6613,7 @@ namespace BinDocxRW
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
rows.erase(it);
|
||||
rows.erase(rows.begin() + i);
|
||||
}
|
||||
}
|
||||
else if(OOX::et_w_sdt == item->getType())
|
||||
@ -6632,18 +6639,20 @@ namespace BinDocxRW
|
||||
}
|
||||
}
|
||||
}
|
||||
int GetColsCount(const std::list<OOX::WritingElement *>& arrItems)
|
||||
int GetColsCount(const std::vector<OOX::WritingElement *>& arrItems)
|
||||
{
|
||||
int nColCount = 0;
|
||||
for(std::list<OOX::WritingElement *>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
|
||||
for(size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = arrItems[i];
|
||||
|
||||
if(OOX::et_w_tc == item->getType())
|
||||
{
|
||||
nColCount++;
|
||||
OOX::Logic::CTc* tc = static_cast<OOX::Logic::CTc*>(item);
|
||||
|
||||
for(std::list<OOX::WritingElement *>::iterator jt = tc->m_arrItems.begin(); jt != tc->m_arrItems.end(); jt++)
|
||||
for(std::vector<OOX::WritingElement *>::iterator jt = tc->m_arrItems.begin(); jt != tc->m_arrItems.end(); jt++)
|
||||
{
|
||||
OOX::WritingElement* item2 = *jt;
|
||||
|
||||
@ -6723,14 +6732,15 @@ namespace BinDocxRW
|
||||
}
|
||||
}
|
||||
|
||||
void WriteTableContent(std::list<OOX::WritingElement *>& content, OOX::Logic::CTableProperty* pTblPr, int nRows, int nCols)
|
||||
void WriteTableContent(std::vector<OOX::WritingElement *>& content, OOX::Logic::CTableProperty* pTblPr, int nRows, int nCols)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
int nCurRowIndex = 0;
|
||||
|
||||
for(std::list<OOX::WritingElement*>::iterator it = content.begin(); it != content.end(); it++)
|
||||
for(size_t i = 0; i < content.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = content[i];
|
||||
|
||||
if(OOX::et_w_tr == item->getType())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Row);
|
||||
@ -6793,14 +6803,14 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
|
||||
void WriteRowContent(const std::list<OOX::WritingElement *> & content, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
|
||||
void WriteRowContent(const std::vector<OOX::WritingElement *> & content, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
int nCurColIndex = 0;
|
||||
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = content.begin(); it != content.end(); it++)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
for(size_t i = 0; i < content.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = content[i];
|
||||
|
||||
if(OOX::et_w_tc == item->getType())
|
||||
{
|
||||
@ -7200,7 +7210,7 @@ namespace BinDocxRW
|
||||
if(mapAuthorToUserId.end() != pPair)
|
||||
pNewCommentWriteTemp->sUserId = pPair->second;
|
||||
}
|
||||
for(std::list<OOX::WritingElement*>::iterator jt = pComment->m_arrItems.begin(); jt != pComment->m_arrItems.end(); jt++)
|
||||
for(std::vector<OOX::WritingElement*>::iterator jt = pComment->m_arrItems.begin(); jt != pComment->m_arrItems.end(); jt++)
|
||||
{
|
||||
OOX::WritingElement* pWe = *jt;
|
||||
|
||||
@ -7384,9 +7394,10 @@ namespace BinDocxRW
|
||||
};
|
||||
void WriteMathPr(const OOX::Logic::CMathPr &pMathPr)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::const_iterator it = pMathPr.m_arrItems.begin(); it != pMathPr.m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < pMathPr.m_arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
OOX::WritingElement* item = pMathPr.m_arrItems[i];
|
||||
|
||||
OOX::EElementType eType = item->getType();
|
||||
switch(eType)
|
||||
{
|
||||
@ -7960,9 +7971,11 @@ namespace BinDocxRW
|
||||
if(NULL != pParagraph)
|
||||
{
|
||||
OOX::Logic::CParagraphProperty* pPr = NULL;
|
||||
for(std::list<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin(); it != pParagraph->m_arrItems.end(); it++)
|
||||
|
||||
for(size_t i = 0; i < pParagraph->m_arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* we = *it;
|
||||
OOX::WritingElement* we = pParagraph->m_arrItems[i];
|
||||
|
||||
if(OOX::et_w_pPr == we->getType())
|
||||
{
|
||||
pPr = static_cast<OOX::Logic::CParagraphProperty*>(we);
|
||||
|
||||
@ -127,10 +127,11 @@ namespace BinXlsxRW{
|
||||
}
|
||||
ChartWriter::~ChartWriter()
|
||||
{
|
||||
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); it++)
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
{
|
||||
delete itRow->second;
|
||||
}
|
||||
@ -143,10 +144,12 @@ namespace BinXlsxRW{
|
||||
//Sheet
|
||||
OOX::Spreadsheet::CWorkbook* pWorkbook = oXlsx.CreateWorkbook();
|
||||
pWorkbook->m_oSheets.Init();
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets = oXlsx.GetWorksheets();
|
||||
|
||||
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++)
|
||||
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
const std::wstring& sSheetName = it->first;
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(mapWorksheets, sSheetName);
|
||||
@ -196,7 +199,8 @@ namespace BinXlsxRW{
|
||||
pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
|
||||
}
|
||||
pStyles->m_oNumFmts.Init();
|
||||
for (std::map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); it++)
|
||||
|
||||
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::CNumFmt* pNumFmt = new OOX::Spreadsheet::CNumFmt();
|
||||
pNumFmt->m_oFormatCode.Init();
|
||||
@ -458,18 +462,22 @@ namespace BinXlsxRW{
|
||||
//проверяем можем ли создать таблицу
|
||||
if(m_mapSheets.size() > 0 && m_nRow1 > 0 && m_nRow2 > 0 && m_nCol1 > 0 && m_nCol2 > 0 && m_nRow1 < m_nRow2)
|
||||
{
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
if(itRows != rows->end())
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
|
||||
if(itRows != rows->end())
|
||||
{
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
std::vector<int> aIndexesCell;
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
|
||||
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
|
||||
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
|
||||
{
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
{
|
||||
@ -482,11 +490,12 @@ namespace BinXlsxRW{
|
||||
}
|
||||
}
|
||||
}
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
{
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = NULL;
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
|
||||
if (it == mapWorksheets.end())
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
|
||||
|
||||
if (it == mapWorksheets.end())
|
||||
{
|
||||
pWorksheet = new OOX::Spreadsheet::CWorksheet();
|
||||
pWorksheet->m_oSheetFormatPr.Init();
|
||||
@ -515,32 +524,40 @@ namespace BinXlsxRW{
|
||||
}
|
||||
return pWorksheet;
|
||||
}
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
{
|
||||
pWorksheet->m_oSheetData.Init();
|
||||
std::vector<int> aIndexesRow;
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
{
|
||||
aIndexesRow.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesRow.begin(), aIndexesRow.end());
|
||||
for(size_t i = 0; i < aIndexesRow.size(); ++i)
|
||||
|
||||
std::sort(aIndexesRow.begin(), aIndexesRow.end());
|
||||
|
||||
for(size_t i = 0; i < aIndexesRow.size(); ++i)
|
||||
{
|
||||
int nIndexRow = aIndexesRow[i];
|
||||
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
|
||||
|
||||
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
|
||||
pRow->m_oR.Init();
|
||||
pRow->m_oR->SetValue(nIndexRow);
|
||||
const std::map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
|
||||
const boost::unordered_map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
std::vector<int> aIndexesCell;
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
{
|
||||
int nIndexCell = aIndexesCell[j];
|
||||
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
|
||||
|
||||
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
|
||||
//SharedStrings
|
||||
if(pCell->m_oValue.IsInit())
|
||||
{
|
||||
@ -588,22 +605,24 @@ namespace BinXlsxRW{
|
||||
}
|
||||
void ChartWriter::parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format = NULL)
|
||||
{
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
if(itSheets == m_mapSheets.end())
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
|
||||
if(itSheets == m_mapSheets.end())
|
||||
{
|
||||
rows = new std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
rows = new boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
m_mapSheets.insert(std::make_pair(sheet, rows));
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = itSheets->second;
|
||||
}
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
if(itRows == rows->end())
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
|
||||
if(itRows == rows->end())
|
||||
{
|
||||
cells = new std::map<int, OOX::Spreadsheet::CCell*>();
|
||||
cells = new boost::unordered_map<int, OOX::Spreadsheet::CCell*>();
|
||||
rows->insert(std::make_pair(nRow, cells));
|
||||
}
|
||||
else
|
||||
@ -622,10 +641,12 @@ namespace BinXlsxRW{
|
||||
//пока добавляем как есть, shared string после записи таблицы
|
||||
pNewCell->m_oValue.Init();
|
||||
pNewCell->m_oValue->m_sText = val;
|
||||
if(NULL != format)
|
||||
|
||||
if(NULL != format)
|
||||
{
|
||||
int nXfsIndex = m_aXfs.size();
|
||||
std::map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
|
||||
boost::unordered_map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
if(itFormat == m_mapFormats.end())
|
||||
{
|
||||
m_mapFormats[*format] = nXfsIndex;
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
#define CHART_WRITER
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -59,22 +59,25 @@ namespace BinXlsxRW {
|
||||
class ChartWriter
|
||||
{
|
||||
public:
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
std::map<std::wstring, int> m_mapFormats;
|
||||
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
|
||||
std::vector<std::wstring> m_aTableNames;
|
||||
int m_nRow1;
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
boost::unordered_map<std::wstring, int> m_mapFormats;
|
||||
|
||||
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
|
||||
std::vector<std::wstring> m_aTableNames;
|
||||
|
||||
int m_nRow1;
|
||||
int m_nCol1;
|
||||
int m_nRow2;
|
||||
int m_nCol2;
|
||||
public:
|
||||
ChartWriter();
|
||||
|
||||
ChartWriter();
|
||||
~ChartWriter();
|
||||
void toXlsx(OOX::Spreadsheet::CXlsx& oXlsx);
|
||||
void parseChart(const OOX::Spreadsheet::CT_Chart* pChart);
|
||||
private:
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(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);
|
||||
|
||||
private:
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
|
||||
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
|
||||
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);
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
ShowProgress="0"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
|
||||
@ -407,11 +407,11 @@ namespace formulasconvert {
|
||||
std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); it++)
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
@ -335,8 +335,8 @@ namespace internal
|
||||
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
|
||||
{
|
||||
return (
|
||||
((it != end) && (internal::mask8(*it++)) == bom[0]) &&
|
||||
((it != end) && (internal::mask8(*it++)) == bom[1]) &&
|
||||
((it != end) && (internal::mask8(*++it)) == bom[0]) &&
|
||||
((it != end) && (internal::mask8(*++it)) == bom[1]) &&
|
||||
((it != end) && (internal::mask8(*it)) == bom[2])
|
||||
);
|
||||
}
|
||||
@ -346,8 +346,8 @@ namespace internal
|
||||
inline bool is_bom (octet_iterator it)
|
||||
{
|
||||
return (
|
||||
(internal::mask8(*it++)) == bom[0] &&
|
||||
(internal::mask8(*it++)) == bom[1] &&
|
||||
(internal::mask8(*++it)) == bom[0] &&
|
||||
(internal::mask8(*++it)) == bom[1] &&
|
||||
(internal::mask8(*it)) == bom[2]
|
||||
);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace utf8
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
it++;
|
||||
++it;
|
||||
cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@ -1320,7 +1320,7 @@ void docx_conversion_context::start_changes()
|
||||
text_tracked_context_.dumpTcPr_.clear();
|
||||
text_tracked_context_.dumpTblPr_.clear();
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
@ -1413,7 +1413,7 @@ void docx_conversion_context::end_changes()
|
||||
{
|
||||
if (process_comment_) return;
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
oox_serialize_default_text(CP_XML_STREAM(), textPr_);
|
||||
|
||||
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); it++)
|
||||
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLbl")
|
||||
{
|
||||
|
||||
@ -194,7 +194,7 @@ private:
|
||||
std::map<size_t, size_t> count;
|
||||
|
||||
size_t max_size = 0;
|
||||
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator pFind = count.find(it->second);
|
||||
if (pFind != count.end())
|
||||
@ -215,7 +215,7 @@ private:
|
||||
|
||||
size_t found = 0;
|
||||
|
||||
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); ++it)
|
||||
{
|
||||
if (it->second == max_size)
|
||||
{
|
||||
@ -229,16 +229,16 @@ private:
|
||||
{
|
||||
if (it->second != found)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator del = it; it++;
|
||||
std::map<size_t, size_t>::iterator del = it; ++it;
|
||||
map.erase(del);
|
||||
}
|
||||
else it++;
|
||||
else ++it;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void clear_header_map2(std::map<size_t, size_t> & map, std::map<size_t, size_t> & map_by)
|
||||
{//отсев тех кто во втором
|
||||
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); ++it)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator pFind = map.find(it->second);
|
||||
if (pFind != map.end())
|
||||
|
||||
@ -253,7 +253,7 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
|
||||
}
|
||||
@ -271,7 +271,7 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->filter)
|
||||
{
|
||||
|
||||
@ -32,17 +32,14 @@
|
||||
// ASCOfficeOdfFileWTest.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "../../Common/OfficeFileFormatChecker.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
|
||||
|
||||
@ -52,81 +49,31 @@
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
std::wstring DetectTypeDocument(const std::wstring & pathOOX)
|
||||
HRESULT convert_single(std::wstring srcFileName)
|
||||
{
|
||||
std::wstring sRes;
|
||||
COfficeFileFormatChecker fileChecker(srcFileName);
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
std::wstring dstPath = srcFileName;// + ....
|
||||
|
||||
std::wstring fileContentType = pathOOX + FILE_SEPARATOR_STR + L"[Content_Types].xml";
|
||||
|
||||
if (file.OpenFile(fileContentType) ==false) return sRes;
|
||||
|
||||
DWORD nBufferSize = min (file.GetFileSize(), 10000);
|
||||
BYTE *pBuffer = new BYTE[nBufferSize];
|
||||
|
||||
file.ReadFile(pBuffer, nBufferSize, nBufferSize);
|
||||
file.CloseFile();
|
||||
|
||||
if (pBuffer != NULL)
|
||||
std::wstring type;
|
||||
switch(fileChecker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: dstPath += L"-my.odt"; type = L"document"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: dstPath += L"-my.ods"; type = L"spreadsheet"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: dstPath += L"-my.odp"; type = L"presentation"; break;
|
||||
|
||||
const char *docxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
|
||||
const char *dotxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
|
||||
const char *docmFormatLine = "application/vnd.ms-word.document.macroEnabled.main+xml";
|
||||
const char *dotmFormatLine = "application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
|
||||
|
||||
const char *xlsxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
|
||||
const char *xltxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml";
|
||||
const char *xlsmFormatLine = "application/vnd.ms-excel.sheet.macroEnabled.main+xml";
|
||||
const char *xltmFormatLine = "application/vnd.ms-excel.template.macroEnabled.main+xml";
|
||||
|
||||
const char *pptxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
||||
const char *ppsxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
|
||||
const char *potxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml";
|
||||
const char *pptmFormatLine = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml";
|
||||
const char *ppsmFormatLine = "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml";
|
||||
const char *potmFormatLine = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml";
|
||||
|
||||
std::string strContentTypes((char*)pBuffer, nBufferSize);
|
||||
|
||||
int res = 0;
|
||||
if ( (res = strContentTypes.find(docxFormatLine))>0 || (res = strContentTypes.find(dotxFormatLine))>0 ||
|
||||
(res = strContentTypes.find(docmFormatLine))>0 || (res = strContentTypes.find(dotmFormatLine))>0)
|
||||
{
|
||||
sRes = L"text";
|
||||
}
|
||||
|
||||
else if ((res = strContentTypes.find(xlsxFormatLine))>0 || (res = strContentTypes.find(xltxFormatLine))>0 ||
|
||||
(res = strContentTypes.find(xlsmFormatLine))>0 || (res = strContentTypes.find(xltmFormatLine))>0)
|
||||
{
|
||||
sRes = L"spreadsheet";
|
||||
}
|
||||
|
||||
else if ((res = strContentTypes.find(pptxFormatLine) > 0) || /*(res = strContentTypes.find(ppsxFormatLine))>0 ||*/
|
||||
(res = strContentTypes.find(potxFormatLine))>0 || (res = strContentTypes.find(pptmFormatLine))>0 ||
|
||||
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
|
||||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
|
||||
{
|
||||
sRes = L"presentation";
|
||||
}
|
||||
|
||||
delete []pBuffer;
|
||||
pBuffer = NULL;
|
||||
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 3) return 0;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argv[2];
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
@ -137,8 +84,6 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
|
||||
return S_FALSE;
|
||||
|
||||
std::wstring type = DetectTypeDocument(srcTempPath);
|
||||
|
||||
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
|
||||
|
||||
converter.convert();
|
||||
@ -155,3 +100,32 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
HRESULT convert_directory(std::wstring pathName)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
|
||||
|
||||
for (size_t i = 0; i < arFiles.size(); i++)
|
||||
{
|
||||
convert_single(arFiles[i]);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
HRESULT hr = -1;
|
||||
if (NSFile::CFileBinary::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_single(argv[1]);
|
||||
}
|
||||
else if (NSDirectory::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_directory(argv[1]);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@ -67,7 +67,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="
Rpcrt4.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
|
||||
@ -199,7 +199,7 @@ std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_fami
|
||||
}
|
||||
//office_element_ptr odf_style_context::find_odf_style(int oox_id_style, style_family::type family, bool root, _CP_OPT(bool) automatic)
|
||||
//{
|
||||
// //for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
|
||||
// //for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); ++it)
|
||||
// for (size_t i=0;i<style_state_list_.size(); i++)
|
||||
// {
|
||||
// if (style_state_list_[i]->odf_style_)
|
||||
|
||||
@ -566,7 +566,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
|
||||
|
||||
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); ++it)
|
||||
{
|
||||
docx_converter->convert(*it);
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
|
||||
}
|
||||
//m_oPreferRelative//типо можно менять размер
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = vml_shape_type->m_arrItems.begin(); it != vml_shape_type->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_shape_type->m_arrItems.begin(); it != vml_shape_type->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -90,7 +90,7 @@ void OoxConverter::convert(OOX::Vml::CFormulas *vml_formulas)
|
||||
{
|
||||
if (vml_formulas == NULL) return;
|
||||
|
||||
for (std::list<OOX::Vml::CF*>::iterator it = vml_formulas->m_arrItems.begin(); it != vml_formulas->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::Vml::CF*>::iterator it = vml_formulas->m_arrItems.begin(); it != vml_formulas->m_arrItems.end(); ++it)
|
||||
{
|
||||
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(*it);
|
||||
if (cf == NULL) continue;
|
||||
@ -717,7 +717,7 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
|
||||
{
|
||||
odf_context()->start_text_context();
|
||||
{
|
||||
for (std::list<OOX::WritingElement*>::iterator it = vml_textbox->m_oTxtbxContent->m_arrItems.begin(); it != vml_textbox->m_oTxtbxContent->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_textbox->m_oTxtbxContent->m_arrItems.begin(); it != vml_textbox->m_oTxtbxContent->m_arrItems.end(); ++it)
|
||||
{
|
||||
docx_converter->convert(*it);
|
||||
}
|
||||
@ -890,7 +890,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
for (std::list<OOX::WritingElement*>::iterator it = vml_common->m_arrItems.begin(); it != vml_common->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_common->m_arrItems.begin(); it != vml_common->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -920,7 +920,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
|
||||
odf_context()->drawing_context()->set_group_shift(vml_group->m_oCoordOrigin->GetX(), vml_group->m_oCoordOrigin->GetY());
|
||||
}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = vml_group->m_arrItems.begin(); it != vml_group->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_group->m_arrItems.begin(); it != vml_group->m_arrItems.end(); ++it)
|
||||
{
|
||||
if (*it == NULL) continue;
|
||||
|
||||
|
||||
@ -181,10 +181,10 @@ void DocxConverter::convert_document()
|
||||
|
||||
std::vector<_section> sections;
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
std::list<OOX::WritingElement*>::const_iterator last_section_start = document->m_arrItems.begin();
|
||||
std::vector<OOX::WritingElement*>::const_iterator last_section_start = document->m_arrItems.begin();
|
||||
|
||||
//считаем количесво секций и запоминаем их свойства ..
|
||||
for (std::list<OOX::WritingElement*>::const_iterator it = document->m_arrItems.begin(); it != document->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::const_iterator it = document->m_arrItems.begin(); it != document->m_arrItems.end(); ++it)
|
||||
{
|
||||
if ((*it) == NULL) continue;
|
||||
|
||||
@ -224,7 +224,7 @@ void DocxConverter::convert_document()
|
||||
{
|
||||
current_section_properties = §ions[sect];
|
||||
|
||||
for (std::list<OOX::WritingElement*>::const_iterator it = sections[sect].start_para; it != sections[sect].end_para; it++)
|
||||
for (std::vector<OOX::WritingElement*>::const_iterator it = sections[sect].start_para; it != sections[sect].end_para; ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -374,7 +374,7 @@ void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
|
||||
{
|
||||
if (oox_sdt == NULL) return;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_sdt->m_arrItems.begin(); it != oox_sdt->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_sdt->m_arrItems.begin(); it != oox_sdt->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -532,7 +532,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
{//rapcomnat12.docx - стр 185
|
||||
bool empty_para = true;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
{
|
||||
@ -556,7 +556,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
|
||||
{
|
||||
//те элементы которые тока для Paragraph - здесь - остальные в общей куче
|
||||
switch((*it)->getType())
|
||||
@ -618,7 +618,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
|
||||
|
||||
odt_context->start_run(styled);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_run->m_arrItems.begin(); it != oox_run->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_run->m_arrItems.begin(); it != oox_run->m_arrItems.end(); ++it)
|
||||
{
|
||||
//те элементы которые тока для Run - здесь - остальные в общей куче
|
||||
switch((*it)->getType())
|
||||
@ -788,7 +788,7 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
|
||||
if (oox_fld->m_sInstr.IsInit())
|
||||
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_fld->m_arrItems.begin(); it != oox_fld->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_fld->m_arrItems.begin(); it != oox_fld->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -825,7 +825,7 @@ void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
|
||||
|
||||
bool start_change = odt_context->start_change(id, 1, author, userId, date);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_ins->m_arrItems.begin(); it != oox_ins->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_ins->m_arrItems.begin(); it != oox_ins->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ void DocxConverter::convert(OOX::Logic::CDel *oox_del)
|
||||
|
||||
bool res_change = odt_context->start_change(id, 2, author, userId, date);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_del->m_arrItems.begin(); it != oox_del->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_del->m_arrItems.begin(); it != oox_del->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag)
|
||||
{
|
||||
if (oox_tag == NULL) return;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_tag->m_arrItems.begin(); it != oox_tag->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_tag->m_arrItems.begin(); it != oox_tag->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -2914,7 +2914,7 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
|
||||
|
||||
odt_context->start_hyperlink(ref);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -2923,7 +2923,7 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
|
||||
else
|
||||
{//ссылка внутри дока
|
||||
//anchor todooo
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -3478,7 +3478,7 @@ void DocxConverter::convert_comment(int oox_comm_id)
|
||||
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
|
||||
if (oox_comment->m_oInitials.IsInit()) {}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -3505,7 +3505,7 @@ void DocxConverter::convert_footnote(int oox_ref_id)
|
||||
{
|
||||
odt_context->start_note_content();
|
||||
{
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -3533,7 +3533,7 @@ void DocxConverter::convert_endnote(int oox_ref_id)
|
||||
{
|
||||
odt_context->start_note_content();
|
||||
{
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -3550,7 +3550,7 @@ void DocxConverter::convert_hdr_ftr (std::wstring sId)
|
||||
|
||||
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_hdr_ftr->m_arrItems.begin(); it != oox_hdr_ftr->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hdr_ftr->m_arrItems.begin(); it != oox_hdr_ftr->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
@ -3729,7 +3729,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
convert(oox_table->m_oTblGrid.GetPointer());
|
||||
|
||||
//------ строки
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_table->m_arrItems.begin(); it != oox_table->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table->m_arrItems.begin(); it != oox_table->m_arrItems.end(); ++it)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
{
|
||||
@ -3845,7 +3845,7 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
|
||||
|
||||
convert(oox_table_row->m_pTableRowProperties);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_table_row->m_arrItems.begin(); it != oox_table_row->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_row->m_arrItems.begin(); it != oox_table_row->m_arrItems.end(); ++it)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
{
|
||||
@ -3905,7 +3905,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal->GetValue());
|
||||
}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = oox_table_cell->m_arrItems.begin(); it != oox_table_cell->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_cell->m_arrItems.begin(); it != oox_table_cell->m_arrItems.end(); ++it)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
{
|
||||
|
||||
@ -158,9 +158,9 @@ namespace Oox2Odf
|
||||
private:
|
||||
struct _section
|
||||
{
|
||||
OOX::Logic::CSectionProperty *props;
|
||||
std::list<OOX::WritingElement*>::const_iterator start_para;
|
||||
std::list<OOX::WritingElement*>::const_iterator end_para;
|
||||
OOX::Logic::CSectionProperty *props;
|
||||
std::vector<OOX::WritingElement*>::const_iterator start_para;
|
||||
std::vector<OOX::WritingElement*>::const_iterator end_para;
|
||||
|
||||
bool root;
|
||||
} *current_section_properties;
|
||||
|
||||
@ -162,27 +162,25 @@ void XlsxConverter::convert_sheets()
|
||||
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->GetWorkbook();
|
||||
if (!Workbook) return;
|
||||
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = xlsx_document->GetWorksheets();
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = xlsx_document->GetWorksheets();
|
||||
|
||||
if(Workbook->m_oBookViews.IsInit())
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CWorkbookView*>::iterator it = Workbook->m_oBookViews->m_arrItems.begin();
|
||||
it != Workbook->m_oBookViews->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(Workbook->m_oBookViews->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
if(Workbook->m_oSheets.IsInit())
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CSheet*>::iterator it = Workbook->m_oSheets->m_arrItems.begin();
|
||||
it != Workbook->m_oSheets->m_arrItems.end(); it++)
|
||||
for(size_t i = 0, length = Workbook->m_oSheets->m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
OOX::Spreadsheet::CSheet* pSheet = *it;
|
||||
OOX::Spreadsheet::CSheet* pSheet = Workbook->m_oSheets->m_arrItems[i];
|
||||
|
||||
if(pSheet->m_oRid.IsInit())
|
||||
{
|
||||
std::wstring sSheetRId = pSheet->m_oRid.get2().ToString();
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pItWorksheet = arrWorksheets.find(sSheetRId);
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pItWorksheet = arrWorksheets.find(sSheetRId);
|
||||
|
||||
if (pItWorksheet->second)
|
||||
{
|
||||
@ -200,10 +198,9 @@ void XlsxConverter::convert_sheets()
|
||||
}
|
||||
if (Workbook->m_oDefinedNames.IsInit())
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CDefinedName*>::iterator it = Workbook->m_oDefinedNames->m_arrItems.begin();
|
||||
it != Workbook->m_oDefinedNames->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; i < Workbook->m_oDefinedNames->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(Workbook->m_oDefinedNames->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,16 +244,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
convert(oox_sheet->m_oSheetPr.GetPointer());
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Предобработка
|
||||
if (oox_sheet->m_oHyperlinks.IsInit())
|
||||
//гиперлинки
|
||||
for (size_t hyp = 0; oox_sheet->m_oHyperlinks.IsInit() && hyp < oox_sheet->m_oHyperlinks->m_arrItems.size(); hyp++)
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CHyperlink*>::iterator it = oox_sheet->m_oHyperlinks->m_arrItems.begin();
|
||||
it != oox_sheet->m_oHyperlinks->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it, oox_sheet);
|
||||
}
|
||||
convert(oox_sheet->m_oHyperlinks->m_arrItems[hyp],oox_sheet);
|
||||
}
|
||||
//комментарии
|
||||
std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::iterator pos = oox_sheet->m_mapComments.begin();
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CCommentItem*>::iterator pos = oox_sheet->m_mapComments.begin();
|
||||
while ( oox_sheet->m_mapComments.end() != pos )
|
||||
{
|
||||
convert(pos->second);
|
||||
@ -265,46 +259,36 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
//todooo для оптимизации - перенести мержи в начало
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//колонки
|
||||
if (oox_sheet->m_oCols.IsInit())
|
||||
{
|
||||
ods_context->start_columns();
|
||||
for (std::list<OOX::Spreadsheet::CCol*>::iterator it = oox_sheet->m_oCols->m_arrItems.begin();
|
||||
it != oox_sheet->m_oCols->m_arrItems.end(); it++)
|
||||
for (size_t col = 0 ; oox_sheet->m_oCols.IsInit() && col < oox_sheet->m_oCols->m_arrItems.size(); col++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_sheet->m_oCols->m_arrItems[col]);
|
||||
}
|
||||
ods_context->end_columns();
|
||||
}
|
||||
|
||||
//строки
|
||||
if (oox_sheet->m_oSheetData.IsInit() )
|
||||
{
|
||||
ods_context->start_rows();
|
||||
for (size_t row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
|
||||
for (std::list<OOX::Spreadsheet::CRow*>::iterator it = oox_sheet->m_oSheetData->m_arrItems.begin();
|
||||
it != oox_sheet->m_oSheetData->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_sheet->m_oSheetData->m_arrItems[row]);
|
||||
|
||||
//оптимизация памяти - удаляем уже не нужное
|
||||
if ( *it ) delete *it;
|
||||
*it = NULL;
|
||||
if ( oox_sheet->m_oSheetData->m_arrItems[row] )
|
||||
delete oox_sheet->m_oSheetData->m_arrItems[row];
|
||||
oox_sheet->m_oSheetData->m_arrItems[row] = NULL;
|
||||
}
|
||||
ods_context->end_rows();
|
||||
oox_sheet->m_oSheetData.reset();
|
||||
}
|
||||
|
||||
if (oox_sheet->m_oMergeCells.IsInit())
|
||||
//мержи
|
||||
for (size_t mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CMergeCell*>::iterator it = oox_sheet->m_oMergeCells->m_arrItems.begin();
|
||||
it != oox_sheet->m_oMergeCells->m_arrItems.end(); it++)
|
||||
{
|
||||
if ((*it) && ((*it)->m_oRef.IsInit()))
|
||||
{
|
||||
ods_context->add_merge_cells((*it)->m_oRef.get());
|
||||
}
|
||||
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
|
||||
ods_context->add_merge_cells(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get());
|
||||
}
|
||||
}
|
||||
if ((oox_sheet->m_oDrawing.IsInit()) && (oox_sheet->m_oDrawing->m_oId.IsInit()))
|
||||
if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit())
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_sheet->m_oDrawing->m_oId->GetValue());
|
||||
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Drawings == oFile->type())
|
||||
@ -336,10 +320,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
//выносные части таблицы
|
||||
if (oox_sheet->m_oTableParts.IsInit())
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::CTablePart*>::iterator it = oox_sheet->m_oTableParts->m_arrItems.begin();
|
||||
it != oox_sheet->m_oTableParts->m_arrItems.end(); it++)
|
||||
for (size_t i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CTablePart *oox_table_part = *it;
|
||||
OOX::Spreadsheet::CTablePart *oox_table_part = oox_sheet->m_oTableParts->m_arrItems[i];
|
||||
if (!oox_table_part)continue;
|
||||
if (!oox_table_part->m_oRId.IsInit())continue;
|
||||
|
||||
@ -446,10 +429,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
|
||||
|
||||
if (oox_comment->m_oText.IsInit())
|
||||
{
|
||||
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_comment->m_oText->m_arrItems.begin();
|
||||
it != oox_comment->m_oText->m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < oox_comment->m_oText->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_comment->m_oText->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
ods_context->end_comment();
|
||||
@ -527,9 +509,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row)
|
||||
}else
|
||||
ods_context->current_table().set_row_optimal_height(true);
|
||||
|
||||
for (std::list<OOX::Spreadsheet::CCell*>::iterator it = oox_row->m_arrItems.begin(); it != oox_row->m_arrItems.end(); it++)
|
||||
for (size_t cell = 0 ; cell < oox_row->m_arrItems.size();cell++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_row->m_arrItems[cell]);
|
||||
}
|
||||
ods_context->end_row();
|
||||
}
|
||||
@ -588,12 +570,9 @@ void XlsxConverter::convert_sharing_string(int number)
|
||||
const OOX::Spreadsheet::CSharedStrings *SharedStrings= xlsx_document->GetSharedStrings();
|
||||
if (!SharedStrings) return;
|
||||
|
||||
std::map<int, OOX::Spreadsheet::CSi*>::const_iterator pFind = SharedStrings->m_mapItems.find(number);
|
||||
if (number >=0 && number < SharedStrings->m_arrItems.size())
|
||||
|
||||
if (pFind != SharedStrings->m_mapItems.end())
|
||||
{
|
||||
convert(pFind->second);
|
||||
}
|
||||
convert(SharedStrings->m_arrItems[number]);
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
|
||||
@ -602,9 +581,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
|
||||
|
||||
ods_context->start_cell_text();
|
||||
|
||||
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_rtf_text->m_arrItems.begin(); it != oox_rtf_text->m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < oox_rtf_text->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_rtf_text->m_arrItems[i]);
|
||||
}
|
||||
|
||||
ods_context->end_cell_text();
|
||||
@ -665,9 +644,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRun *oox_text_run)
|
||||
convert(oox_text_run->m_oRPr.GetPointer());
|
||||
ods_context->text_context()->start_span(oox_text_run->m_oRPr.GetPointer() ? true : false);
|
||||
|
||||
for (std::list<OOX::Spreadsheet::CText*>::iterator it = oox_text_run->m_arrItems.begin(); it != oox_text_run->m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < oox_text_run->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_text_run->m_arrItems[i]);
|
||||
}
|
||||
ods_context->text_context()->end_span();
|
||||
}
|
||||
@ -946,9 +925,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
|
||||
{
|
||||
if (!oox_sheet_views)return;
|
||||
|
||||
for (std::list<OOX::Spreadsheet::CSheetView*>::iterator it = oox_sheet_views->m_arrItems.begin(); it != oox_sheet_views->m_arrItems.end(); it++)
|
||||
for (unsigned long i =0; i < oox_sheet_views->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CSheetView *sheet_view = *it;
|
||||
OOX::Spreadsheet::CSheetView *sheet_view = oox_sheet_views->m_arrItems[i];
|
||||
if (!sheet_view) continue;
|
||||
|
||||
int view_id = sheet_view->m_oWorkbookViewId->GetValue();
|
||||
@ -990,10 +969,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
|
||||
bool bPaneY = false;
|
||||
int ActiveCellX = -1, ActiveCellY = -1;
|
||||
|
||||
for (std::list<OOX::Spreadsheet::CSelection*>::iterator it = sheet_view->m_arrItems.begin();
|
||||
it != sheet_view->m_arrItems.end(); it++)
|
||||
for (size_t j = 0; j < sheet_view->m_arrItems.size(); j++)
|
||||
{
|
||||
OOX::Spreadsheet::CSelection *selection = *it;
|
||||
OOX::Spreadsheet::CSelection *selection = sheet_view->m_arrItems[j];
|
||||
|
||||
if (selection->m_oActiveCell.IsInit())
|
||||
{
|
||||
@ -1233,42 +1211,35 @@ void XlsxConverter::convert_styles()
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
|
||||
|
||||
if (!xlsx_styles)return;
|
||||
|
||||
int i = 0;
|
||||
//todooo ?? стоит ли обращать на параметр Count ??
|
||||
////////////форматы данных
|
||||
for (std::list<OOX::Spreadsheet::CNumFmt*>::iterator it = xlsx_styles->m_oNumFmts->m_arrItems.begin();
|
||||
xlsx_styles->m_oNumFmts.IsInit() && it != xlsx_styles->m_oNumFmts->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; xlsx_styles->m_oNumFmts.IsInit() && i < xlsx_styles->m_oNumFmts->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(*it);
|
||||
convert(xlsx_styles->m_oNumFmts->m_arrItems[i]);
|
||||
}
|
||||
/////////////стили ячеек
|
||||
for (std::list<OOX::Spreadsheet::CXfs*>::iterator it = xlsx_styles->m_oCellStyleXfs->m_arrItems.begin();
|
||||
xlsx_styles->m_oCellStyleXfs.IsInit() && it != xlsx_styles->m_oCellStyleXfs->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; xlsx_styles->m_oCellStyleXfs.IsInit() && i < xlsx_styles->m_oCellStyleXfs->m_arrItems.size(); i++)
|
||||
{
|
||||
//automatical, root - noname - они тока для named
|
||||
convert(*it , i++, true, true);
|
||||
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i, true, true);
|
||||
}
|
||||
for (std::list<OOX::Spreadsheet::CCellStyle*>::iterator it = xlsx_styles->m_oCellStyles->m_arrItems.begin();
|
||||
xlsx_styles->m_oCellStyles.IsInit() && it != xlsx_styles->m_oCellStyles->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; xlsx_styles->m_oCellStyles.IsInit() && i < xlsx_styles->m_oCellStyles->m_arrItems.size(); i++)//styles.xml
|
||||
{
|
||||
//non automatical, root - named
|
||||
convert(*it);
|
||||
convert(xlsx_styles->m_oCellStyles->m_arrItems[i]);
|
||||
}
|
||||
i = 0;
|
||||
|
||||
//кастомные стили ячеек
|
||||
for (std::list<OOX::Spreadsheet::CXfs*>::iterator it = xlsx_styles->m_oCellXfs->m_arrItems.begin();
|
||||
xlsx_styles->m_oCellXfs.IsInit() && it != xlsx_styles->m_oCellXfs->m_arrItems.end(); it++)
|
||||
for (size_t i = 0; xlsx_styles->m_oCellXfs.IsInit() && i < xlsx_styles->m_oCellXfs->m_arrItems.size(); i++)
|
||||
{
|
||||
//automatical, non root
|
||||
convert(*it, i++, true, false);
|
||||
convert(xlsx_styles->m_oCellXfs->m_arrItems[i], i, true, false);
|
||||
}
|
||||
|
||||
////////////стили условного форматирования
|
||||
for (std::list<OOX::Spreadsheet::CDxf*>::iterator it = xlsx_styles->m_oDxfs->m_arrItems.begin();
|
||||
xlsx_styles->m_oDxfs.IsInit() && it != xlsx_styles->m_oDxfs->m_arrItems.end(); it++)
|
||||
for (size_t i=0; xlsx_styles->m_oDxfs.IsInit() && i < xlsx_styles->m_oDxfs->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(*it, i);
|
||||
convert(xlsx_styles->m_oDxfs->m_arrItems[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1927,7 +1898,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing, OOX::Spread
|
||||
|
||||
if (oox_sheet->m_oOleObjects.IsInit() && oox_anchor->m_nId.IsInit())
|
||||
{
|
||||
std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator pFind = oox_sheet->m_oOleObjects->m_mapOleObjects.find(oox_anchor->m_nId.get());
|
||||
boost::unordered_map<int, OOX::Spreadsheet::COleObject*>::const_iterator pFind = oox_sheet->m_oOleObjects->m_mapOleObjects.find(oox_anchor->m_nId.get());
|
||||
if (pFind != oox_sheet->m_oOleObjects->m_mapOleObjects.end())
|
||||
{
|
||||
//??? перенести даные привязки
|
||||
@ -1947,7 +1918,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spr
|
||||
{
|
||||
if (!oox_objects) return;
|
||||
|
||||
for (std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator it = oox_objects->m_mapOleObjects.begin(); it != oox_objects->m_mapOleObjects.end(); ++it)
|
||||
for (boost::unordered_map<int, OOX::Spreadsheet::COleObject*>::const_iterator it = oox_objects->m_mapOleObjects.begin(); it != oox_objects->m_mapOleObjects.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::COleObject* object = it->second;
|
||||
ods_context->start_drawings();
|
||||
@ -2042,11 +2013,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_f
|
||||
{
|
||||
ods_context->current_table().start_conditional_format(oox_cond_fmt->m_oSqRef.get());
|
||||
|
||||
for (std::list<OOX::Spreadsheet::CConditionalFormattingRule*>::iterator it = oox_cond_fmt->m_arrItems.begin();
|
||||
it != oox_cond_fmt->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it);//rule
|
||||
}
|
||||
for (size_t i=0; i< oox_cond_fmt->m_arrItems.size(); i++)
|
||||
convert(oox_cond_fmt->m_arrItems[i]);//rule
|
||||
|
||||
ods_context->current_table().end_conditional_format();
|
||||
}
|
||||
@ -2068,11 +2036,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_co
|
||||
if (oox_cond_rule->m_oOperator.IsInit())
|
||||
ods_context->current_table().set_conditional_operator(oox_cond_rule->m_oOperator->GetValue());
|
||||
|
||||
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_rule->m_arrItems.begin();
|
||||
it != oox_cond_rule->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
for (size_t i=0; i< oox_cond_rule->m_arrItems.size(); i++)
|
||||
convert(oox_cond_rule->m_arrItems[i]);
|
||||
}
|
||||
ods_context->current_table().end_conditional_rule();
|
||||
}
|
||||
@ -2088,11 +2053,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
|
||||
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
|
||||
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
|
||||
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
|
||||
for (std::list<OOX::Spreadsheet::CConditionalFormatValueObject*>::iterator it = oox_cond_databar->m_arrItems.begin();
|
||||
it != oox_cond_databar->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
for (size_t i=0; i< oox_cond_databar->m_arrItems.size(); i++)
|
||||
convert(oox_cond_databar->m_arrItems[i]);
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
|
||||
{
|
||||
@ -2100,8 +2062,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
|
||||
it != oox_cond_colorscale->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
|
||||
it != oox_cond_colorscale->m_arrItems.end(); ++it)
|
||||
{
|
||||
if (*it == NULL )continue;
|
||||
|
||||
@ -2128,11 +2090,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CIconSet *oox_cond_iconset)
|
||||
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
|
||||
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
|
||||
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
|
||||
for (std::list<OOX::Spreadsheet::CConditionalFormatValueObject*>::iterator it = oox_cond_iconset->m_arrItems.begin();
|
||||
it != oox_cond_iconset->m_arrItems.end(); it++)
|
||||
{
|
||||
convert(*it);
|
||||
}
|
||||
for (size_t i=0; i< oox_cond_iconset->m_arrItems.size(); i++)
|
||||
convert(oox_cond_iconset->m_arrItems[i]);
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox_cond_value)
|
||||
{
|
||||
|
||||
@ -1055,7 +1055,7 @@ CElementPtr CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placeho
|
||||
{
|
||||
CElementPtr pElement;
|
||||
|
||||
for (std::multimap<int, int>::iterator it = pLayout->m_mapPlaceholders.begin(); it != pLayout->m_mapPlaceholders.end(); it++)
|
||||
for (std::multimap<int, int>::iterator it = pLayout->m_mapPlaceholders.begin(); it != pLayout->m_mapPlaceholders.end(); ++it)
|
||||
{
|
||||
pElement = NULL;
|
||||
if (it->first == placeholderType )
|
||||
@ -1099,7 +1099,7 @@ CElementPtr CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int plac
|
||||
{
|
||||
CElementPtr pElement;
|
||||
|
||||
for (std::multimap<int, int>::iterator it = pTheme->m_mapPlaceholders.begin(); it != pTheme->m_mapPlaceholders.end(); it++)
|
||||
for (std::multimap<int, int>::iterator it = pTheme->m_mapPlaceholders.begin(); it != pTheme->m_mapPlaceholders.end(); ++it)
|
||||
{
|
||||
if (it->first == placeholderType )
|
||||
{
|
||||
@ -1230,7 +1230,7 @@ int CPPTUserInfo::AddNewLayout(CTheme* pTheme, CRecordSlide* pRecordSlide, bool
|
||||
//if (layoutRecord.m_nGeom==0x0F) return ind; // big object only !!!
|
||||
|
||||
//копируем все элементы без idx которые не были прописаны явно
|
||||
for (std::multimap<int, int>::iterator it = pTheme->m_mapPlaceholders.begin(); it != pTheme->m_mapPlaceholders.end(); it++)
|
||||
for (std::multimap<int, int>::iterator it = pTheme->m_mapPlaceholders.begin(); it != pTheme->m_mapPlaceholders.end(); ++it)
|
||||
{
|
||||
if (pTheme->m_arElements[it->second]->m_lPlaceholderID >= 0) continue;
|
||||
|
||||
|
||||
@ -903,7 +903,7 @@ CDrawingConverter::~CDrawingConverter()
|
||||
HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument)
|
||||
{
|
||||
m_pBinaryWriter->ClearNoAttack();
|
||||
m_pBinaryWriter->m_pCommon->m_pImageManager->NewDocument();
|
||||
m_pBinaryWriter->m_pCommon->m_pMediaManager->Clear();
|
||||
|
||||
m_pBinaryWriter->SetMainDocument(pDocument);
|
||||
m_pReader->SetMainDocument(pDocument);
|
||||
@ -926,7 +926,7 @@ void CDrawingConverter::SetDstPath(const std::wstring& sPath)
|
||||
}
|
||||
void CDrawingConverter::SetMediaDstPath(const std::wstring& sPath)
|
||||
{
|
||||
m_pBinaryWriter->m_pCommon->m_pImageManager->m_strDstMedia = sPath;
|
||||
m_pBinaryWriter->m_pCommon->m_pMediaManager->m_strDstMedia = sPath;
|
||||
m_pImageManager->SetDstMedia(sPath);
|
||||
|
||||
NSDirectory::CreateDirectory(sPath);
|
||||
@ -2632,7 +2632,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
if (sId.length() > 0 && m_pBinaryWriter->m_pCurrentContainer->IsInit())
|
||||
{
|
||||
OOX::RId rId(sId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCurrentContainer)->GetLegacyDiagramText(rId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCurrentContainer)->Get<PPTX::LegacyDiagramText>(rId);
|
||||
|
||||
if (pExt.IsInit())
|
||||
{
|
||||
@ -5379,6 +5379,8 @@ smart_ptr<OOX::IFileContainer> CDrawingConverter::GetRels()
|
||||
}
|
||||
void CDrawingConverter::SetFontManager(CFontManager* pFontManager)
|
||||
{
|
||||
if(NULL != m_pBinaryWriter && NULL != m_pBinaryWriter->m_pCommon && NULL != m_pBinaryWriter->m_pCommon->m_pImageManager)
|
||||
m_pBinaryWriter->m_pCommon->m_pImageManager->SetFontManager(pFontManager);
|
||||
if(NULL != m_pBinaryWriter && NULL != m_pBinaryWriter->m_pCommon && NULL != m_pBinaryWriter->m_pCommon->m_pMediaManager)
|
||||
{
|
||||
m_pBinaryWriter->m_pCommon->m_pMediaManager->SetFontManager(pFontManager);
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,8 +313,8 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
m_strMediaDirectory = pathMedia.GetPath();
|
||||
oBinaryWriter.m_strMainFolder = pathDstFileOutput.GetDirectory();
|
||||
|
||||
oBinaryWriter.m_pCommon->m_pImageManager->m_strDstMedia = m_strMediaDirectory;
|
||||
oBinaryWriter.m_pCommon->m_pImageManager->SetFontManager(oBinaryWriter.m_pCommon->m_pNativePicker->m_pFontManager);
|
||||
oBinaryWriter.m_pCommon->m_pMediaManager->m_strDstMedia = m_strMediaDirectory;
|
||||
oBinaryWriter.m_pCommon->m_pMediaManager->SetFontManager(oBinaryWriter.m_pCommon->m_pNativePicker->m_pFontManager);
|
||||
|
||||
NSDirectory::CreateDirectory(m_strMediaDirectory);
|
||||
|
||||
|
||||
@ -78,14 +78,14 @@ namespace NSBinPptxRW
|
||||
m_pNativePicker = NULL;
|
||||
m_pFontPicker = NULL;
|
||||
m_bDeleteFontPicker = true;
|
||||
m_pImageManager = new NSShapeImageGen::CImageManager();
|
||||
m_pMediaManager = new NSShapeImageGen::CMediaManager();
|
||||
}
|
||||
CCommonWriter::~CCommonWriter()
|
||||
{
|
||||
m_pNativePicker = NULL;
|
||||
if(m_bDeleteFontPicker)
|
||||
RELEASEOBJECT(m_pFontPicker);
|
||||
RELEASEOBJECT(m_pImageManager);
|
||||
RELEASEOBJECT(m_pMediaManager);
|
||||
}
|
||||
void CCommonWriter::CreateFontPicker(COfficeFontPicker* pPicker)
|
||||
{
|
||||
@ -186,6 +186,21 @@ namespace NSBinPptxRW
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateMedia(const std::wstring& strInput)
|
||||
{
|
||||
std::map<std::wstring, _imageManager2Info>::const_iterator pPair = m_mapImages.find(strInput);
|
||||
|
||||
if (pPair != m_mapImages.end())
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
_imageManager2Info oImageManagerInfo = GenerateMediaExec(strInput);
|
||||
|
||||
m_mapImages[strInput] = oImageManagerInfo;
|
||||
|
||||
return oImageManagerInfo;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image)
|
||||
{
|
||||
if (IsNeedDownload(strInput))
|
||||
@ -197,7 +212,7 @@ namespace NSBinPptxRW
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
mediaFile->set_filename(pPair->second.sFilepathAdditional);
|
||||
mediaFile->set_filename(pPair->second.sFilepathAdditional, false);
|
||||
|
||||
return pPair->second;
|
||||
}
|
||||
@ -273,21 +288,24 @@ namespace NSBinPptxRW
|
||||
{
|
||||
typeAdditional = 2;
|
||||
|
||||
std::wstring strMedia = strFolder + strFileName + mediaFile->filename().GetExtention();
|
||||
if (OOX::CSystemUtility::IsFileExist(strMedia))
|
||||
if (!mediaFile->IsExternal())
|
||||
{
|
||||
m_pContentTypes->AddDefault(mediaFile->filename().GetExtention(false));
|
||||
strAdditional = strMedia;
|
||||
}
|
||||
else
|
||||
{
|
||||
strMedia = strFolder + strFileName;
|
||||
|
||||
if (mediaFile.is<OOX::Audio>()) strMedia += L".wav";
|
||||
if (mediaFile.is<OOX::Video>()) strMedia += L".avi";
|
||||
|
||||
std::wstring strMedia = strFolder + strFileName + mediaFile->filename().GetExtention();
|
||||
if (OOX::CSystemUtility::IsFileExist(strMedia))
|
||||
{
|
||||
m_pContentTypes->AddDefault(mediaFile->filename().GetExtention(false));
|
||||
strAdditional = strMedia;
|
||||
}
|
||||
else
|
||||
{
|
||||
strMedia = strFolder + strFileName;
|
||||
|
||||
if (mediaFile.is<OOX::Audio>()) strMedia += L".wav";
|
||||
if (mediaFile.is<OOX::Video>()) strMedia += L".avi";
|
||||
|
||||
if (OOX::CSystemUtility::IsFileExist(strMedia))
|
||||
strAdditional = strMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,7 +328,9 @@ namespace NSBinPptxRW
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
mediaFile->set_filename(oImageManagerInfo.sFilepathAdditional);
|
||||
{
|
||||
mediaFile->set_filename(oImageManagerInfo.sFilepathAdditional, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (strBase64Image.empty())
|
||||
@ -356,6 +376,30 @@ namespace NSBinPptxRW
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateMediaExec(const std::wstring& strInput)
|
||||
{
|
||||
OOX::CPath oPathOutput;
|
||||
_imageManager2Info oImageManagerInfo;
|
||||
|
||||
std::wstring strExts;
|
||||
std::wstring strMedia = L"media" + std::to_wstring(++m_lIndexNextImage);
|
||||
|
||||
int pos = (int)strInput.rfind(L".");
|
||||
if (pos >= 0)
|
||||
{
|
||||
strExts = strInput.substr(pos);
|
||||
m_pContentTypes->AddDefault(strExts.substr(1));
|
||||
}
|
||||
|
||||
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strMedia + strExts;
|
||||
|
||||
if (oPathOutput.GetPath() != strInput && NSFile::CFileBinary::Exists(strInput))
|
||||
{
|
||||
NSFile::CFileBinary::Copy(strInput, oPathOutput.GetPath());
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
}
|
||||
return oImageManagerInfo;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateImageExec(const std::wstring& strInput, const std::wstring& sExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData)
|
||||
{
|
||||
OOX::CPath oPathOutput;
|
||||
@ -1294,6 +1338,50 @@ namespace NSBinPptxRW
|
||||
oFile.WriteStringUTF8(strMem);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
_relsGeneratorInfo CRelsGenerator::WriteMedia(const std::wstring& strImage, int type)
|
||||
{
|
||||
_imageManager2Info oImageManagerInfo = m_pManager->GenerateMedia(strImage);
|
||||
|
||||
std::wstring strImageRelsPath;
|
||||
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strImageRelsPath = L"media/";
|
||||
else strImageRelsPath = L"../media/";
|
||||
|
||||
_relsGeneratorInfo oRelsGeneratorInfo;
|
||||
|
||||
if (!oImageManagerInfo.sFilepathImage.empty())
|
||||
{
|
||||
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
|
||||
|
||||
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
}
|
||||
}
|
||||
|
||||
m_mapImages.insert(std::pair<std::wstring, _relsGeneratorInfo>(strImageRelsPath, oRelsGeneratorInfo));
|
||||
return oRelsGeneratorInfo;
|
||||
}
|
||||
|
||||
_relsGeneratorInfo CRelsGenerator::WriteImage(const std::wstring& strImage, smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image = _T(""))
|
||||
{
|
||||
@ -1370,14 +1458,21 @@ namespace NSBinPptxRW
|
||||
{
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nMediaRId);
|
||||
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strMediaRelsPath = L"media/";
|
||||
else strMediaRelsPath = L"../media/";
|
||||
|
||||
strMediaRelsPath += mediaFile->filename().GetFilename();
|
||||
if (mediaFile->IsExternal())
|
||||
{
|
||||
strMediaRelsPath = mediaFile->filename().GetFilename();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strMediaRelsPath = L"media/";
|
||||
else strMediaRelsPath = L"../media/";
|
||||
|
||||
strMediaRelsPath += mediaFile->filename().GetFilename();
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid
|
||||
+ L"\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\" Target=\"" +
|
||||
strMediaRelsPath + L"\"/>");
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid
|
||||
+ L"\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\" Target=\"" +
|
||||
strMediaRelsPath + L"\"" + (mediaFile->IsExternal() ? L" TargetMode=\"External\"" : L"") + L"/>");
|
||||
}
|
||||
}
|
||||
}
|
||||
m_mapImages.insert(std::pair<std::wstring, _relsGeneratorInfo>(strImageRelsPath, oRelsGeneratorInfo));
|
||||
|
||||
@ -76,7 +76,7 @@ namespace BinDocxRW
|
||||
}
|
||||
namespace NSShapeImageGen
|
||||
{
|
||||
class CImageManager;
|
||||
class CMediaManager;
|
||||
}
|
||||
namespace NSFontCutter
|
||||
{
|
||||
@ -159,7 +159,7 @@ namespace NSBinPptxRW
|
||||
std::vector<LONG> m_oNote_Rels;
|
||||
std::vector<LONG> m_oNotesMasters_Rels;
|
||||
|
||||
NSShapeImageGen::CImageManager* m_pImageManager;
|
||||
NSShapeImageGen::CMediaManager* m_pMediaManager;
|
||||
|
||||
NSFontCutter::CFontDstManager* m_pNativePicker;
|
||||
COfficeFontPicker* m_pFontPicker;
|
||||
@ -201,7 +201,10 @@ namespace NSBinPptxRW
|
||||
|
||||
int IsDisplayedImage(const std::wstring& strInput);
|
||||
|
||||
_imageManager2Info GenerateMedia(const std::wstring& strInput);
|
||||
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
|
||||
_imageManager2Info GenerateMediaExec(const std::wstring& strInput);
|
||||
_imageManager2Info GenerateImageExec(const std::wstring& strInput, const std::wstring& strExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData);
|
||||
|
||||
void SaveImageAsPng(const std::wstring& strFileSrc, const std::wstring& strFileDst);
|
||||
@ -433,6 +436,7 @@ namespace NSBinPptxRW
|
||||
void SaveRels (const std::wstring& strFile);
|
||||
|
||||
_relsGeneratorInfo WriteImage (const std::wstring& strImage, NSCommon::smart_ptr<OOX::File>& additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
_relsGeneratorInfo WriteMedia (const std::wstring& strMedia, int type = 0);
|
||||
};
|
||||
|
||||
class CBinaryFileReader
|
||||
|
||||
@ -380,12 +380,12 @@ namespace PPTX2EditorAdvanced
|
||||
oBinaryWriter.StartRecord(NSMainTables::ImageMap);
|
||||
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
std::map<std::wstring, NSShapeImageGen::CImageInfo>* pIMaps = &oBinaryWriter.m_pCommon->m_pImageManager->m_mapImagesFile;
|
||||
std::map<std::wstring, NSShapeImageGen::CMediaInfo>* pIMaps = &oBinaryWriter.m_pCommon->m_pMediaManager->m_mapMediaFiles;
|
||||
|
||||
LONG lIndexI = 0;
|
||||
for (std::map<std::wstring, NSShapeImageGen::CImageInfo>::iterator pPair = pIMaps->begin(); pPair != pIMaps->end(); ++pPair)
|
||||
for (std::map<std::wstring, NSShapeImageGen::CMediaInfo>::iterator pPair = pIMaps->begin(); pPair != pIMaps->end(); ++pPair)
|
||||
{
|
||||
NSShapeImageGen::CImageInfo& oRec = pPair->second;
|
||||
NSShapeImageGen::CMediaInfo& oRec = pPair->second;
|
||||
oBinaryWriter.WriteString1(lIndexI++, oRec.GetPath2());
|
||||
}
|
||||
|
||||
|
||||
@ -274,7 +274,12 @@ namespace NSBinPptxRW
|
||||
size_t _countL = m_arSlideMasters_Theme[i].m_arLayouts.size();
|
||||
for (size_t j = 0; j < _countL; ++j)
|
||||
{
|
||||
m_arSlideLayouts_Master[m_arSlideMasters_Theme[i].m_arLayouts[j]] = (LONG)i;
|
||||
int index = m_arSlideMasters_Theme[i].m_arLayouts[j];
|
||||
|
||||
if (index >= 0 && index < m_arSlideLayouts_Master.size())
|
||||
{
|
||||
m_arSlideLayouts_Master[index] = (LONG)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +355,11 @@ namespace NSBinPptxRW
|
||||
|
||||
for (size_t i = 0; i < m_arNotesMasters_Theme.size(); i++)
|
||||
{
|
||||
arThemesSave[m_arNotesMasters_Theme[i]] = true;
|
||||
int index = m_arNotesMasters_Theme[i];
|
||||
if (index >= 0 && index < arThemesSave.size())
|
||||
{
|
||||
arThemesSave[index] = true;
|
||||
}
|
||||
}
|
||||
LONG lCurrectTheme = 0;
|
||||
for (LONG i = 0; i < nCountMasters; ++i)
|
||||
|
||||
@ -66,77 +66,93 @@ namespace NSShapeImageGen
|
||||
return CDirectory::CopyFile (strExists, strNew);
|
||||
}
|
||||
|
||||
enum ImageType
|
||||
enum MediaType
|
||||
{
|
||||
itJPG = 0,
|
||||
itPNG = 1,
|
||||
itVIF = 2,
|
||||
itWMF = 3,
|
||||
itEMF = 4,
|
||||
itSVG = 5
|
||||
itSVG = 5,
|
||||
itMedia = 6
|
||||
};
|
||||
|
||||
class CImageInfo
|
||||
class CMediaInfo
|
||||
{
|
||||
public:
|
||||
NSShapeImageGen::ImageType m_eType;
|
||||
NSShapeImageGen::MediaType m_eType;
|
||||
LONG m_lID;
|
||||
bool m_bValid;
|
||||
std::wstring m_sName;
|
||||
std::wstring m_sExt;
|
||||
|
||||
CImageInfo()
|
||||
CMediaInfo()
|
||||
{
|
||||
m_eType = itJPG;
|
||||
m_lID = -1;
|
||||
m_bValid = true;
|
||||
m_sName = L"image";
|
||||
}
|
||||
CImageInfo(const CImageInfo& oSrc)
|
||||
CMediaInfo(const CMediaInfo& oSrc)
|
||||
{
|
||||
*this = oSrc;
|
||||
}
|
||||
CImageInfo& operator=(const CImageInfo& oSrc)
|
||||
CMediaInfo& operator=(const CMediaInfo& oSrc)
|
||||
{
|
||||
m_eType = oSrc.m_eType;
|
||||
m_lID = oSrc.m_lID;
|
||||
m_bValid = oSrc.m_bValid;
|
||||
m_sName = oSrc.m_sName;
|
||||
m_sExt = oSrc.m_sExt;
|
||||
|
||||
return *this;
|
||||
}
|
||||
void SetNameModificator(NSShapeImageGen::ImageType eType, int typeAdditionalFile )
|
||||
void SetNameModificator(NSShapeImageGen::MediaType eType, int typeAdditionalFile = 0 )
|
||||
{
|
||||
if(itMedia == eType)
|
||||
{
|
||||
m_sName = L"media";
|
||||
return;
|
||||
}
|
||||
|
||||
int nRes = 0;
|
||||
|
||||
if(itWMF == eType) nRes += 1;
|
||||
if(itEMF == eType) nRes += 2;
|
||||
|
||||
if(typeAdditionalFile == 1) nRes += 4;
|
||||
if(typeAdditionalFile == 2) nRes += 8;
|
||||
|
||||
|
||||
if(0 != nRes)
|
||||
m_sName = L"display" + std::to_wstring(nRes) + L"image";
|
||||
}
|
||||
|
||||
AVSINLINE std::wstring GetPath2()
|
||||
{
|
||||
std::wstring _strExt = L"png";
|
||||
std::wstring _strExt;
|
||||
switch (m_eType)
|
||||
{
|
||||
case itPNG:
|
||||
_strExt = L".png";
|
||||
break;
|
||||
case itJPG:
|
||||
_strExt = L"jpg";
|
||||
_strExt = L".jpg";
|
||||
break;
|
||||
case itWMF:
|
||||
_strExt = L"wmf";
|
||||
_strExt = L".wmf";
|
||||
break;
|
||||
case itEMF:
|
||||
_strExt = L"emf";
|
||||
_strExt = L".emf";
|
||||
break;
|
||||
case itSVG:
|
||||
_strExt = L"svg";
|
||||
_strExt = L".svg";
|
||||
break;
|
||||
default:
|
||||
_strExt = m_sExt;
|
||||
break;
|
||||
}
|
||||
return m_sName + std::to_wstring(m_lID) + L"." + _strExt;
|
||||
return m_sName + std::to_wstring(m_lID) + _strExt;
|
||||
}
|
||||
AVSINLINE std::wstring GetPathWithoutExtension()
|
||||
{
|
||||
@ -144,14 +160,11 @@ namespace NSShapeImageGen
|
||||
}
|
||||
};
|
||||
|
||||
class CImageManager
|
||||
class CMediaManager
|
||||
{
|
||||
public:
|
||||
std::map<std::wstring, CImageInfo> m_mapImagesFile;
|
||||
std::map<DWORD, CImageInfo> m_mapImageData;
|
||||
|
||||
std::vector<void*> m_listDrawings;
|
||||
std::list<CImageInfo> m_listImages;
|
||||
std::map<std::wstring, CMediaInfo> m_mapMediaFiles; //map for files by link
|
||||
std::map<DWORD, CMediaInfo> m_mapMediaData; //map for files by data
|
||||
|
||||
std::wstring m_strDstMedia;
|
||||
|
||||
@ -163,7 +176,7 @@ namespace NSShapeImageGen
|
||||
NSWMFToImageConverter::CImageExt m_oImageExt;
|
||||
CFontManager* m_pFontManager;
|
||||
|
||||
CImageManager()
|
||||
CMediaManager()
|
||||
{
|
||||
m_lMaxSizeImage = c_nMaxImageSize;
|
||||
m_lNextIDImage = 0;
|
||||
@ -171,20 +184,19 @@ namespace NSShapeImageGen
|
||||
m_pFontManager = NULL;
|
||||
}
|
||||
|
||||
AVSINLINE void NewDocument()
|
||||
AVSINLINE void Clear()
|
||||
{
|
||||
m_strDstMedia = L"";
|
||||
m_lMaxSizeImage = 1200;
|
||||
m_lNextIDImage = 0;
|
||||
|
||||
m_mapImageData.clear();
|
||||
m_mapImagesFile.clear();
|
||||
m_listImages.clear();
|
||||
m_mapMediaData.clear();
|
||||
m_mapMediaFiles.clear();
|
||||
}
|
||||
|
||||
CImageInfo WriteImage(CBgraFrame& punkImage, double& x, double& y, double& width, double& height)
|
||||
CMediaInfo WriteImage(CBgraFrame& punkImage, double& x, double& y, double& width, double& height)
|
||||
{
|
||||
CImageInfo info;
|
||||
CMediaInfo info;
|
||||
//if (NULL == punkImage)
|
||||
// return info;
|
||||
|
||||
@ -197,7 +209,7 @@ namespace NSShapeImageGen
|
||||
|
||||
return GenerateImageID(punkImage, (std::max)(1.0, width), (std::max)(1.0, height));
|
||||
}
|
||||
CImageInfo WriteImage(const std::wstring& strFile, double& x, double& y, double& width, double& height, const std::wstring& strAdditionalFile, int typeAdditionalFile)
|
||||
CMediaInfo WriteImage(const std::wstring& strFile, double& x, double& y, double& width, double& height, const std::wstring& strAdditionalFile, int typeAdditionalFile)
|
||||
{
|
||||
bool bIsDownload = false;
|
||||
int n1 = (int)strFile.find (L"www");
|
||||
@ -221,10 +233,10 @@ namespace NSShapeImageGen
|
||||
XmlUtils::replace_all(strFileUrl, L"ftp:/", L"ftp://");
|
||||
|
||||
|
||||
CImageInfo oInfo;
|
||||
std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.find(strFileUrl);
|
||||
CMediaInfo oInfo;
|
||||
std::map<std::wstring, CMediaInfo>::iterator pPair = m_mapMediaFiles.find(strFileUrl);
|
||||
|
||||
if (pPair != m_mapImagesFile.end())
|
||||
if (pPair != m_mapMediaFiles.end())
|
||||
return pPair->second;
|
||||
|
||||
std::wstring strDownload;
|
||||
@ -240,13 +252,11 @@ namespace NSShapeImageGen
|
||||
#endif
|
||||
|
||||
return GenerateImageID(strDownload, strFileUrl, (std::max)(1.0, width), (std::max)(1.0, height), strAdditionalFile, typeAdditionalFile);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (strAdditionalFile.empty())
|
||||
{
|
||||
CImageInfo info;
|
||||
CMediaInfo info;
|
||||
CFile oFile;
|
||||
if (S_OK != oFile.OpenFile(strFile))
|
||||
return info;
|
||||
@ -257,6 +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");
|
||||
|
||||
//если 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;
|
||||
|
||||
#ifndef DISABLE_FILE_DOWNLOADER
|
||||
|
||||
CFileDownloader oDownloader(strFileUrl, true);
|
||||
if (oDownloader.DownloadSync())
|
||||
{
|
||||
strDownload = oDownloader.GetFilePath();
|
||||
}
|
||||
|
||||
#endif return GenerateMediaID(strDownload, strFileUrl);
|
||||
}
|
||||
else
|
||||
return GenerateMediaID(strFile, L"");
|
||||
}
|
||||
void SetFontManager(CFontManager* pFontManager)
|
||||
{
|
||||
m_pFontManager = pFontManager;
|
||||
@ -267,7 +322,7 @@ namespace NSShapeImageGen
|
||||
_CopyFile(strFileSrc, strFileDst, NULL, NULL);
|
||||
}
|
||||
|
||||
bool CheckImageSimpleCopy(const std::wstring& strFileSrc, CImageInfo& oInfo)
|
||||
bool CheckImageSimpleCopy(const std::wstring& strFileSrc, CMediaInfo& oInfo)
|
||||
{
|
||||
CFile oFile;
|
||||
HRESULT hr = oFile.OpenFile(strFileSrc);
|
||||
@ -310,7 +365,7 @@ namespace NSShapeImageGen
|
||||
return false;
|
||||
}
|
||||
|
||||
void SaveImage(const std::wstring& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
|
||||
void SaveImage(const std::wstring& strFileSrc, CMediaInfo& oInfo, LONG __width, LONG __height)
|
||||
{
|
||||
if (CheckImageSimpleCopy(strFileSrc, oInfo))
|
||||
return;
|
||||
@ -332,7 +387,7 @@ namespace NSShapeImageGen
|
||||
CDirectory::CopyFile(strFileSrc, strSaveItem);
|
||||
}
|
||||
}
|
||||
void SaveImage(CBgraFrame& oBgraFrame, CImageInfo& oInfo, LONG __width, LONG __height)
|
||||
void SaveImage(CBgraFrame& oBgraFrame, CMediaInfo& oInfo, LONG __width, LONG __height)
|
||||
{
|
||||
LONG lWidth = oBgraFrame.get_Width();
|
||||
LONG lHeight = oBgraFrame.get_Height();
|
||||
@ -378,12 +433,9 @@ namespace NSShapeImageGen
|
||||
oBgraFrame.SaveFile(std::wstring(pathSaveItem.GetPath()), nOutputFormat);
|
||||
}
|
||||
|
||||
CImageInfo GenerateImageID(CBgraFrame& punkData, double dWidth, double dHeight)
|
||||
CMediaInfo GenerateImageID(CBgraFrame& punkData, double dWidth, double dHeight)
|
||||
{
|
||||
CImageInfo oInfo;
|
||||
|
||||
//if (NULL == punkData)
|
||||
// return oInfo;
|
||||
CMediaInfo oInfo;
|
||||
|
||||
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
|
||||
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
|
||||
@ -393,8 +445,8 @@ namespace NSShapeImageGen
|
||||
|
||||
DWORD dwSum = m_oCRC.Calc(pBuffer, lLen);
|
||||
|
||||
std::map<DWORD, CImageInfo>::iterator pPair = m_mapImageData.find(dwSum);
|
||||
if (m_mapImageData.end() == pPair)
|
||||
std::map<DWORD, CMediaInfo>::iterator pPair = m_mapMediaData.find(dwSum);
|
||||
if (m_mapMediaData.end() == pPair)
|
||||
{
|
||||
// нужно добавить
|
||||
++m_lNextIDImage;
|
||||
@ -402,8 +454,7 @@ namespace NSShapeImageGen
|
||||
oInfo.m_lID = m_lNextIDImage;
|
||||
SaveImage(punkData, oInfo, lWidth, lHeight);
|
||||
|
||||
m_mapImageData.insert(std::pair<DWORD,CImageInfo>(dwSum, oInfo));
|
||||
m_listImages.push_back(oInfo);
|
||||
m_mapMediaData.insert(std::make_pair(dwSum, oInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -413,20 +464,20 @@ namespace NSShapeImageGen
|
||||
return oInfo;
|
||||
}
|
||||
|
||||
CImageInfo GenerateImageID(const std::wstring& strFileName, const std::wstring & strUrl, double dWidth, double dHeight, const std::wstring& strAdditionalFile, int typeAdditionalFile)
|
||||
CMediaInfo GenerateImageID(const std::wstring& strFileName, const std::wstring & strUrl, double dWidth, double dHeight, const std::wstring& strAdditionalFile, int typeAdditionalFile)
|
||||
{
|
||||
std::wstring sMapKey = strFileName;
|
||||
|
||||
if(!strUrl.empty()) sMapKey = strUrl;
|
||||
if(!strAdditionalFile.empty()) sMapKey += strAdditionalFile;
|
||||
|
||||
CImageInfo oInfo;
|
||||
std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.find(sMapKey);
|
||||
CMediaInfo oInfo;
|
||||
std::map<std::wstring, CMediaInfo>::iterator pPair = m_mapMediaFiles.find(sMapKey);
|
||||
|
||||
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
|
||||
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
|
||||
|
||||
if (m_mapImagesFile.end() == pPair)
|
||||
if (m_mapMediaFiles.end() == pPair)
|
||||
{
|
||||
++m_lNextIDImage;
|
||||
oInfo.m_lID = m_lNextIDImage;
|
||||
@ -444,7 +495,7 @@ namespace NSShapeImageGen
|
||||
oInfo.SetNameModificator(oInfo.m_eType, typeAdditionalFile);
|
||||
|
||||
std::wstring strSaveDir = m_strDstMedia + FILE_SEPARATOR_STR;
|
||||
std::wstring strSaveItemWE = strSaveDir + std::wstring(oInfo.GetPathWithoutExtension());
|
||||
std::wstring strSaveItemWE = strSaveDir + oInfo.GetPathWithoutExtension();
|
||||
|
||||
//copy ole bin or media
|
||||
if(bOle || bMedia)
|
||||
@ -516,8 +567,7 @@ namespace NSShapeImageGen
|
||||
{
|
||||
oInfo.m_eType = itPNG;
|
||||
|
||||
m_mapImagesFile.insert(std::pair<std::wstring,CImageInfo>(sMapKey, oInfo));
|
||||
m_listImages.push_back(oInfo);
|
||||
m_mapMediaFiles.insert(std::make_pair(sMapKey, oInfo));
|
||||
return oInfo;
|
||||
}
|
||||
}
|
||||
@ -526,8 +576,7 @@ namespace NSShapeImageGen
|
||||
oInfo.m_eType = itSVG;
|
||||
|
||||
oWriterSVG.SaveFile(strSaveItemWE + L".svg");
|
||||
m_mapImagesFile.insert(std::pair<std::wstring,CImageInfo>(sMapKey, oInfo));
|
||||
m_listImages.push_back(oInfo);
|
||||
m_mapMediaFiles.insert(std::make_pair(sMapKey, oInfo));
|
||||
return oInfo;
|
||||
}
|
||||
}
|
||||
@ -535,8 +584,7 @@ namespace NSShapeImageGen
|
||||
|
||||
SaveImage(strFileName, oInfo, lWidth, lHeight);
|
||||
|
||||
m_mapImagesFile.insert(std::pair<std::wstring,CImageInfo>(sMapKey, oInfo));
|
||||
m_listImages.push_back(oInfo);
|
||||
m_mapMediaFiles.insert(std::make_pair(sMapKey, oInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -546,7 +594,45 @@ namespace NSShapeImageGen
|
||||
return oInfo;
|
||||
}
|
||||
|
||||
ImageType GetImageType(CBgraFrame& pFrame)
|
||||
CMediaInfo GenerateMediaID(const std::wstring& strFileName, const std::wstring & strUrl)
|
||||
{
|
||||
std::wstring sMapKey;
|
||||
|
||||
if(!strUrl.empty()) sMapKey = strUrl;
|
||||
else sMapKey = strFileName;
|
||||
|
||||
CMediaInfo oInfo;
|
||||
std::map<std::wstring, CMediaInfo>::iterator pFind = m_mapMediaFiles.find(sMapKey);
|
||||
|
||||
if (m_mapMediaFiles.end() == pFind)
|
||||
{
|
||||
++m_lNextIDImage;
|
||||
oInfo.m_lID = m_lNextIDImage;
|
||||
|
||||
oInfo.m_eType = itMedia;
|
||||
oInfo.m_sName = L"media";
|
||||
|
||||
std::wstring strSaveItemWE = m_strDstMedia + FILE_SEPARATOR_STR + oInfo.GetPath2();
|
||||
|
||||
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
|
||||
if (-1 != nIndexExt)
|
||||
oInfo.m_sExt = strFileName.substr(nIndexExt);
|
||||
|
||||
std::wstring strCopyMediaPath = strSaveItemWE + oInfo.m_sExt;
|
||||
|
||||
CDirectory::CopyFile(strFileName, strCopyMediaPath);
|
||||
|
||||
m_mapMediaFiles.insert(std::make_pair(sMapKey, oInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
oInfo = pFind->second;
|
||||
}
|
||||
|
||||
return oInfo;
|
||||
}
|
||||
|
||||
MediaType GetImageType(CBgraFrame& pFrame)
|
||||
{
|
||||
if (2 == m_lDstFormat)
|
||||
return itJPG;
|
||||
|
||||
@ -40,10 +40,11 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Rels.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Media.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include <map>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
@ -103,7 +104,7 @@ namespace PPTX
|
||||
pSrcFile->type() == OOX::Presentation::FileTypes::NotesSlide) ? true : false;
|
||||
}
|
||||
|
||||
for (std::map<std::wstring, OOX::Rels::CRelationShip*>::const_iterator it = rels.m_mapRelations.begin(); it != rels.m_mapRelations.end(); it++)
|
||||
for (boost::unordered_map<std::wstring, OOX::Rels::CRelationShip*>::const_iterator it = rels.m_mapRelations.begin(); it != rels.m_mapRelations.end(); ++it)
|
||||
{
|
||||
OOX::Rels::CRelationShip* pRelation = it->second;
|
||||
|
||||
@ -113,7 +114,7 @@ namespace PPTX
|
||||
|
||||
if (bIsSlide && (pRelation->Type() == OOX::FileTypes::HyperLink ||
|
||||
pRelation->Type() == OOX::Presentation::FileTypes::Slide))
|
||||
{// + external audio, video ...
|
||||
{// + external audio, video ... - в обычных ...
|
||||
|
||||
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
|
||||
|
||||
@ -177,12 +178,15 @@ namespace PPTX
|
||||
|
||||
void FileContainer::write(OOX::CRels& rels, const OOX::CPath& curdir, const OOX::CPath& directory, OOX::CContentTypes& content) const
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
|
||||
if ( !pExt.IsInit() )
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
|
||||
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
|
||||
|
||||
bool bExternal = pExt.IsInit() || ((pMedia.IsInit()) && (pMedia->IsExternal()));
|
||||
if ( !bExternal )
|
||||
{
|
||||
smart_ptr<PPTX::WrapperFile> file = pFile.smart_dynamic_cast<PPTX::WrapperFile>();
|
||||
|
||||
@ -226,7 +230,7 @@ namespace PPTX
|
||||
|
||||
void FileContainer::WrittenSetFalse()
|
||||
{
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
for (boost::unordered_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;
|
||||
|
||||
|
||||
@ -65,9 +65,6 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalVideo.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/UnknowTypeFile.h"
|
||||
//
|
||||
|
||||
@ -76,7 +73,7 @@ namespace PPTX
|
||||
{
|
||||
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& filename, OOX::Rels::CRelationShip& relation, FileMap& map)
|
||||
{
|
||||
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
|
||||
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false && !relation.IsExternal())
|
||||
{
|
||||
return smart_ptr<OOX::File>(NULL);
|
||||
}
|
||||
@ -121,20 +118,14 @@ namespace PPTX
|
||||
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace(filename, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::HyperLink)
|
||||
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
|
||||
else if ((relation.Type() == OOX::FileTypes::ExternalImage) && (relation.IsExternal()))
|
||||
return smart_ptr<OOX::File>(new OOX::ExternalImage(relation.Target()));
|
||||
else if ((relation.Type() == OOX::FileTypes::ExternalAudio) && (relation.IsExternal()))
|
||||
return smart_ptr<OOX::File>(new OOX::ExternalAudio(relation.Target()));
|
||||
else if ((relation.Type() == OOX::FileTypes::ExternalVideo) && (relation.IsExternal()))
|
||||
return smart_ptr<OOX::File>(new OOX::ExternalVideo(relation.Target()));
|
||||
else if (relation.Type() == OOX::FileTypes::Image)
|
||||
return smart_ptr<OOX::File>(new OOX::Image(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::Image(filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Audio)
|
||||
return smart_ptr<OOX::File>(new OOX::Audio(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::Audio(filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Media)
|
||||
return smart_ptr<OOX::File>(new OOX::Media(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::Media(filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Video)
|
||||
return smart_ptr<OOX::File>(new OOX::Video(filename));
|
||||
return smart_ptr<OOX::File>(new OOX::Video(filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::Data)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramData(filename));
|
||||
else if (relation.Type() == OOX::FileTypes::DiagDrawing)
|
||||
|
||||
@ -96,7 +96,7 @@ namespace PPTX
|
||||
////проблема переноса картинок !!!
|
||||
//if (controls.IsInit())
|
||||
//{
|
||||
// controls->AddObjectsTo(&spTree.SpTreeElems, pWriter->m_pCommon->m_pImageManager);
|
||||
// controls->AddObjectsTo(&spTree.SpTreeElems, pWriter->m_pCommon->m_pMediaManager);
|
||||
//}
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
@ -59,7 +59,7 @@ namespace PPTX
|
||||
|
||||
return xml;
|
||||
}
|
||||
void Control::AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const
|
||||
void Control::AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CMediaManager* pMediaManager) const
|
||||
{//проблема переноса картинок !!!
|
||||
if (spid.IsInit() == false) return;
|
||||
|
||||
@ -78,15 +78,16 @@ namespace PPTX
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
oDrawingConverter.SetAdditionalParam(_T("parent_spTree"), (BYTE*)spTreeElements, 0);
|
||||
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = pImageManager;
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager);
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pMediaManager;
|
||||
|
||||
oDrawingConverter.SetRels(rels);
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = NULL;
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = NULL;
|
||||
}
|
||||
}
|
||||
void Control::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -104,11 +105,12 @@ namespace PPTX
|
||||
std::wstring temp = _T("<v:object>");
|
||||
temp += xml;
|
||||
temp += L"</v:object>";
|
||||
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
//oDrawingConverter.SetFontManager(pFontManager);
|
||||
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = pWriter->m_pCommon->m_pImageManager;
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager;
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
|
||||
@ -119,17 +121,17 @@ namespace PPTX
|
||||
{
|
||||
pWriter->WriteBYTEArray(oDrawingConverter.m_pBinaryWriter->GetBuffer(),oDrawingConverter.m_pBinaryWriter->GetPosition());
|
||||
}
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = NULL;
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Controls::AddObjectsTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const
|
||||
void Controls::AddObjectsTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CMediaManager* pMediaManager) const
|
||||
{
|
||||
for (size_t i=0; i < arrControls.size(); ++i)
|
||||
{
|
||||
if (arrControls[i].spid.IsInit() == false) continue;
|
||||
|
||||
arrControls[i].AddObjectTo (spTreeElements, pImageManager );
|
||||
arrControls[i].AddObjectTo (spTreeElements, pMediaManager );
|
||||
}
|
||||
}
|
||||
} // namespace Logic
|
||||
|
||||
@ -48,8 +48,7 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Control)
|
||||
|
||||
public:
|
||||
void AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const ;
|
||||
void AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CMediaManager* pMediaManager) const ;
|
||||
|
||||
std::wstring GetVmlXmlBySpid(std::wstring spid, smart_ptr<OOX::IFileContainer> & rels) const ;
|
||||
|
||||
@ -175,7 +174,7 @@ namespace PPTX
|
||||
for (size_t i = 0; i <arrControls.size(); i++)
|
||||
arrControls[i].toPPTY(pWriter);
|
||||
}
|
||||
void AddObjectsTo (const std::vector<PPTX::Logic::SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const;
|
||||
void AddObjectsTo (const std::vector<PPTX::Logic::SpTreeElem> *spTreeElements, NSShapeImageGen::CMediaManager* pMediaManager) const;
|
||||
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
|
||||
@ -105,42 +105,32 @@ namespace PPTX
|
||||
{
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Image> p = pRels->GetImage(*embed);
|
||||
smart_ptr<OOX::Image> p = pRels->Get<OOX::Image>(*embed);
|
||||
if (p.is_init())
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>())
|
||||
return parentFileAs<Slide>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
return parentFileAs<SlideLayout>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*embed);
|
||||
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*embed);
|
||||
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*embed);
|
||||
return _T("");
|
||||
}
|
||||
else if(link.IsInit())
|
||||
{
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Image> p = pRels->GetImage(*link);
|
||||
smart_ptr<OOX::Image> p = pRels->Get<OOX::Image>(*link);
|
||||
if (p.is_init())
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>())
|
||||
return parentFileAs<Slide>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
return parentFileAs<SlideLayout>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*link);
|
||||
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*link);
|
||||
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*link);
|
||||
return _T("");
|
||||
}
|
||||
return _T("");
|
||||
@ -149,12 +139,13 @@ namespace PPTX
|
||||
{
|
||||
smart_ptr<OOX::OleObject> pOleObject;
|
||||
|
||||
if (pRels != NULL) pOleObject = pRels->GetOleObject(oRId);
|
||||
else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().GetOleObject(oRId);
|
||||
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().GetOleObject(oRId);
|
||||
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().GetOleObject(oRId);
|
||||
if (pRels != NULL) pOleObject = pRels->Get<OOX::OleObject>(oRId);
|
||||
|
||||
else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().Get<OOX::OleObject>(oRId);
|
||||
|
||||
if (pOleObject.IsInit())
|
||||
return pOleObject->filename().m_strFilename;
|
||||
@ -250,7 +241,7 @@ namespace PPTX
|
||||
imagePath = this->GetFullPicName(pRels);
|
||||
}
|
||||
|
||||
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(imagePath, dX, dY, dW, dH, additionalPath, additionalType);
|
||||
NSShapeImageGen::CMediaInfo oId = pWriter->m_pCommon->m_pMediaManager->WriteImage(imagePath, dX, dY, dW, dH, additionalPath, additionalType);
|
||||
std::wstring s = oId.GetPath2();
|
||||
|
||||
pWriter->StartRecord(3);
|
||||
|
||||
@ -50,6 +50,7 @@ namespace PPTX
|
||||
Blip(std::wstring ns = L"a")
|
||||
{
|
||||
m_namespace = ns;
|
||||
mediaExternal = false;
|
||||
}
|
||||
Blip& operator=(const Blip& oSrc)
|
||||
{
|
||||
@ -69,6 +70,7 @@ namespace PPTX
|
||||
|
||||
mediaRid = oSrc.mediaRid;
|
||||
mediaFilepath = oSrc.mediaFilepath;
|
||||
mediaExternal = oSrc.mediaExternal;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -105,6 +107,7 @@ namespace PPTX
|
||||
//internal
|
||||
std::wstring mediaRid;
|
||||
std::wstring mediaFilepath;
|
||||
bool mediaExternal;
|
||||
|
||||
std::wstring oleRid;
|
||||
std::wstring oleFilepathBin;
|
||||
|
||||
@ -468,8 +468,8 @@ namespace PPTX
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
//oDrawingConverter.SetFontManager(pFontManager);
|
||||
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = pWriter->m_pCommon->m_pImageManager;
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager;
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
|
||||
@ -481,7 +481,7 @@ namespace PPTX
|
||||
{
|
||||
pWriter->WriteBYTEArray(oDrawingConverter.m_pBinaryWriter->GetBuffer()+10,oDrawingConverter.m_pBinaryWriter->GetPosition()-10);
|
||||
}
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = NULL;
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = NULL;
|
||||
return;
|
||||
}
|
||||
pWriter->StartRecord(SPTREE_TYPE_GRFRAME);
|
||||
|
||||
@ -32,53 +32,170 @@
|
||||
|
||||
|
||||
#include "Hyperlink.h"
|
||||
#include "./../Slide.h"
|
||||
#include "./../SlideMaster.h"
|
||||
#include "./../SlideLayout.h"
|
||||
#include "./../Theme.h"
|
||||
|
||||
#include "../Slide.h"
|
||||
#include "../SlideMaster.h"
|
||||
#include "../SlideLayout.h"
|
||||
#include "../Theme.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
std::wstring Hyperlink::GetFullHyperlinkName(OOX::IFileContainer* pRels)const
|
||||
std::wstring Hyperlink::GetPathFromId(OOX::IFileContainer* pRels, const std::wstring & rId)const
|
||||
{
|
||||
if(id.IsInit() && *id != _T(""))
|
||||
if (rId.empty()) return L"";
|
||||
|
||||
OOX::RId rid(rId);
|
||||
|
||||
std::wstring sLink = L"";
|
||||
if (pRels != NULL)
|
||||
{
|
||||
OOX::RId rid(*id);
|
||||
|
||||
std::wstring sLink = _T("");
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = pRels->GetHyperlink(rid);
|
||||
if (p.is_init())
|
||||
sLink = p->Uri().m_strFilename;
|
||||
}
|
||||
if(sLink.empty())
|
||||
{
|
||||
if(parentFileIs<Slide>())
|
||||
sLink = parentFileAs<Slide>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
sLink = parentFileAs<SlideLayout>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
sLink = parentFileAs<SlideMaster>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<Theme>())
|
||||
sLink = parentFileAs<Theme>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
sLink = parentFileAs<NotesSlide>().GetFullHyperlinkNameFromRId(rid);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all(sLink, L"\\", L"/");
|
||||
XmlUtils::replace_all(sLink, L"//", L"/");
|
||||
XmlUtils::replace_all(sLink, L"http:/", L"http://");
|
||||
XmlUtils::replace_all(sLink, L"https:/",L"https://");
|
||||
XmlUtils::replace_all(sLink, L"ftp:/", L"ftp://");
|
||||
XmlUtils::replace_all(sLink, L"file:/", L"file://");
|
||||
|
||||
return sLink;
|
||||
smart_ptr<OOX::HyperLink> p = pRels->Get<OOX::HyperLink>(rid);
|
||||
if (p.is_init())
|
||||
sLink = p->Uri().m_strFilename;
|
||||
}
|
||||
return _T("");
|
||||
if(sLink.empty())
|
||||
{
|
||||
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all(sLink, L"\\", L"/");
|
||||
XmlUtils::replace_all(sLink, L"//", L"/");
|
||||
XmlUtils::replace_all(sLink, L"http:/", L"http://");
|
||||
XmlUtils::replace_all(sLink, L"https:/",L"https://");
|
||||
XmlUtils::replace_all(sLink, L"ftp:/", L"ftp://");
|
||||
XmlUtils::replace_all(sLink, L"file:/", L"file://");
|
||||
|
||||
return sLink;
|
||||
}
|
||||
|
||||
void Hyperlink::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
if (id.is_init())
|
||||
{
|
||||
std::wstring hyperlinkPath = GetPathFromId(pRels, id.IsInit() ? *id : L"");
|
||||
pWriter->WriteString1(0, hyperlinkPath);
|
||||
}
|
||||
|
||||
pWriter->WriteString2(1, invalidUrl);
|
||||
pWriter->WriteString2(2, action);
|
||||
pWriter->WriteString2(3, tgtFrame);
|
||||
pWriter->WriteString2(4, tooltip);
|
||||
pWriter->WriteBool2(5, history);
|
||||
pWriter->WriteBool2(6, highlightClick);
|
||||
pWriter->WriteBool2(7, endSnd);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord2(0, snd);
|
||||
}
|
||||
|
||||
void Hyperlink::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
bool bIsPresentUrl = false;
|
||||
std::wstring strUrl;
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
strUrl = pReader->GetString2();
|
||||
bIsPresentUrl = true;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
invalidUrl = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
action = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
tgtFrame = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
tooltip = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
history = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
highlightClick = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
endSnd = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (pReader->GetPos() < _end_rec)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
snd = new PPTX::Logic::WavAudioFile(L"snd");
|
||||
snd->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pReader->Seek(_end_rec);
|
||||
|
||||
if (bIsPresentUrl)
|
||||
{
|
||||
if (strUrl == _T(""))
|
||||
id = _T("");
|
||||
else
|
||||
{
|
||||
LONG lId = pReader->m_pRels->WriteHyperlink(strUrl, action.is_init());
|
||||
|
||||
id = L"rId" + std::to_wstring(lId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace PPTX
|
||||
public:
|
||||
WritingElement_AdditionConstructors(Hyperlink)
|
||||
|
||||
Hyperlink(std::wstring name = L"hlinkClick")
|
||||
Hyperlink(const std::wstring & name = L"hlinkClick")
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
@ -107,111 +107,8 @@ namespace PPTX
|
||||
node.ReadAttributeBase(L"endSnd", endSnd);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
if (id.is_init())
|
||||
{
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
std::wstring str = GetFullHyperlinkName(pRels);
|
||||
pWriter->WriteString1(0, str);
|
||||
}
|
||||
|
||||
pWriter->WriteString2(1, invalidUrl);
|
||||
pWriter->WriteString2(2, action);
|
||||
pWriter->WriteString2(3, tgtFrame);
|
||||
pWriter->WriteString2(4, tooltip);
|
||||
pWriter->WriteBool2(5, history);
|
||||
pWriter->WriteBool2(6, highlightClick);
|
||||
pWriter->WriteBool2(7, endSnd);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord2(0, snd);
|
||||
}
|
||||
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
bool bIsPresentUrl = false;
|
||||
std::wstring strUrl = _T("");
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
strUrl = pReader->GetString2();
|
||||
bIsPresentUrl = true;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
invalidUrl = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
action = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
tgtFrame = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
tooltip = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
history = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
highlightClick = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
endSnd = pReader->GetBool();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsPresentUrl)
|
||||
{
|
||||
if (strUrl == _T(""))
|
||||
id = _T("");
|
||||
else
|
||||
{
|
||||
LONG lId = pReader->m_pRels->WriteHyperlink(strUrl, action.is_init());
|
||||
|
||||
id = L"rId" + std::to_wstring(lId);
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:" + m_name);
|
||||
@ -235,7 +132,6 @@ namespace PPTX
|
||||
pWriter->EndNode(L"a:" + m_name);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable<WavAudioFile> snd;
|
||||
|
||||
nullable_string id; //<OOX::RId> id;// <xsd:attribute ref="r:id" use="optional"/>
|
||||
@ -246,9 +142,8 @@ namespace PPTX
|
||||
nullable_bool history; //default="true"
|
||||
nullable_bool highlightClick; //default="false"
|
||||
nullable_bool endSnd; //default="false"
|
||||
//private:
|
||||
public:
|
||||
std::wstring m_name;
|
||||
|
||||
std::wstring m_name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
@ -256,7 +151,7 @@ namespace PPTX
|
||||
snd->SetParentPointer(this);
|
||||
}
|
||||
|
||||
virtual std::wstring GetFullHyperlinkName(OOX::IFileContainer* pRels)const;
|
||||
virtual std::wstring GetPathFromId(OOX::IFileContainer* pRels, const std::wstring &rId)const;
|
||||
};
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
136
ASCOfficePPTXFile/PPTXFormat/Logic/Media/WavAudioFile.cpp
Normal file
136
ASCOfficePPTXFile/PPTXFormat/Logic/Media/WavAudioFile.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "WavAudioFile.h"
|
||||
#include "../../Slide.h"
|
||||
#include "../../SlideMaster.h"
|
||||
#include "../../SlideLayout.h"
|
||||
#include "../../Theme.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Media/Media.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
std::wstring WavAudioFile::GetPathFromId(OOX::IFileContainer* pRels, const std::wstring & rId)const
|
||||
{
|
||||
if (rId.empty()) return L"";
|
||||
|
||||
OOX::RId rid(rId);
|
||||
|
||||
std::wstring sLink = L"";
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Media> p = pRels->Get<OOX::Media>(rid);
|
||||
if (p.is_init())
|
||||
sLink = p->filename().GetPath();
|
||||
}
|
||||
if(sLink.empty())
|
||||
{
|
||||
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
|
||||
}
|
||||
|
||||
return sLink;
|
||||
}
|
||||
void WavAudioFile::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
std::wstring audioPath = GetPathFromId(pRels, embed.get());
|
||||
|
||||
NSShapeImageGen::CMediaInfo oId = pWriter->m_pCommon->m_pMediaManager->WriteMedia(audioPath);
|
||||
std::wstring s = oId.GetPath2();
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteString1(0, s);
|
||||
if (name.IsInit())
|
||||
{
|
||||
pWriter->WriteString1(1, *name);
|
||||
}
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
}
|
||||
|
||||
void WavAudioFile::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
std::wstring strSoundPath;
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
strSoundPath = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
name = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
|
||||
if (!strSoundPath.empty())
|
||||
{
|
||||
std::wstring strPath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strSoundPath;
|
||||
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteMedia(strPath, 1);
|
||||
|
||||
if (oRelsGeneratorInfo.nImageRId > 0)
|
||||
{
|
||||
embed = OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
@ -44,7 +44,11 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(WavAudioFile)
|
||||
PPTX_LOGIC_BASE2(WavAudioFile)
|
||||
|
||||
WavAudioFile(const std::wstring & name = L"wavAudioFile")
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
WavAudioFile& operator=(const WavAudioFile& oSrc)
|
||||
{
|
||||
@ -100,14 +104,17 @@ namespace PPTX
|
||||
|
||||
pWriter->EndNode(_T("a:") + m_name);
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
|
||||
|
||||
public:
|
||||
nullable_string name;
|
||||
OOX::RId embed;
|
||||
public:
|
||||
std::wstring m_name;
|
||||
nullable_string name;
|
||||
OOX::RId embed;
|
||||
|
||||
std::wstring m_name; //node name
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
std::wstring GetPathFromId(OOX::IFileContainer* pRels, const std::wstring & rId) const;
|
||||
};
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
@ -81,7 +81,7 @@ namespace PPTX
|
||||
if (m_OleObjectFile.IsInit() == false && !ole_bin.empty())
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(!mspackage.empty());
|
||||
m_OleObjectFile->set_filename (ole_bin);
|
||||
m_OleObjectFile->set_filename (ole_bin, false);
|
||||
m_OleObjectFile->set_filename_cache (ole_image);
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ namespace PPTX
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
std::wstring strOlePath = pReader->GetString2();
|
||||
m_OleObjectFile->set_filename(strOlePath); //temp !!! for ImageManager original file name
|
||||
m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name
|
||||
}
|
||||
else
|
||||
break;
|
||||
@ -329,7 +329,7 @@ namespace PPTX
|
||||
m_OleObjectFile = new OOX::OleObject(true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
std::wstring strOlePath = pReader->GetString(_embed_data_size);
|
||||
m_OleObjectFile->set_filename(strOlePath); //temp !!! for ImageManager original file name
|
||||
m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name
|
||||
}
|
||||
else if (embedded_type == 1)
|
||||
{
|
||||
@ -416,7 +416,7 @@ namespace PPTX
|
||||
//std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeWordDocument.RelationType();
|
||||
//
|
||||
//m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring());
|
||||
m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename);
|
||||
m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, false);
|
||||
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"docx");
|
||||
}
|
||||
@ -434,9 +434,9 @@ namespace PPTX
|
||||
std::wstring sXmlOptions, sMediaPath, sEmbedPath;
|
||||
BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath);
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
oXlsx.m_mapEnumeratedGlobal.clear();
|
||||
|
||||
@ -470,7 +470,7 @@ namespace PPTX
|
||||
//std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
//
|
||||
//m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring());
|
||||
m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename);
|
||||
m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, false);
|
||||
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
}
|
||||
@ -496,11 +496,12 @@ namespace PPTX
|
||||
smart_ptr<OOX::OleObject> ole_file = m_OleObjectFile;
|
||||
if (ole_file.IsInit() == false)
|
||||
{
|
||||
if (pRels != NULL) ole_file = pRels->GetOleObject(oRId);
|
||||
else if(parentFileIs<Slide>()) ole_file = parentFileAs<Slide>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) ole_file = parentFileAs<SlideLayout>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) ole_file = parentFileAs<SlideMaster>().GetOleObject(oRId);
|
||||
else if(parentFileIs<Theme>()) ole_file = parentFileAs<Theme>().GetOleObject(oRId);
|
||||
if (pRels != NULL) ole_file = pRels->Get<OOX::OleObject>(oRId);
|
||||
|
||||
else if(parentFileIs<Slide>()) ole_file = parentFileAs<Slide>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) ole_file = parentFileAs<SlideLayout>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) ole_file = parentFileAs<SlideMaster>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<Theme>()) ole_file = parentFileAs<Theme>().Get<OOX::OleObject>(oRId);
|
||||
}
|
||||
return ole_file;
|
||||
}
|
||||
@ -649,18 +650,19 @@ namespace PPTX
|
||||
}
|
||||
if (oleObject->m_sShapeId.IsInit() && pVml && !blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty())
|
||||
{
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
|
||||
if (pVml->m_mapShapes.end() != pPair)
|
||||
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
|
||||
|
||||
if (pVml->m_mapShapes.end() != pPair)
|
||||
{
|
||||
pPair->second.bUsed = true;
|
||||
OOX::Vml::CVmlCommonElements* pShape = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pPair->second.pElement);
|
||||
|
||||
if (pShape)
|
||||
{
|
||||
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
|
||||
it != pShape->m_arrItems.end(); it++)
|
||||
for(size_t i = 0; i < pShape->m_arrItems.size(); ++i)
|
||||
{
|
||||
OOX::WritingElement* pChildElemShape = *it;
|
||||
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[i];
|
||||
|
||||
if(OOX::et_v_imagedata == pChildElemShape->getType())
|
||||
{
|
||||
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
|
||||
@ -696,14 +698,18 @@ namespace PPTX
|
||||
if (mediaFile.IsInit() && blipFill.blip.IsInit())
|
||||
{
|
||||
blipFill.blip->mediaFilepath = mediaFile->filename().GetPath();
|
||||
blipFill.blip->mediaExternal = mediaFile->IsExternal();
|
||||
}
|
||||
|
||||
if (nvPicPr.nvPr.media.is<MediaFile>())
|
||||
{
|
||||
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
|
||||
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
|
||||
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
|
||||
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile" ||
|
||||
nvPicPr.nvPr.media.as<MediaFile>().name == L"quickTimeFile")
|
||||
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
|
||||
else
|
||||
pWriter->StartRecord(SPTREE_TYPE_PIC);
|
||||
}
|
||||
else if (nvPicPr.nvPr.media.is<WavAudioFile>() || nvPicPr.nvPr.media.is<AudioCD>())
|
||||
{
|
||||
@ -724,8 +730,12 @@ namespace PPTX
|
||||
pWriter->StartRecord(5);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
std::wstring sExt = mediaFile->filename().GetExtention(false);
|
||||
if (!sExt.empty())
|
||||
if (!sExt.empty() && !mediaFile->IsExternal())
|
||||
pWriter->WriteString1(0, L"maskFile." + sExt);
|
||||
else
|
||||
pWriter->WriteString1(0, mediaFile->filename().GetPath());
|
||||
|
||||
pWriter->WriteBool1(1, mediaFile->IsExternal());
|
||||
//todoo start, end positions ..
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
@ -845,15 +855,20 @@ namespace PPTX
|
||||
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
|
||||
|
||||
if (NSFile::CFileBinary::Exists(oleObject->m_OleObjectFile->filename().GetPath()) == false)
|
||||
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin);
|
||||
{
|
||||
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin, false);
|
||||
}
|
||||
}
|
||||
|
||||
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit() && blipFill.blip.IsInit())
|
||||
{
|
||||
if (NSFile::CFileBinary::Exists(mediaFile->filename().GetPath()) == false)
|
||||
mediaFile->set_filename (blipFill.blip->mediaFilepath);
|
||||
}
|
||||
if (!mediaFile->IsExternal() && NSFile::CFileBinary::Exists(mediaFile->filename().GetPath()) == false)
|
||||
{
|
||||
mediaFile->set_filename (blipFill.blip->mediaFilepath,
|
||||
false == NSFile::CFileBinary::Exists(blipFill.blip->mediaFilepath));
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
@ -876,10 +891,11 @@ namespace PPTX
|
||||
}break;
|
||||
case 5:
|
||||
{
|
||||
bool isExternal = false;
|
||||
std::wstring strMediaFileMask;
|
||||
|
||||
LONG _end_rec1 = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
@ -888,17 +904,20 @@ namespace PPTX
|
||||
|
||||
if (0 == _at)
|
||||
{
|
||||
std::wstring strMediaFileMask = pReader->GetString2();
|
||||
|
||||
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
{
|
||||
mediaFile->set_filename(strMediaFileMask);
|
||||
}
|
||||
strMediaFileMask = pReader->GetString2();
|
||||
}
|
||||
else if (1 == _at)
|
||||
{
|
||||
isExternal = pReader->GetBool();
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
{
|
||||
mediaFile->set_filename(strMediaFileMask, isExternal);
|
||||
}
|
||||
pReader->Seek(_end_rec1);
|
||||
}
|
||||
default:
|
||||
@ -917,41 +936,49 @@ namespace PPTX
|
||||
{
|
||||
oleObject->m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin);
|
||||
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin, false);
|
||||
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
|
||||
}
|
||||
}
|
||||
if (!blipFill.blip->mediaRid.empty())
|
||||
{
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.link = OOX::RId(blipFill.blip->mediaRid);
|
||||
nvPicPr.nvPr.extLst.push_back(ext);
|
||||
|
||||
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
bool bExternal = mediaFile->IsExternal();
|
||||
|
||||
std::wstring strMediaRelsPath;
|
||||
if (pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strMediaRelsPath = L"media/";
|
||||
else strMediaRelsPath = L"../media/";
|
||||
|
||||
if (bExternal)
|
||||
{
|
||||
strMediaRelsPath = mediaFile->filename().GetFilename();
|
||||
}
|
||||
else
|
||||
{
|
||||
strMediaRelsPath += mediaFile->filename().GetFilename();
|
||||
|
||||
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
strMediaRelsPath += mediaFile->filename().GetFilename();
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.link = OOX::RId(blipFill.blip->mediaRid);
|
||||
nvPicPr.nvPr.extLst.push_back(ext);
|
||||
}
|
||||
|
||||
int nRId = -1;
|
||||
if (blipFill.additionalFile.is<OOX::Audio>())
|
||||
{
|
||||
nvPicPr.nvPr.media.Media = new PPTX::Logic::MediaFile(L"audioFile");
|
||||
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio", strMediaRelsPath, L"");
|
||||
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio", strMediaRelsPath, bExternal ? L"External" : L"");
|
||||
|
||||
}
|
||||
if (blipFill.additionalFile.is<OOX::Video>())
|
||||
{
|
||||
nvPicPr.nvPr.media.Media = new PPTX::Logic::MediaFile(L"videoFile");
|
||||
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", strMediaRelsPath, L"");
|
||||
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", strMediaRelsPath, bExternal ? L"External" : L"");
|
||||
}
|
||||
|
||||
if (nvPicPr.nvPr.media.Media.IsInit() && nRId > 0)
|
||||
{
|
||||
PPTX::Logic::MediaFile& mediaFile = nvPicPr.nvPr.media.Media.as<PPTX::Logic::MediaFile>();
|
||||
mediaFile.link = OOX::RId((size_t)nRId);
|
||||
|
||||
}
|
||||
if (nvPicPr.cNvPr.hlinkClick.IsInit() == false)
|
||||
nvPicPr.cNvPr.hlinkClick.Init();
|
||||
|
||||
@ -212,7 +212,6 @@ namespace PPTX
|
||||
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
|
||||
{
|
||||
//nvGrpSpPr.cNvPr.toXmlWriter2(_T("wpg"), pWriter);
|
||||
nvGrpSpPr.cNvGrpSpPr.toXmlWriter2(_T("wpg"), pWriter);
|
||||
}
|
||||
else
|
||||
|
||||
@ -246,7 +246,7 @@ namespace PPTX
|
||||
m_elem.reset(new Logic::Pic(oReader));
|
||||
else if (name == _T("cxnSp"))
|
||||
m_elem.reset(new Logic::CxnSp(oReader));
|
||||
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas"))
|
||||
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas") || name == _T("wpc"))
|
||||
m_elem.reset(new Logic::SpTree(oReader));
|
||||
else if (name == _T("graphicFrame"))
|
||||
{
|
||||
@ -296,7 +296,7 @@ namespace PPTX
|
||||
m_elem.reset(new Logic::Pic(node));
|
||||
else if (name == _T("cxnSp"))
|
||||
m_elem.reset(new Logic::CxnSp(node));
|
||||
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas"))
|
||||
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas") || name == _T("wpc"))
|
||||
m_elem.reset(new Logic::SpTree(node));
|
||||
else if (name == _T("graphicFrame"))
|
||||
m_elem.reset(new Logic::GraphicFrame(node));
|
||||
|
||||
@ -88,26 +88,18 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
//return relsTable.Links.GetTargetById(rid);
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
return pExt->Uri().m_strFilename; //??? целесообразность ??
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
|
||||
@ -145,23 +145,15 @@ namespace PPTX
|
||||
}
|
||||
//-------------------------------------------------
|
||||
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
//return relsTable.Links.GetTargetById(rid);
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
@ -172,9 +164,9 @@ namespace PPTX
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId (const OOX::RId& rid)const
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = GetOleObject(rid);
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
@ -372,7 +364,7 @@ namespace PPTX
|
||||
{
|
||||
if(Vml.is_init() && !spid.empty())
|
||||
{
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
if (Vml->m_mapShapes.end() != pPair)
|
||||
{
|
||||
pPair->second.bUsed = true;
|
||||
|
||||
@ -173,23 +173,28 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = GetOleObject(rid);
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
@ -418,7 +423,7 @@ namespace PPTX
|
||||
{
|
||||
if(Vml.is_init() && !spid.empty())
|
||||
{
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
if (Vml->m_mapShapes.end() != pPair)
|
||||
{
|
||||
pPair->second.bUsed = true;
|
||||
|
||||
@ -162,23 +162,28 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = GetOleObject(rid);
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
@ -372,7 +377,7 @@ namespace PPTX
|
||||
{
|
||||
if(Vml.is_init() && !spid.empty())
|
||||
{
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = Vml->m_mapShapes.find(spid);
|
||||
if (Vml->m_mapShapes.end() != pPair)
|
||||
{
|
||||
pPair->second.bUsed = true;
|
||||
|
||||
@ -277,7 +277,8 @@ namespace PPTX
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::FileTypes::Theme;
|
||||
if (isThemeOverride) return OOX::FileTypes::ThemeOverride;
|
||||
else return OOX::FileTypes::Theme;
|
||||
}
|
||||
virtual const OOX::CPath DefaultDirectory() const
|
||||
{
|
||||
@ -324,23 +325,28 @@ namespace PPTX
|
||||
return GetABGRFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
}
|
||||
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = GetOleObject(rid);
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
|
||||
@ -53,6 +53,7 @@ SOURCES += \
|
||||
|
||||
core_debug {
|
||||
SOURCES += \
|
||||
../../../PPTXFormat/Logic/Media/WavAudioFile.cpp \
|
||||
../../../PPTXFormat/Logic/Colors/SchemeClr.cpp \
|
||||
../../../PPTXFormat/Logic/Fills/Blip.cpp \
|
||||
../../../PPTXFormat/Logic/Table/TableCell.cpp \
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "../../../PPTXFormat/Logic/Media/WavAudioFile.cpp"
|
||||
#include "../../../PPTXFormat/Logic/Colors/SchemeClr.cpp"
|
||||
#include "../../../PPTXFormat/Logic/Fills/Blip.cpp"
|
||||
#include "../../../PPTXFormat/Logic/Table/TableCell.cpp"
|
||||
|
||||
@ -2878,6 +2878,10 @@
|
||||
RelativePath="..\.\PPTXFormat\Logic\Media\MediaFile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PPTXFormat\Logic\Media\WavAudioFile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\.\PPTXFormat\Logic\Media\WavAudioFile.h"
|
||||
>
|
||||
|
||||
@ -68,10 +68,10 @@ public:
|
||||
oBackgroundReader.Parse( oParam, m_poDocument->m_pBackground);
|
||||
}
|
||||
|
||||
std::list<OOX::WritingElement*>::iterator last_section_start = m_ooxDocument->m_arrItems.begin();
|
||||
std::vector<OOX::WritingElement*>::iterator last_section_start = m_ooxDocument->m_arrItems.begin();
|
||||
|
||||
//считаем количесво секций и заполняем их свойства ..
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxDocument->m_arrItems.begin(); it != m_ooxDocument->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxDocument->m_arrItems.begin(); it != m_ooxDocument->m_arrItems.end(); ++it)
|
||||
{
|
||||
if ((*it) == NULL) continue;
|
||||
|
||||
@ -125,7 +125,7 @@ public:
|
||||
{
|
||||
m_oTextItemReader.m_oTextItems = m_poDocument->m_aArray[sect].props;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_poDocument->m_aArray[sect].start_para; it != m_poDocument->m_aArray[sect].end_para; it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_poDocument->m_aArray[sect].start_para; it != m_poDocument->m_aArray[sect].end_para; ++it)
|
||||
{
|
||||
m_oTextItemReader.Parse(*it, oParam );
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ public:
|
||||
int nId = ooxFtnEdn->m_oId->GetValue();
|
||||
OOXTextItemReader oTextItemReader;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = ooxFtnEdn->m_arrItems.begin(); it != ooxFtnEdn->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = ooxFtnEdn->m_arrItems.begin(); it != ooxFtnEdn->m_arrItems.end(); ++it)
|
||||
{
|
||||
if( nSeparatorId == nId )
|
||||
{
|
||||
|
||||
@ -47,7 +47,7 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, std::wstring sRID, TextItem
|
||||
oOutput = TextItemContainerPtr ( new TextItemContainer() );
|
||||
oOOXTextItemReader.m_oTextItems = oOutput;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = pHdrFtr->m_arrItems.begin(); it != pHdrFtr->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = pHdrFtr->m_arrItems.begin(); it != pHdrFtr->m_arrItems.end(); ++it)
|
||||
{
|
||||
oOOXTextItemReader.Parse(*it, oParam );
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
{
|
||||
if (m_ooxElem == NULL) return false;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxElem->m_arrItems.begin(); it != m_ooxElem->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxElem->m_arrItems.begin(); it != m_ooxElem->m_arrItems.end(); ++it)
|
||||
{
|
||||
RtfMathPtr pNewMath;
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
|
||||
{
|
||||
if (m_ooxElement == NULL) return false;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxElement->m_arrItems.begin(); it != m_ooxElement->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxElement->m_arrItems.begin(); it != m_ooxElement->m_arrItems.end(); ++it)
|
||||
{
|
||||
Parse3(oParam , oOutputParagraph, oConditionalTableStyle, poStyle , *it);
|
||||
}
|
||||
@ -400,7 +400,7 @@ bool OOXParagraphReader::Parse3( ReaderParameter oParam , RtfParagraph& oOutputP
|
||||
{
|
||||
OOX::Logic::CSmartTag * pSmartTag = dynamic_cast<OOX::Logic::CSmartTag*>(m_ooxElement);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = pSmartTag->m_arrItems.begin(); it != pSmartTag->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = pSmartTag->m_arrItems.begin(); it != pSmartTag->m_arrItems.end(); ++it)
|
||||
{
|
||||
OOX::Logic::CRun * pRun = dynamic_cast<OOX::Logic::CRun*>(*it);
|
||||
if (pRun == NULL) continue;
|
||||
@ -1018,7 +1018,7 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
|
||||
orPrReader.Parse( oParam, oNewProperty );
|
||||
}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxRun->m_arrItems.begin(); it != m_ooxRun->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxRun->m_arrItems.begin(); it != m_ooxRun->m_arrItems.end(); ++it)
|
||||
{
|
||||
Parse(oParam, oOutputParagraph, poStyle, oNewProperty, *it);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
|
||||
{
|
||||
if (m_arrElement == NULL) return false;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_arrElement->m_arrItems.begin(); it != m_arrElement->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_arrElement->m_arrItems.begin(); it != m_arrElement->m_arrItems.end(); ++it)
|
||||
{
|
||||
if ((*it) == NULL) continue;
|
||||
|
||||
@ -493,10 +493,9 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
|
||||
if ((text_box) && (text_box->m_oTxtbxContent.IsInit()))
|
||||
{
|
||||
OOXTextItemReader oTextItemReader;
|
||||
|
||||
for (size_t i = 0; i < text_box->m_oTxtbxContent->m_arrItems.size(); i++)
|
||||
for (std::list<OOX::WritingElement*>::iterator it = text_box->m_oTxtbxContent->m_arrItems.begin();
|
||||
it != text_box->m_oTxtbxContent->m_arrItems.end(); it++)
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = text_box->m_oTxtbxContent->m_arrItems.begin();
|
||||
it != text_box->m_oTxtbxContent->m_arrItems.end(); ++it)
|
||||
{
|
||||
oTextItemReader.Parse( *it, oParam );
|
||||
}
|
||||
@ -1046,8 +1045,8 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
|
||||
}
|
||||
if (xfrm->extX.IsInit() && xfrm->extY.IsInit())
|
||||
{
|
||||
pOutput->m_nRelRight = (int)pOutput->m_nRelLeft + xfrm->offX.get();
|
||||
pOutput->m_nRelBottom = (int)pOutput->m_nRelTop + xfrm->offY.get();
|
||||
pOutput->m_nRelRight = (int)pOutput->m_nRelLeft + xfrm->extX.get();
|
||||
pOutput->m_nRelBottom = (int)pOutput->m_nRelTop + xfrm->extY.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1226,6 +1225,18 @@ bool OOXShapeReader::ParsePic( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
{
|
||||
Parse(oParam, pOutput, ooxPic->spPr.ln.GetPointer());
|
||||
}
|
||||
//scale picture
|
||||
if (ooxPic->spPr.xfrm.IsInit() && pOutput->m_oPicture)
|
||||
{
|
||||
if (ooxPic->spPr.xfrm->extX.IsInit() && ooxPic->spPr.xfrm->extY.IsInit())
|
||||
{
|
||||
double cx = ooxPic->spPr.xfrm->extX.get();
|
||||
double cy = ooxPic->spPr.xfrm->extY.get();
|
||||
|
||||
pOutput->m_oPicture->m_dScaleX = (pOutput->m_nRight - pOutput->m_nLeft) * 100. / pOutput->m_oPicture->m_nWidthGoal;
|
||||
pOutput->m_oPicture->m_dScaleY = (pOutput->m_nBottom - pOutput->m_nTop)* 100. / pOutput->m_oPicture->m_nHeightGoal;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
@ -1516,7 +1527,7 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
|
||||
pOutput->m_nGroupBottom =(pOutput->m_nGroupTop != PROP_DEF ? pOutput->m_nGroupTop : 0) + m_vmlGroup->m_oCoordSize->GetY();
|
||||
}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_vmlGroup->m_arrItems.begin(); it != m_vmlGroup->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_vmlGroup->m_arrItems.begin(); it != m_vmlGroup->m_arrItems.end(); ++it)
|
||||
{
|
||||
if (*it == NULL) continue;
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ public:
|
||||
oConditionalTableStyle.ApplyTableStyleToCellBorder( oParam.poTableStyle, oOutputCell.m_oProperty, nCurCell, nCellCount, nCurRow, nRowCount );
|
||||
}
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxTableCell->m_arrItems.begin(); it != m_ooxTableCell->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxTableCell->m_arrItems.begin(); it != m_ooxTableCell->m_arrItems.end(); ++it)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
{
|
||||
|
||||
@ -172,7 +172,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
|
||||
|
||||
long nRowCount = m_ooxTable->m_nCountRow, nCurRow = 0;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxTable->m_arrItems.begin(); it != m_ooxTable->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxTable->m_arrItems.begin(); it != m_ooxTable->m_arrItems.end(); ++it)
|
||||
{
|
||||
if ( (*it) == NULL) continue;
|
||||
if ( (*it)->getType() != OOX::et_w_tr) continue;
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
|
||||
int nCellCount = m_ooxRowTable->m_nCountCell, nCurCell = 0;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = m_ooxRowTable->m_arrItems.begin(); it != m_ooxRowTable->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxRowTable->m_arrItems.begin(); it != m_ooxRowTable->m_arrItems.end(); ++it)
|
||||
{
|
||||
if ( (*it) == NULL ) continue;
|
||||
if ( (*it)->getType() != OOX::et_w_tc)continue;//todooo bookmarks
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
{
|
||||
OOX::Logic::CSdtContent * pSdt = dynamic_cast<OOX::Logic::CSdtContent*>(ooxElement);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = pSdt->m_arrItems.begin(); it != pSdt->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = pSdt->m_arrItems.begin(); it != pSdt->m_arrItems.end(); ++it)
|
||||
{
|
||||
Parse( *it, oParam );
|
||||
}
|
||||
|
||||
@ -45,8 +45,8 @@ namespace OOX
|
||||
struct _section
|
||||
{
|
||||
RtfSectionPtr props;
|
||||
std::list<OOX::WritingElement*>::iterator start_para;
|
||||
std::list<OOX::WritingElement*>::iterator end_para;
|
||||
std::vector<OOX::WritingElement*>::iterator start_para;
|
||||
std::vector<OOX::WritingElement*>::iterator end_para;
|
||||
};
|
||||
|
||||
class RtfDocument : public ItemContainer<_section>
|
||||
|
||||
@ -39,8 +39,8 @@ std::wstring RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
|
||||
std::wstring sResult;
|
||||
sResult += L"{\\pict";
|
||||
|
||||
RENDER_RTF_INT( 100, sResult, L"picscalex" )
|
||||
RENDER_RTF_INT( 100, sResult, L"picscaley" )
|
||||
RENDER_RTF_INT( (int)m_dScaleX, sResult, L"picscalex" )
|
||||
RENDER_RTF_INT( (int)m_dScaleY, sResult, L"picscaley" )
|
||||
|
||||
RENDER_RTF_INT( m_nCropL, sResult, L"piccropl" )
|
||||
RENDER_RTF_INT( m_nCropT, sResult, L"piccropt" )
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
@ -67,7 +67,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Urlmon.lib Rpcrt4.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="LIBCMT.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
IgnoreEmbeddedIDL="true"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
@ -418,6 +418,14 @@
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/bigobj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
|
||||
|
||||
@ -118,7 +118,7 @@ const std::wstring Encoding::utf82unicode(const std::string& line)
|
||||
if (conversionOK != eUnicodeConversionResult)
|
||||
{
|
||||
delete [] pStrUtf32;
|
||||
return cp2unicode(line,0);
|
||||
return ansi2unicode(line);
|
||||
}
|
||||
std::wstring utf32Str ((wchar_t *) pStrUtf32);
|
||||
|
||||
|
||||
@ -46,22 +46,11 @@ static const std::vector<Out> _transform(const std::vector<In>& lines, const Out
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename Out, typename In>
|
||||
static const std::list<Out> _transform(const std::list<In>& lines, const Out(*func)(const In&))
|
||||
{
|
||||
std::list<Out> result;
|
||||
for (typename std::list<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
result.push_back(func(*iter));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename Out, typename In, typename In2>
|
||||
static const std::list<Out> _transform2(const std::list<In>& lines, const int codepage, const Out(*func)(const In&, const In2 codePage))
|
||||
static const std::vector<Out> _transform2(const std::vector<In>& lines, const int codepage, const Out(*func)(const In&, const In2 codePage))
|
||||
{
|
||||
std::list<Out> result;
|
||||
for (typename std::list<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
std::vector<Out> result;
|
||||
for (typename std::vector<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
result.push_back(func(*iter, codepage));
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "Common//ToString.h"
|
||||
#include <map>
|
||||
|
||||
namespace Docx2Txt
|
||||
{
|
||||
@ -72,7 +73,7 @@ namespace Docx2Txt
|
||||
OOX::CDocx m_inputFile;
|
||||
|
||||
private:
|
||||
void convert(std::list<OOX::WritingElement *> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event, bool isFirstLevel,
|
||||
void convert(std::vector<OOX::WritingElement *> & items, std::vector<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event, bool isFirstLevel,
|
||||
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
|
||||
|
||||
int m_lPercent;
|
||||
@ -85,7 +86,7 @@ namespace Docx2Txt
|
||||
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
|
||||
|
||||
size_t NoteCount;
|
||||
std::map<std::wstring, std::list<std::wstring>> Notes;
|
||||
std::map<std::wstring, std::vector<std::wstring>> Notes;
|
||||
|
||||
static std::wstring IntToLowerLetter (int number);
|
||||
static std::wstring IntToUpperLetter (int number);
|
||||
@ -201,11 +202,11 @@ namespace Docx2Txt
|
||||
m_outputFile.m_listContent.push_back(L"");
|
||||
m_outputFile.m_listContent.push_back(L"---------------------------");
|
||||
|
||||
for(std::map<std::wstring, std::list<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
|
||||
for(std::map<std::wstring, std::vector<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
|
||||
{
|
||||
bool bFirst = true;
|
||||
|
||||
for(std::list<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
|
||||
for(std::vector<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
|
||||
{
|
||||
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
|
||||
else m_outputFile.m_listContent.push_back(*iter);
|
||||
@ -248,7 +249,7 @@ namespace Docx2Txt
|
||||
}
|
||||
|
||||
|
||||
void Converter_Impl::convert(std::list<OOX::WritingElement*> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event,
|
||||
void Converter_Impl::convert(std::vector<OOX::WritingElement*> & items, std::vector<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event,
|
||||
bool isFirstLevel, OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles)
|
||||
{
|
||||
if( !items.empty() )
|
||||
@ -256,7 +257,7 @@ namespace Docx2Txt
|
||||
if(isFirstLevel)
|
||||
m_lAddition = m_lAddition / items.size();
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = items.begin(); it != items.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
OOX::WritingElement* item = *it;
|
||||
|
||||
@ -464,8 +465,8 @@ namespace Docx2Txt
|
||||
|
||||
bool inField = false;
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin();
|
||||
it != pParagraph->m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin();
|
||||
it != pParagraph->m_arrItems.end(); ++it)
|
||||
{
|
||||
if (*it== NULL) continue;
|
||||
|
||||
@ -473,7 +474,7 @@ namespace Docx2Txt
|
||||
{
|
||||
OOX::Logic::CRun *run = dynamic_cast<OOX::Logic::CRun*>(*it);
|
||||
|
||||
for (std::list<OOX::WritingElement*>::iterator jt = run->m_arrItems.begin(); jt != run->m_arrItems.end(); jt++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator jt = run->m_arrItems.begin(); jt != run->m_arrItems.end(); jt++)
|
||||
{
|
||||
if (*jt== NULL) continue;
|
||||
|
||||
@ -512,7 +513,7 @@ namespace Docx2Txt
|
||||
if ((*jt)->getType() == OOX::et_w_footnoteReference || (*it)->getType() == OOX::et_w_endnoteReference)
|
||||
{// todooo Ref ????
|
||||
|
||||
std::list<std::wstring> notes_content;
|
||||
std::vector<std::wstring> notes_content;
|
||||
|
||||
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(*jt);
|
||||
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(*jt);
|
||||
|
||||
@ -69,8 +69,8 @@ namespace Txt2Docx
|
||||
|
||||
void Converter::write(/*const std::wstring& path*/XmlUtils::CStringWriter & stringWriter)
|
||||
{
|
||||
for (std::list<OOX::WritingElement*>::iterator it = converter_->m_outputFile.m_arrItems.begin();
|
||||
it != converter_->m_outputFile.m_arrItems.end(); it++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = converter_->m_outputFile.m_arrItems.begin();
|
||||
it != converter_->m_outputFile.m_arrItems.end(); ++it)
|
||||
{
|
||||
if ( *it )
|
||||
stringWriter.WriteString((*it)->toXML());
|
||||
@ -110,7 +110,7 @@ namespace Txt2Docx
|
||||
font.m_sHAnsi.Init(); *font.m_sHAnsi = L"Courier New";
|
||||
font.m_sCs.Init(); *font.m_sCs = L"Courier New";
|
||||
|
||||
for (std::list<std::wstring>::iterator line = m_inputFile.m_listContent.begin(); line != m_inputFile.m_listContent.end(); line++)
|
||||
for (std::vector<std::wstring>::iterator line = m_inputFile.m_listContent.begin(); line != m_inputFile.m_listContent.end(); line++)
|
||||
{
|
||||
OOX::Logic::CParagraph *paragraph = new OOX::Logic::CParagraph();
|
||||
OOX::Logic::CParagraphProperty *pPr = new OOX::Logic::CParagraphProperty();
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Txt
|
||||
}
|
||||
File::~File()
|
||||
{
|
||||
m_listContent.clear();
|
||||
m_listContent.clear();
|
||||
}
|
||||
void File::read(const std::wstring& filename, int code_page) // насильственное чтение в кодировке
|
||||
{
|
||||
@ -55,10 +55,10 @@ namespace Txt
|
||||
|
||||
TxtFile file(filename);
|
||||
|
||||
std::list<std::string> codePageContent = file.readAnsiOrCodePage();
|
||||
std::vector<std::string> codePageContent = file.readAnsiOrCodePage();
|
||||
m_listContentSize = file.getLinesCount();
|
||||
|
||||
for (std::list<std::string>::const_iterator iter = codePageContent.begin(); iter != codePageContent.end(); ++iter)
|
||||
for (std::vector<std::string>::const_iterator iter = codePageContent.begin(); iter != codePageContent.end(); ++iter)
|
||||
{
|
||||
m_listContent.push_back(Encoding::cp2unicode(*iter, code_page));
|
||||
}
|
||||
@ -118,8 +118,8 @@ namespace Txt
|
||||
{
|
||||
TxtFile file(filename);
|
||||
|
||||
std::list<std::string> result;
|
||||
for (std::list<std::wstring>::const_iterator iter = m_listContent.begin(); iter != m_listContent.end(); ++iter)
|
||||
std::vector<std::string> result;
|
||||
for (std::vector<std::wstring>::const_iterator iter = m_listContent.begin(); iter != m_listContent.end(); ++iter)
|
||||
{
|
||||
result.push_back(Encoding::unicode2cp(*iter,code_page));
|
||||
}
|
||||
@ -161,9 +161,9 @@ namespace Txt
|
||||
return true;
|
||||
return NSFile::CFileBinary::Exists(filename);
|
||||
}
|
||||
void File::correctUnicode(std::list<std::wstring>& input)
|
||||
void File::correctUnicode(std::vector<std::wstring>& input)
|
||||
{
|
||||
for(std::list<std::wstring>::iterator iter = input.begin(); iter != input.end(); iter++)
|
||||
for(std::vector<std::wstring>::iterator iter = input.begin(); iter != input.end(); iter++)
|
||||
{
|
||||
const std::wstring& inputStr = *iter;
|
||||
std::wstring outputStr;
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#ifndef TXT_FILE_INCLUDE_H_
|
||||
#define TXT_FILE_INCLUDE_H_
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Txt
|
||||
@ -57,11 +57,11 @@ namespace Txt
|
||||
|
||||
const bool isValid (const std::wstring& filename) const;
|
||||
|
||||
std::list<std::wstring> m_listContent; //unicode (ранее было utf8)
|
||||
std::vector<std::wstring> m_listContent; //unicode (ранее было utf8)
|
||||
int m_listContentSize; //для вывода процентов конвертации
|
||||
int m_nEncoding;
|
||||
private:
|
||||
void correctUnicode(std::list<std::wstring>& oList);
|
||||
void correctUnicode(std::vector<std::wstring>& oList);
|
||||
bool IsUnicodeSymbol( wchar_t symbol );
|
||||
};
|
||||
} // namespace Txt
|
||||
|
||||
@ -46,9 +46,9 @@ const int TxtFile::getLinesCount()
|
||||
{
|
||||
return m_linesCount;
|
||||
}
|
||||
const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8withoutPref также
|
||||
const std::vector<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8withoutPref также
|
||||
{
|
||||
std::list<std::string> result;
|
||||
std::vector<std::string> result;
|
||||
NSFile::CFileBinary file_binary;
|
||||
|
||||
if (file_binary.OpenFile(m_path) == false) return result;
|
||||
@ -87,9 +87,9 @@ const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8without
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::list<std::wstring> TxtFile::readUnicodeFromBytes(char *file_data, long file_size)
|
||||
const std::vector<std::wstring> TxtFile::readUnicodeFromBytes(char *file_data, long file_size)
|
||||
{
|
||||
std::list<std::wstring> result;
|
||||
std::vector<std::wstring> result;
|
||||
long start_pos = 2; // skip Header
|
||||
|
||||
for (long end_pos = start_pos; end_pos + 1 < file_size; end_pos += 2)
|
||||
@ -113,9 +113,9 @@ const std::list<std::wstring> TxtFile::readUnicodeFromBytes(char *file_data, lon
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::list<std::wstring> TxtFile::readUnicode()
|
||||
const std::vector<std::wstring> TxtFile::readUnicode()
|
||||
{
|
||||
std::list<std::wstring> result;
|
||||
std::vector<std::wstring> result;
|
||||
NSFile::CFileBinary file_binary;
|
||||
|
||||
if (file_binary.OpenFile(m_path) == false ) return result;
|
||||
@ -130,9 +130,9 @@ const std::list<std::wstring> TxtFile::readUnicode()
|
||||
return readUnicodeFromBytes(file_data, file_size);
|
||||
}
|
||||
|
||||
const std::list<std::wstring> TxtFile::readBigEndian()
|
||||
const std::vector<std::wstring> TxtFile::readBigEndian()
|
||||
{
|
||||
std::list<std::wstring> result;
|
||||
std::vector<std::wstring> result;
|
||||
NSFile::CFileBinary file_binary;
|
||||
|
||||
if (file_binary.OpenFile(m_path) == false) return result;
|
||||
@ -155,9 +155,9 @@ const std::list<std::wstring> TxtFile::readBigEndian()
|
||||
}
|
||||
|
||||
|
||||
const std::list<std::string> TxtFile::readUtf8()
|
||||
const std::vector<std::string> TxtFile::readUtf8()
|
||||
{
|
||||
std::list<std::string> result;
|
||||
std::vector<std::string> result;
|
||||
NSFile::CFileBinary file_binary;
|
||||
|
||||
if (file_binary.OpenFile(m_path) == false) return result;
|
||||
@ -195,13 +195,13 @@ const std::list<std::string> TxtFile::readUtf8()
|
||||
return result;
|
||||
}
|
||||
|
||||
void TxtFile::writeAnsiOrCodePage(const std::list<std::string>& content) // === writeUtf8withoutPref также
|
||||
void TxtFile::writeAnsiOrCodePage(const std::vector<std::string>& content) // === writeUtf8withoutPref также
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(m_path))
|
||||
{
|
||||
BYTE endLine[2] = {0x0d, 0x0a};
|
||||
for (std::list<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
for (std::vector<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
{
|
||||
file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length());
|
||||
file.WriteFile(endLine, 2);
|
||||
@ -211,7 +211,7 @@ void TxtFile::writeAnsiOrCodePage(const std::list<std::string>& content) // ===
|
||||
}
|
||||
}
|
||||
|
||||
void TxtFile::writeUnicode(const std::list<std::wstring>& content)
|
||||
void TxtFile::writeUnicode(const std::vector<std::wstring>& content)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(m_path))
|
||||
@ -221,7 +221,7 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
|
||||
|
||||
file.WriteFile(Header,2);
|
||||
|
||||
for (std::list<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
for (std::vector<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
{
|
||||
const wchar_t * data = (*iter).c_str();
|
||||
int size = (*iter).length();
|
||||
@ -242,7 +242,7 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
|
||||
}
|
||||
}
|
||||
|
||||
void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
|
||||
void TxtFile::writeBigEndian(const std::vector<std::wstring>& content)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(m_path))
|
||||
@ -252,7 +252,7 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
|
||||
|
||||
file.WriteFile(Header,2);
|
||||
|
||||
for (std::list<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
for (std::vector<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
{
|
||||
if(sizeof(wchar_t) == 2)
|
||||
{
|
||||
@ -279,7 +279,7 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
|
||||
}
|
||||
}
|
||||
|
||||
void TxtFile::writeUtf8(const std::list<std::string>& content)
|
||||
void TxtFile::writeUtf8(const std::vector<std::string>& content)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(m_path))
|
||||
@ -289,7 +289,7 @@ void TxtFile::writeUtf8(const std::list<std::string>& content)
|
||||
|
||||
file.WriteFile(Header,3);
|
||||
|
||||
for (std::list<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
for (std::vector<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
|
||||
{
|
||||
file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length());
|
||||
file.WriteFile((BYTE*)EndLine, 2);
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#define UTILITY_TXT_FILE_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
|
||||
@ -43,17 +43,17 @@ class TxtFile
|
||||
public:
|
||||
TxtFile(const std::wstring & path);
|
||||
|
||||
const std::list<std::string> readAnsiOrCodePage();
|
||||
const std::list<std::wstring> readUnicodeFromBytes(char *file_data, long file_size);
|
||||
const std::list<std::wstring> readUnicode();
|
||||
//const std::list<std::wstring> readUnicodeWithOutBOM(); /// не используем
|
||||
const std::list<std::wstring> readBigEndian();
|
||||
const std::list<std::string> readUtf8();
|
||||
const std::vector<std::string> readAnsiOrCodePage();
|
||||
const std::vector<std::wstring> readUnicodeFromBytes(char *file_data, long file_size);
|
||||
const std::vector<std::wstring> readUnicode();
|
||||
//const std::vector<std::wstring> readUnicodeWithOutBOM(); /// не используем
|
||||
const std::vector<std::wstring> readBigEndian();
|
||||
const std::vector<std::string> readUtf8();
|
||||
|
||||
void writeAnsiOrCodePage (const std::list<std::string>& content);
|
||||
void writeUnicode (const std::list<std::wstring>& content);
|
||||
void writeBigEndian (const std::list<std::wstring>& content);
|
||||
void writeUtf8 (const std::list<std::string>& content);
|
||||
void writeAnsiOrCodePage (const std::vector<std::string>& content);
|
||||
void writeUnicode (const std::vector<std::wstring>& content);
|
||||
void writeBigEndian (const std::vector<std::wstring>& content);
|
||||
void writeUtf8 (const std::vector<std::string>& content);
|
||||
|
||||
const bool isUnicode();
|
||||
const bool isBigEndian();
|
||||
|
||||
@ -239,7 +239,7 @@ void CFStream::applyDelayedItems()
|
||||
seekFromBegin(it->data_place);
|
||||
write(&its->data, it->data_size);
|
||||
}
|
||||
receiver_items.erase(it++);
|
||||
receiver_items.erase(++it);
|
||||
source_items.erase(its);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ void CompoundFile::copy( int indent, std::wstring path, POLE::Storage * storageO
|
||||
|
||||
entries = storage_->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
{
|
||||
std::wstring fullname = path + *it;
|
||||
|
||||
@ -169,7 +169,7 @@ void CompoundFile::copy( int indent, std::wstring path, POLE::Storage * storageO
|
||||
}
|
||||
}
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries_dir.begin(); it != entries_dir.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_dir.begin(); it != entries_dir.end(); ++it )
|
||||
{
|
||||
std::wstring fullname = path + *it;
|
||||
|
||||
@ -178,7 +178,7 @@ void CompoundFile::copy( int indent, std::wstring path, POLE::Storage * storageO
|
||||
|
||||
//entries_files.sort();
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); ++it )
|
||||
{
|
||||
std::wstring createName = path + *it;
|
||||
std::wstring openName;
|
||||
|
||||
@ -314,7 +314,7 @@ const bool CELLTABLE::loadContent(BinProcessor& proc)
|
||||
|
||||
int CELLTABLE::serialize(std::wostream & stream)
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
it->get()->serialize(stream);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ int CELL::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
it->get()->serialize(stream);
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
|
||||
|
||||
int last_add = 0;
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
ColInfo* column_info = dynamic_cast<ColInfo*>(it->get());
|
||||
|
||||
@ -97,7 +97,7 @@ int COLUMNS::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_NODE(L"cols")
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
ColInfo* column_info = dynamic_cast<ColInfo*>(it->get());
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ int PAGESETUP::serialize(std::wostream & stream)
|
||||
footer = true;
|
||||
}
|
||||
}
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
switch((*it)->get_type())
|
||||
{
|
||||
|
||||
@ -249,7 +249,7 @@ int PIVOTVIEWEX::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"count", mapKpis.size());
|
||||
|
||||
for (std::unordered_map<std::wstring, int>::iterator it = mapKpis.begin(); it != mapKpis.end(); it++)
|
||||
for (std::unordered_map<std::wstring, int>::iterator it = mapKpis.begin(); it != mapKpis.end(); ++it)
|
||||
{
|
||||
SXAddl_SXCHierarchy_SXDKPIValue *value = NULL;
|
||||
SXAddl_SXCHierarchy_SXDKPIGoal *goal = NULL;
|
||||
@ -301,7 +301,7 @@ int PIVOTVIEWEX::serialize(std::wostream & strm)
|
||||
CP_XML_ATTR(L"caption", L"Measures");
|
||||
}
|
||||
}
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapDimensions.begin(); it != mapDimensions.end(); it++)
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapDimensions.begin(); it != mapDimensions.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"dimension")
|
||||
{
|
||||
@ -317,7 +317,7 @@ int PIVOTVIEWEX::serialize(std::wostream & strm)
|
||||
CP_XML_NODE(L"measureGroups")
|
||||
{
|
||||
CP_XML_ATTR(L"count", mapMeasures.size());
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapMeasures.begin(); it != mapMeasures.end(); it++)
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapMeasures.begin(); it != mapMeasures.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"measureGroup")
|
||||
{
|
||||
@ -335,7 +335,7 @@ int PIVOTVIEWEX::serialize(std::wostream & strm)
|
||||
{
|
||||
int i = 0;
|
||||
CP_XML_ATTR(L"count", count_maps);
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapMeasures.begin(); it != mapMeasures.end(); it++, i++)
|
||||
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapMeasures.begin(); it != mapMeasures.end(); ++it, i++)
|
||||
{
|
||||
for (size_t j = 0; j < it->second.size(); j++)
|
||||
{
|
||||
|
||||
@ -72,7 +72,7 @@ const bool SHAREDSTRINGS::loadContent(BinProcessor& proc)
|
||||
|
||||
int SHAREDSTRINGS::serialize(std::wostream & stream)
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
(*it)->serialize(stream);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ const bool STYLES::loadContent(BinProcessor& proc)
|
||||
{
|
||||
styles_count = proc.repeated<Parenthesis_STYLES_1>(0, 0);
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
|
||||
{
|
||||
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ const bool BinReaderProcessor::readChild(BaseObject& object, const bool is_manda
|
||||
if(w_object->read(reader_, parent_, false))
|
||||
{
|
||||
// Remove successfully read object from the wanted objects list
|
||||
wanted_objects.erase(it++);
|
||||
wanted_objects.erase(++it);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -823,7 +823,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
|
||||
int series_order = 0;
|
||||
|
||||
for (std::unordered_map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++)
|
||||
for (std::unordered_map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); ++it)
|
||||
{
|
||||
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get());
|
||||
|
||||
|
||||
@ -556,7 +556,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
|
||||
//from ixfe -> ifnt from xf -> arFonts
|
||||
for (std::map<int, int>::iterator it = global_info_->fonts_charsets.begin()
|
||||
; global_info_->CodePage == 0 && it != global_info_->fonts_charsets.end()
|
||||
; it++)
|
||||
; ++it)
|
||||
{
|
||||
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
|
||||
{
|
||||
|
||||
@ -195,7 +195,7 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring
|
||||
std::list<std::wstring> listStream = xls_file->storage_->entries(L"_SX_DB_CUR");
|
||||
|
||||
int last_index = 0;
|
||||
for (std::list<std::wstring>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
for (std::list<std::wstring>::iterator it = listStream.begin(); it != listStream.end(); ++it)
|
||||
{
|
||||
XLS::CFStreamPtr pivot_cache_stream = xls_file->getNamedStream(L"_SX_DB_CUR/" + *it);
|
||||
|
||||
@ -263,7 +263,7 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring
|
||||
std::list<std::wstring> msoStores = xls_file->storage_->entries(L"MsoDataStore");
|
||||
|
||||
int index = 0;
|
||||
for (std::list<std::wstring>::iterator it = msoStores.begin(); it != msoStores.end(); it++)
|
||||
for (std::list<std::wstring>::iterator it = msoStores.begin(); it != msoStores.end(); ++it)
|
||||
{
|
||||
XLS::CFStreamPtr item_stream = xls_file->getNamedStream(L"MsoDataStore/" + *it + L"/Item");
|
||||
XLS::CFStreamPtr props_stream = xls_file->getNamedStream(L"MsoDataStore/" + *it + L"/Properties");
|
||||
@ -435,7 +435,7 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
|
||||
case XLS::typeAnyObject:
|
||||
default:
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = xls_unknown->elements_.begin(); it != xls_unknown->elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = xls_unknown->elements_.begin(); it != xls_unknown->elements_.end(); ++it)
|
||||
{
|
||||
(*it)->serialize(xlsx_context->current_sheet().sheetData());
|
||||
}
|
||||
@ -469,7 +469,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
xlsx_context->end_sheet();
|
||||
}
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); ++it)
|
||||
{
|
||||
convert(it->get());
|
||||
}
|
||||
@ -782,7 +782,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
|
||||
std::vector<XLS::FillInfo> fills_out;
|
||||
fills_out.resize(xls_global_info->fill_x_ids.size());
|
||||
|
||||
for (mapFillInfo::iterator it = xls_global_info->fill_x_ids.begin(); it != xls_global_info->fill_x_ids.end(); it++)
|
||||
for (mapFillInfo::iterator it = xls_global_info->fill_x_ids.begin(); it != xls_global_info->fill_x_ids.end(); ++it)
|
||||
{
|
||||
fills_out[it->second] = it->first;
|
||||
}
|
||||
@ -798,7 +798,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
|
||||
std::vector<XLS::BorderInfo> borders_out;
|
||||
borders_out.resize(xls_global_info->border_x_ids.size());
|
||||
|
||||
for (mapBorderInfo::iterator it = xls_global_info->border_x_ids.begin(); it != xls_global_info->border_x_ids.end(); it++)
|
||||
for (mapBorderInfo::iterator it = xls_global_info->border_x_ids.begin(); it != xls_global_info->border_x_ids.end(); ++it)
|
||||
{
|
||||
borders_out[it->second] = it->first;
|
||||
}
|
||||
@ -2095,7 +2095,7 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
|
||||
CP_XML_ATTR(L"xmlns", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
if (sharedstrings)
|
||||
{
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = sharedstrings->elements_.begin(); it != sharedstrings->elements_.end(); it++)
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = sharedstrings->elements_.begin(); it != sharedstrings->elements_.end(); ++it)
|
||||
{
|
||||
(*it)->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ void xlsx_conversion_context::end_document()
|
||||
std::wstringstream workbook_content;
|
||||
|
||||
//for (size_t i = 0; i < sheets_.size(); i++) нужно по id
|
||||
for (std::map<int, int>::iterator it = sheets_map_.begin(); it != sheets_map_.end(); it++)
|
||||
for (std::map<int, int>::iterator it = sheets_map_.begin(); it != sheets_map_.end(); ++it)
|
||||
{
|
||||
int i = it->second;
|
||||
|
||||
@ -350,11 +350,11 @@ void xlsx_conversion_context::end_document()
|
||||
}
|
||||
output_document_->get_xl_files().set_connections( package::simple_element::create(L"connections.xml", strm.str()) );
|
||||
}
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = query_tables_.begin(); it != query_tables_.end(); it++)
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = query_tables_.begin(); it != query_tables_.end(); ++it)
|
||||
{
|
||||
output_document_->get_xl_files().add_query_table( package::simple_element::create(it->first, it->second) );
|
||||
}
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = control_props_.begin(); it != control_props_.end(); it++)
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = control_props_.begin(); it != control_props_.end(); ++it)
|
||||
{
|
||||
output_document_->get_xl_files().add_control_props( package::simple_element::create(it->first, it->second) );
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
}
|
||||
int i = 0;
|
||||
for (std::unordered_map<std::wstring, std::wstring>::iterator it = impl_->caches_[index].externals_.begin();
|
||||
it != impl_->caches_[index].externals_.end(); it++, i++)
|
||||
it != impl_->caches_[index].externals_.end(); ++it, i++)
|
||||
{
|
||||
Rels.add(relationship(L"extId" + std::to_wstring(i + 1),
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
|
||||
|
||||
@ -111,9 +111,6 @@ HEADERS += docxformatlib.h \
|
||||
../Source/DocxFormat/Drawing/DrawingBody.h \
|
||||
../Source/DocxFormat/Drawing/DrawingExt.h \
|
||||
../Source/DocxFormat/External/External.h \
|
||||
../Source/DocxFormat/External/ExternalAudio.h \
|
||||
../Source/DocxFormat/External/ExternalImage.h \
|
||||
../Source/DocxFormat/External/ExternalVideo.h \
|
||||
../Source/DocxFormat/External/HyperLink.h \
|
||||
../Source/DocxFormat/Logic/AlternateContent.h \
|
||||
../Source/DocxFormat/Logic/Annotations.h \
|
||||
|
||||
@ -156,12 +156,12 @@ namespace OOX
|
||||
return sRes;
|
||||
}
|
||||
private:
|
||||
std::wstring getTextArr(const std::list<WritingElement* > & arrItems, bool& bFirstPar) const
|
||||
std::wstring getTextArr(const std::vector<WritingElement* > & arrItems, bool& bFirstPar) const
|
||||
{
|
||||
std::wstring sRes;
|
||||
for ( std::list<WritingElement *>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
|
||||
for ( size_t i = 0; i < arrItems.size(); ++i)
|
||||
{
|
||||
WritingElement* item = *it;
|
||||
WritingElement* item = arrItems[i];
|
||||
if (item == NULL) continue;
|
||||
|
||||
switch(item->getType())
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
#include "FileType.h"
|
||||
#include "WritingElement.h"
|
||||
#include <map>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
|
||||
namespace OOX
|
||||
@ -278,11 +278,11 @@ namespace OOX
|
||||
{
|
||||
if (pSrcContentTypes == NULL) return;
|
||||
|
||||
for (std::map<std::wstring, ContentTypes::CDefault>::iterator it = pSrcContentTypes->m_mapDefaults.begin(); it != pSrcContentTypes->m_mapDefaults.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, ContentTypes::CDefault>::iterator it = pSrcContentTypes->m_mapDefaults.begin(); it != pSrcContentTypes->m_mapDefaults.end(); ++it)
|
||||
{
|
||||
AddDefault(it->first);
|
||||
}
|
||||
for (std::map<std::wstring, ContentTypes::COverride>::iterator it = pSrcContentTypes->m_mapOverrides.begin(); it != pSrcContentTypes->m_mapOverrides.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, ContentTypes::COverride>::iterator it = pSrcContentTypes->m_mapOverrides.begin(); it != pSrcContentTypes->m_mapOverrides.end(); ++it)
|
||||
{
|
||||
if (m_mapOverrides.find(it->first) == m_mapOverrides.end())
|
||||
{
|
||||
@ -294,12 +294,12 @@ namespace OOX
|
||||
{
|
||||
std::wstring sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
|
||||
|
||||
for (std::map<std::wstring, ContentTypes::CDefault>::const_iterator it = m_mapDefaults.begin(); it != m_mapDefaults.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, ContentTypes::CDefault>::const_iterator it = m_mapDefaults.begin(); it != m_mapDefaults.end(); ++it)
|
||||
{
|
||||
sXml += it->second.toXML();
|
||||
}
|
||||
|
||||
for (std::map<std::wstring, ContentTypes::COverride>::const_iterator it = m_mapOverrides.begin(); it != m_mapOverrides.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, ContentTypes::COverride>::const_iterator it = m_mapOverrides.begin(); it != m_mapOverrides.end(); ++it)
|
||||
{
|
||||
sXml += it->second.toXML();
|
||||
}
|
||||
@ -371,8 +371,8 @@ namespace OOX
|
||||
|
||||
public:
|
||||
|
||||
std::map<std::wstring, ContentTypes::CDefault> m_mapDefaults;
|
||||
std::map<std::wstring, ContentTypes::COverride> m_mapOverrides;
|
||||
boost::unordered_map<std::wstring, ContentTypes::CDefault> m_mapDefaults;
|
||||
boost::unordered_map<std::wstring, ContentTypes::COverride> m_mapOverrides;
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
|
||||
@ -484,11 +484,11 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
sXml += _T("<w:body>");
|
||||
|
||||
for ( std::list<WritingElement *>::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
|
||||
for ( size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( *it )
|
||||
if ( m_arrItems[i] )
|
||||
{
|
||||
sXml += (*it)->toXML();
|
||||
sXml += m_arrItems[i]->toXML();
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,10 +521,9 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
}
|
||||
void ClearItems()
|
||||
{
|
||||
for ( std::list<WritingElement *>::iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
|
||||
for ( size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( *it )delete *it;
|
||||
*it = NULL;
|
||||
if ( m_arrItems[i] )delete m_arrItems[i];
|
||||
}
|
||||
m_arrItems.clear();
|
||||
}
|
||||
@ -656,7 +655,7 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
nullable<OOX::Logic::CSectionProperty> m_oSectPr;
|
||||
nullable<OOX::Logic::CBackground > m_oBackground;
|
||||
|
||||
std::list<WritingElement *> m_arrItems;
|
||||
std::vector<WritingElement *> m_arrItems;
|
||||
std::vector<std::wstring> m_arrShapeTypes;
|
||||
|
||||
};
|
||||
|
||||
@ -64,8 +64,6 @@ namespace OOX
|
||||
|
||||
m_arrEndnote.clear();
|
||||
}
|
||||
public:
|
||||
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
@ -118,8 +116,6 @@ namespace OOX
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oPath );
|
||||
IFileContainer::Write( oPath, oDirectory, oContent );
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::EndNote;
|
||||
@ -133,8 +129,6 @@ namespace OOX
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
OOX::CFtnEdn *Find(const OOX::Logic::CEndnoteReference& oReference) const
|
||||
{
|
||||
if ( !oReference.m_oId.IsInit() )
|
||||
@ -148,7 +142,7 @@ namespace OOX
|
||||
|
||||
return NULL;
|
||||
}
|
||||
void Add(OOX::CFtnEdn* pEndnote)
|
||||
void Add(OOX::CFtnEdn* pEndnote)
|
||||
{
|
||||
m_arrEndnote.push_back( pEndnote );
|
||||
}
|
||||
@ -157,10 +151,9 @@ namespace OOX
|
||||
return (unsigned int)m_arrEndnote.size();
|
||||
}
|
||||
|
||||
public:
|
||||
CPath m_oReadPath;
|
||||
std::vector<OOX::CFtnEdn*> m_arrEndnote;
|
||||
std::vector<std::wstring> m_arrShapeTypes;
|
||||
std::vector<OOX::CFtnEdn*> m_arrEndnote;
|
||||
std::vector<std::wstring> m_arrShapeTypes;
|
||||
};
|
||||
} // namespace OOX
|
||||
#endif // OOX_ENDNOTE_INCLUDE_H_
|
||||
|
||||
@ -63,7 +63,11 @@ namespace OOX
|
||||
{
|
||||
return m_uri;
|
||||
}
|
||||
|
||||
void set_Uri(CPath & file_path)
|
||||
{
|
||||
m_uri = file_path;
|
||||
m_sOutputFilename = file_path.GetFilename();
|
||||
}
|
||||
protected:
|
||||
CPath m_uri;
|
||||
};
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_EXTERNALAUDIO_INCLUDE_H_
|
||||
#define OOX_EXTERNALAUDIO_INCLUDE_H_
|
||||
|
||||
#include "External.h"
|
||||
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class ExternalAudio : public External
|
||||
{
|
||||
public:
|
||||
ExternalAudio()
|
||||
{
|
||||
}
|
||||
ExternalAudio(const CPath& uri)
|
||||
{
|
||||
read(uri);
|
||||
}
|
||||
~ExternalAudio()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return FileTypes::ExternalAudio;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_EXTERNALAUDIO_INCLUDE_H_
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_EXTERNALIMAGE_INCLUDE_H_
|
||||
#define OOX_EXTERNALIMAGE_INCLUDE_H_
|
||||
|
||||
#include "External.h"
|
||||
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class ExternalImage : public External
|
||||
{
|
||||
public:
|
||||
ExternalImage()
|
||||
{
|
||||
}
|
||||
ExternalImage(const CPath& uri)
|
||||
{
|
||||
read(uri);
|
||||
}
|
||||
~ExternalImage()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return FileTypes::ExternalImage;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_EXTERNALIMAGE_INCLUDE_H_
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user