Commit 0ed3f740 authored by ElenaSubbotina's avatar ElenaSubbotina

read/write docm

parent af2e76ae
...@@ -40,11 +40,11 @@ namespace Writers ...@@ -40,11 +40,11 @@ namespace Writers
class DocumentWriter : public ContentWriter class DocumentWriter : public ContentWriter
{ {
XmlUtils::CStringWriter m_oWriter; XmlUtils::CStringWriter m_oWriter;
HeaderFooterWriter& m_oHeaderFooterWriter; HeaderFooterWriter& m_oHeaderFooterWriter;
public: public:
std::wstring m_sDir; std::wstring m_sDir;
public:
DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter) DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
{ {
} }
void Write() void Write()
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
*/ */
#ifndef FILE_WRITER #ifndef FILE_WRITER
#define FILE_WRITER #define FILE_WRITER
#include "../../DesktopEditor/common/Path.h" #include "../../DesktopEditor/common/Path.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "NumberingWriter.h" #include "NumberingWriter.h"
#include "fontTableWriter.h" #include "fontTableWriter.h"
...@@ -75,6 +77,8 @@ namespace Writers ...@@ -75,6 +77,8 @@ namespace Writers
DocumentRelsWriter m_oDocumentRelsWriter; DocumentRelsWriter m_oDocumentRelsWriter;
WebSettingsWriter m_oWebSettingsWriter; WebSettingsWriter m_oWebSettingsWriter;
DefaultThemeWriter m_oTheme; DefaultThemeWriter m_oTheme;
smart_ptr<OOX::VbaProject> m_pVbaProject;
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter; NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
bool m_bSaveChartAsImg; bool m_bSaveChartAsImg;
......
...@@ -34,6 +34,30 @@ ...@@ -34,6 +34,30 @@
namespace BinDocxRW { namespace BinDocxRW {
int Binary_VbaProjectTableReader::Read()
{
return ReadTable(&Binary_VbaProjectTableReader::ReadContent, this);
}
int Binary_VbaProjectTableReader::ReadContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerVbaProjectTypes::Name == type )
{
std::wstring file_name = m_oBufferedStream.GetString4(length);
OOX::CPath inputPath = m_oBufferedStream.m_strFolder + FILE_SEPARATOR_STR + L"media" + FILE_SEPARATOR_STR + file_name;
OOX::CPath outputPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"vbaProject.bin";
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
m_oFileWriter.m_pVbaProject->set_filename(outputPath.GetPath());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
//-------------------------------------------------------------------------------------
Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments) Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments)
{ {
} }
...@@ -93,9 +117,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes ...@@ -93,9 +117,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments); Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader); res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + _T("_rels")+ FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels"); FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath()); m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
} }
......
...@@ -273,6 +273,21 @@ private: ...@@ -273,6 +273,21 @@ private:
return res; return res;
} }
}; };
class Binary_VbaProjectTableReader : public Binary_CommonReader<Binary_VbaProjectTableReader>
{
Writers::FileWriter& m_oFileWriter;
public:
Binary_VbaProjectTableReader (NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Read ();
int ReadContent (BYTE type, long length, void* poResult);
};
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader> class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
{ {
Writers::FileWriter& m_oFileWriter; Writers::FileWriter& m_oFileWriter;
...@@ -282,12 +297,12 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe ...@@ -282,12 +297,12 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe
int nCurHeaderType; int nCurHeaderType;
public: public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter; Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public:
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments); Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
int Read(); int Read();
int ReadHdrFtrContent(BYTE type, long length, void* poResult); int ReadHdrFtrContent (BYTE type, long length, void* poResult);
int ReadHdrFtrFEO(BYTE type, long length, void* poResult); int ReadHdrFtrFEO (BYTE type, long length, void* poResult);
int ReadHdrFtrItem(BYTE type, long length, void* poResult); int ReadHdrFtrItem (BYTE type, long length, void* poResult);
int ReadHdrFtrItemContent(BYTE type, long length, void* poResult); int ReadHdrFtrItemContent(BYTE type, long length, void* poResult);
}; };
class Binary_rPrReader : public Binary_CommonReader<Binary_rPrReader> class Binary_rPrReader : public Binary_CommonReader<Binary_rPrReader>
...@@ -551,7 +566,7 @@ public: ...@@ -551,7 +566,7 @@ public:
std::wstring strXml; std::wstring strXml;
HRESULT hRes = m_oFileWriter.m_pDrawingConverter->GetRecordXml(nCurPos, length, XMLWRITER_RECORD_TYPE_TEXT_FILL, XMLWRITER_DOC_TYPE_WORDART, strXml); HRESULT hRes = m_oFileWriter.m_pDrawingConverter->GetRecordXml(nCurPos, length, XMLWRITER_RECORD_TYPE_TEXT_FILL, XMLWRITER_DOC_TYPE_WORDART, strXml);
if (S_OK == hRes) if (S_OK == hRes)
orPr->Fill = _T("<w14:textFill>") + strXml + _T("</w14:textFill>"); orPr->Fill = L"<w14:textFill>" + strXml + L"</w14:textFill>";
m_oBufferedStream.Seek(nCurPos + length); m_oBufferedStream.Seek(nCurPos + length);
} }
} }
...@@ -560,35 +575,35 @@ public: ...@@ -560,35 +575,35 @@ public:
{ {
TrackRevision oDel; TrackRevision oDel;
oBinary_CommonReader2.ReadTrackRevision(length, &oDel); oBinary_CommonReader2.ReadTrackRevision(length, &oDel);
orPr->Del = oDel.ToString(_T("w:del")); orPr->Del = oDel.ToString(L"w:del");
} }
break; break;
case c_oSerProp_rPrType::Ins: case c_oSerProp_rPrType::Ins:
{ {
TrackRevision oIns; TrackRevision oIns;
oBinary_CommonReader2.ReadTrackRevision(length, &oIns); oBinary_CommonReader2.ReadTrackRevision(length, &oIns);
orPr->Ins = oIns.ToString(_T("w:ins")); orPr->Ins = oIns.ToString(L"w:ins");
} }
break; break;
case c_oSerProp_rPrType::MoveFrom: case c_oSerProp_rPrType::MoveFrom:
{ {
TrackRevision oMoveFrom; TrackRevision oMoveFrom;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom); oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom")); orPr->MoveFrom = oMoveFrom.ToString(L"w:moveFrom");
} }
break; break;
case c_oSerProp_rPrType::MoveTo: case c_oSerProp_rPrType::MoveTo:
{ {
TrackRevision oMoveTo; TrackRevision oMoveTo;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo); oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo")); orPr->MoveTo = oMoveTo.ToString(L"w:moveTo");
} }
break; break;
case c_oSerProp_rPrType::rPrChange: case c_oSerProp_rPrType::rPrChange:
{ {
TrackRevision oRPrChange; TrackRevision oRPrChange;
res = Read1(length, &Binary_rPrReader::ReadrPrChange, this, &oRPrChange); res = Read1(length, &Binary_rPrReader::ReadrPrChange, this, &oRPrChange);
orPr->rPrChange = oRPrChange.ToString(_T("w:rPrChange")); orPr->rPrChange = oRPrChange.ToString(L"w:rPrChange");
} }
break; break;
default: default:
...@@ -647,9 +662,9 @@ public: ...@@ -647,9 +662,9 @@ public:
{ {
BYTE contextualSpacing = m_oBufferedStream.GetUChar(); BYTE contextualSpacing = m_oBufferedStream.GetUChar();
if(0 != contextualSpacing) if(0 != contextualSpacing)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"true\"/>"))); pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"true\"/>"));
else if(false == bDoNotWriteNullProp) else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"false\"/>"))); pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"false\"/>"));
}break; }break;
case c_oSerProp_pPrType::Ind: case c_oSerProp_pPrType::Ind:
{ {
...@@ -657,9 +672,9 @@ public: ...@@ -657,9 +672,9 @@ public:
res = Read2(length, &Binary_pPrReader::ReadInd, this, &oTempWriter); res = Read2(length, &Binary_pPrReader::ReadInd, this, &oTempWriter);
if(oTempWriter.GetCurSize() > 0) if(oTempWriter.GetCurSize() > 0)
{ {
pCStringWriter->WriteString(std::wstring(_T("<w:ind"))); pCStringWriter->WriteString(std::wstring(L"<w:ind"));
pCStringWriter->Write(oTempWriter); pCStringWriter->Write(oTempWriter);
pCStringWriter->WriteString(std::wstring(_T("/>"))); pCStringWriter->WriteString(std::wstring(L"/>"));
} }
break; break;
} }
...@@ -668,35 +683,35 @@ public: ...@@ -668,35 +683,35 @@ public:
BYTE jc = m_oBufferedStream.GetUChar(); BYTE jc = m_oBufferedStream.GetUChar();
switch(jc) switch(jc)
{ {
case align_Right: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"right\" />")));break; case align_Right: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"right\" />"));break;
case align_Left: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"left\" />")));break; case align_Left: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"left\" />"));break;
case align_Center: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"center\" />")));break; case align_Center: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"center\" />"));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"both\" />")));break; case align_Justify: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"both\" />"));break;
} }
}break; }break;
case c_oSerProp_pPrType::KeepLines: case c_oSerProp_pPrType::KeepLines:
{ {
BYTE KeepLines = m_oBufferedStream.GetUChar(); BYTE KeepLines = m_oBufferedStream.GetUChar();
if(0 != KeepLines) if(0 != KeepLines)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines/>"))); pCStringWriter->WriteString(std::wstring(L"<w:keepLines/>"));
else if(false == bDoNotWriteNullProp) else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines w:val=\"false\"/>"))); pCStringWriter->WriteString(std::wstring(L"<w:keepLines w:val=\"false\"/>"));
}break; }break;
case c_oSerProp_pPrType::KeepNext: case c_oSerProp_pPrType::KeepNext:
{ {
BYTE KeepNext = m_oBufferedStream.GetUChar(); BYTE KeepNext = m_oBufferedStream.GetUChar();
if(0 != KeepNext) if(0 != KeepNext)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext/>"))); pCStringWriter->WriteString(std::wstring(L"<w:keepNext/>"));
else if(false == bDoNotWriteNullProp) else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext w:val=\"false\"/>"))); pCStringWriter->WriteString(std::wstring(L"<w:keepNext w:val=\"false\"/>"));
}break; }break;
case c_oSerProp_pPrType::PageBreakBefore: case c_oSerProp_pPrType::PageBreakBefore:
{ {
BYTE pageBreakBefore = m_oBufferedStream.GetUChar(); BYTE pageBreakBefore = m_oBufferedStream.GetUChar();
if(0 != pageBreakBefore) if(0 != pageBreakBefore)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore/>"))); pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore/>"));
else if(false == bDoNotWriteNullProp) else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore w:val=\"false\"/>"))); pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore w:val=\"false\"/>"));
break; break;
} }
case c_oSerProp_pPrType::Spacing: case c_oSerProp_pPrType::Spacing:
...@@ -705,7 +720,7 @@ public: ...@@ -705,7 +720,7 @@ public:
res = Read2(length, &Binary_pPrReader::ReadSpacing, this, &oSpacing); res = Read2(length, &Binary_pPrReader::ReadSpacing, this, &oSpacing);
if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto) if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
{ {
pCStringWriter->WriteString(std::wstring(_T("<w:spacing"))); pCStringWriter->WriteString(std::wstring(L"<w:spacing"));
BYTE bLineRule = linerule_Auto; BYTE bLineRule = linerule_Auto;
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line //проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
if(oSpacing.bLine) if(oSpacing.bLine)
...@@ -745,9 +760,9 @@ public: ...@@ -745,9 +760,9 @@ public:
if(oSpacing.bAfterAuto) if(oSpacing.bAfterAuto)
{ {
if(true == oSpacing.AfterAuto) if(true == oSpacing.AfterAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"1\""))); pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"1\""));
else else
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"0\""))); pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"0\""));
} }
if(oSpacing.bBefore) if(oSpacing.bBefore)
{ {
...@@ -758,11 +773,11 @@ public: ...@@ -758,11 +773,11 @@ public:
if(oSpacing.bBeforeAuto) if(oSpacing.bBeforeAuto)
{ {
if(true == oSpacing.BeforeAuto) if(true == oSpacing.BeforeAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"1\""))); pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"1\""));
else else
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"0\""))); pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"0\""));
} }
pCStringWriter->WriteString(std::wstring(_T("/>"))); pCStringWriter->WriteString(std::wstring(L"/>"));
} }
break; break;
} }
...@@ -776,7 +791,7 @@ public: ...@@ -776,7 +791,7 @@ public:
} }
else else
{ {
std::wstring sShd(_T("<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>")); std::wstring sShd(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>");
pCStringWriter->WriteString(sShd); pCStringWriter->WriteString(sShd);
} }
break; break;
...@@ -787,10 +802,10 @@ public: ...@@ -787,10 +802,10 @@ public:
if(0 != WidowControl) if(0 != WidowControl)
{ {
if(false == bDoNotWriteNullProp) if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl/>"))); pCStringWriter->WriteString(std::wstring(L"<w:widowControl/>"));
} }
else else
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl w:val=\"off\" />"))); pCStringWriter->WriteString(std::wstring(L"<w:widowControl w:val=\"off\" />"));
break; break;
} }
case c_oSerProp_pPrType::Tab: case c_oSerProp_pPrType::Tab:
...@@ -800,7 +815,7 @@ public: ...@@ -800,7 +815,7 @@ public:
size_t nLen = oTabs.m_aTabs.size(); size_t nLen = oTabs.m_aTabs.size();
if(nLen > 0) if(nLen > 0)
{ {
pCStringWriter->WriteString(std::wstring(_T("<w:tabs>"))); pCStringWriter->WriteString(std::wstring(L"<w:tabs>"));
for(size_t i = 0; i < nLen; ++i) for(size_t i = 0; i < nLen; ++i)
{ {
Tab& oTab = oTabs.m_aTabs[i]; Tab& oTab = oTabs.m_aTabs[i];
...@@ -808,14 +823,14 @@ public: ...@@ -808,14 +823,14 @@ public:
std::wstring sVal; std::wstring sVal;
switch(oTab.Val) switch(oTab.Val)
{ {
case g_tabtype_right: sVal=_T("right"); break; case g_tabtype_right: sVal = L"right"; break;
case g_tabtype_center: sVal=_T("center"); break; case g_tabtype_center: sVal = L"center"; break;
case g_tabtype_clear: sVal=_T("clear"); break; case g_tabtype_clear: sVal = L"clear"; break;
default: sVal=_T("left"); break; default: sVal = L"left"; break;
} }
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"/>"); pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"/>");
} }
pCStringWriter->WriteString(std::wstring(_T("</w:tabs>"))); pCStringWriter->WriteString(std::wstring(L"</w:tabs>"));
} }
}break; }break;
case c_oSerProp_pPrType::ParaStyle: case c_oSerProp_pPrType::ParaStyle:
...@@ -826,9 +841,9 @@ public: ...@@ -826,9 +841,9 @@ public:
}break; }break;
case c_oSerProp_pPrType::numPr: case c_oSerProp_pPrType::numPr:
{ {
pCStringWriter->WriteString(std::wstring(_T("<w:numPr>"))); pCStringWriter->WriteString(std::wstring(L"<w:numPr>"));
res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult); res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:numPr>"))); pCStringWriter->WriteString(std::wstring(L"</w:numPr>"));
}break; }break;
case c_oSerProp_pPrType::pPr_rPr: case c_oSerProp_pPrType::pPr_rPr:
{ {
...@@ -2917,7 +2932,8 @@ class Binary_OtherTableReader : public Binary_CommonReader<Binary_OtherTableRead ...@@ -2917,7 +2932,8 @@ class Binary_OtherTableReader : public Binary_CommonReader<Binary_OtherTableRead
Writers::FileWriter& m_oFileWriter; Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir; std::wstring m_sFileInDir;
public: public:
Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):m_sFileInDir(sFileInDir),Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter) Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: m_sFileInDir(sFileInDir), Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{ {
} }
int Read() int Read()
...@@ -7022,13 +7038,13 @@ public: ...@@ -7022,13 +7038,13 @@ public:
{ {
if(false == m_oFileWriter.m_bSaveChartAsImg) if(false == m_oFileWriter.m_bSaveChartAsImg)
{ {
OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("charts"); OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"charts";
OOX::CSystemUtility::CreateDirectories(pathChartsDir.GetPath()); OOX::CSystemUtility::CreateDirectories(pathChartsDir.GetPath());
OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + FILE_SEPARATOR_STR + _T("_rels"); OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + FILE_SEPARATOR_STR + L"_rels";
OOX::CSystemUtility::CreateDirectories(pathChartsRelsDir.GetPath()); OOX::CSystemUtility::CreateDirectories(pathChartsRelsDir.GetPath());
OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("embeddings"); OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"embeddings";
OOX::CSystemUtility::CreateDirectories(pathChartsWorksheetDir.GetPath()); OOX::CSystemUtility::CreateDirectories(pathChartsWorksheetDir.GetPath());
int nativeDocumentType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType; int nativeDocumentType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType;
...@@ -7922,9 +7938,9 @@ public: ...@@ -7922,9 +7938,9 @@ public:
int res = ReadTable(&Binary_NotesTableReader::ReadNotes, this, &oBinary_DocumentTableReader); int res = ReadTable(&Binary_NotesTableReader::ReadNotes, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + _T("_rels")+ FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + sFilename + _T(".rels"); FILE_SEPARATOR_STR + sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath()); m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
return res; return res;
...@@ -7961,33 +7977,33 @@ public: ...@@ -7961,33 +7977,33 @@ public:
XmlUtils::CStringWriter& writer = pBinary_DocumentTableReader->m_oDocumentWriter.m_oContent; XmlUtils::CStringWriter& writer = pBinary_DocumentTableReader->m_oDocumentWriter.m_oContent;
if(m_bIsFootnote) if(m_bIsFootnote)
{ {
writer.WriteString(_T("<w:footnote")); writer.WriteString(L"<w:footnote");
} }
else else
{ {
writer.WriteString(_T("<w:endnote")); writer.WriteString(L"<w:endnote");
} }
if(m_oType.IsInit()) if(m_oType.IsInit())
{ {
writer.WriteString(_T(" w:type=\"")); writer.WriteString(L" w:type=\"");
writer.WriteString(m_oType->ToString()); writer.WriteString(m_oType->ToString());
writer.WriteString(_T("\"")); writer.WriteString(L"\"");
} }
if(m_oId.IsInit()) if(m_oId.IsInit())
{ {
writer.WriteString(_T(" w:id=\"")); writer.WriteString(L" w:id=\"");
writer.WriteString(m_oId->ToString()); writer.WriteString(m_oId->ToString());
writer.WriteString(_T("\"")); writer.WriteString(L"\"");
} }
writer.WriteString(_T(">")); writer.WriteString(L">");
res = Read1(length, &Binary_NotesTableReader::ReadNoteContent, this, poResult); res = Read1(length, &Binary_NotesTableReader::ReadNoteContent, this, poResult);
if(m_bIsFootnote) if(m_bIsFootnote)
{ {
writer.WriteString(_T("</w:footnote>")); writer.WriteString(L"</w:footnote>");
} }
else else
{ {
writer.WriteString(_T("</w:endnote>")); writer.WriteString(L"</w:endnote>");
} }
} }
else else
...@@ -8087,8 +8103,8 @@ public: ...@@ -8087,8 +8103,8 @@ public:
} }
else else
{ {
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<w:defaultTabStop w:val=\"708\"/>")); m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"708\"/>");
std::wstring sClrMap(_T("<w:clrSchemeMapping w:bg1=\"light1\" w:t1=\"dark1\" w:bg2=\"light2\" w:t2=\"dark2\" w:accent1=\"accent1\" w:accent2=\"accent2\" w:accent3=\"accent3\" w:accent4=\"accent4\" w:accent5=\"accent5\" w:accent6=\"accent6\" w:hyperlink=\"hyperlink\" w:followedHyperlink=\"followedHyperlink\"/>")); std::wstring sClrMap(L"<w:clrSchemeMapping w:bg1=\"light1\" w:t1=\"dark1\" w:bg2=\"light2\" w:t2=\"dark2\" w:accent1=\"accent1\" w:accent2=\"accent2\" w:accent3=\"accent3\" w:accent4=\"accent4\" w:accent5=\"accent5\" w:accent6=\"accent6\" w:hyperlink=\"hyperlink\" w:followedHyperlink=\"followedHyperlink\"/>");
m_oFileWriter.m_oSettingWriter.AddSetting(sClrMap); m_oFileWriter.m_oSettingWriter.AddSetting(sClrMap);
m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap); m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap);
} }
...@@ -8140,9 +8156,12 @@ public: ...@@ -8140,9 +8156,12 @@ public:
case c_oSerTableTypes::Endnotes: case c_oSerTableTypes::Endnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read(); res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
break; break;
case c_oSerTableTypes::VbaProject:
res = Binary_VbaProjectTableReader(m_oBufferedStream, m_oFileWriter).Read();
break;
//Comments должны читаться раньше чем c_oSerTableTypes::Document //Comments должны читаться раньше чем c_oSerTableTypes::Document
//case c_oSerTableTypes::Comments: //case c_oSerTableTypes::Comments
// res = oBinary_CommentsTableReader.Read(); // res = oBinary_CommentsTableReader.Read();
// break; // break;
//case c_oSerTableTypes::Other: //case c_oSerTableTypes::Other:
...@@ -8165,7 +8184,18 @@ public: ...@@ -8165,7 +8184,18 @@ public:
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", L"fontTable.xml", L"", &stamdartRId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", L"fontTable.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", L"theme/theme1.xml",L"", &stamdartRId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", L"theme/theme1.xml",L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word", L"document.xml"); if (m_oFileWriter.m_pVbaProject.IsInit())
{
//m_oFileWriter.m_pVbaProject->write();
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2006/relationships/vbaProject", L"vbaProject.bin", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.ms-word.document.macroEnabled.main+xml", L"/word", L"document.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.ms-office.vbaProject", L"/word", L"vbaProject.bin");
}
else
{
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word", L"document.xml");
}
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", L"/word", L"styles.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", L"/word", L"styles.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", L"/word", L"settings.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", L"/word", L"settings.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", L"/word", L"webSettings.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", L"/word", L"webSettings.xml");
...@@ -8175,19 +8205,19 @@ public: ...@@ -8175,19 +8205,19 @@ public:
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty()) if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering")), std::wstring(_T("numbering.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", L"numbering.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml");
} }
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty()) if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes")), std::wstring(_T("footnotes.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", L"footnotes.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml");
} }
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty()) if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes")), std::wstring(_T("endnotes.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", L"endnotes.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml");
} }
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i) for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i)
...@@ -8196,7 +8226,7 @@ public: ...@@ -8196,7 +8226,7 @@ public:
if(false == pHeader->IsEmpty()) if(false == pHeader->IsEmpty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header")), pHeader->m_sFilename, std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", pHeader->m_sFilename, std::wstring(), &rId);
pHeader->rId = L"rId" + std::to_wstring( rId ); pHeader->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", L"/word", pHeader->m_sFilename); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", L"/word", pHeader->m_sFilename);
...@@ -8208,7 +8238,7 @@ public: ...@@ -8208,7 +8238,7 @@ public:
if(false == pFooter->IsEmpty()) if(false == pFooter->IsEmpty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer")), pFooter->m_sFilename, std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", pFooter->m_sFilename, std::wstring(), &rId);
pFooter->rId = L"rId" + std::to_wstring( rId ); pFooter->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename);
...@@ -8216,9 +8246,9 @@ public: ...@@ -8216,9 +8246,9 @@ public:
} }
res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read(); res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read();
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"
+ FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + L"_rels"
+ FILE_SEPARATOR_STR + _T("document.xml.rels"); + FILE_SEPARATOR_STR + L"document.xml.rels";
CComments& oComments= oBinary_CommentsTableReader.m_oComments; CComments& oComments= oBinary_CommentsTableReader.m_oComments;
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter; Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
...@@ -8232,19 +8262,19 @@ public: ...@@ -8232,19 +8262,19 @@ public:
if(false == oCommentsWriter.m_sComment.empty()) if(false == oCommentsWriter.m_sComment.empty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments")), std::wstring(_T("comments.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
} }
if(false == oCommentsWriter.m_sCommentExt.empty()) if(false == oCommentsWriter.m_sCommentExt.empty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/commentsExtended")), std::wstring(_T("commentsExtended.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
} }
if(false == oCommentsWriter.m_sPeople.empty()) if(false == oCommentsWriter.m_sPeople.empty())
{ {
long rId; long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/people")), std::wstring(_T("people.xml")), std::wstring(), &rId); m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml"); m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
} }
......
...@@ -142,19 +142,20 @@ extern int g_nCurFormatVersion; ...@@ -142,19 +142,20 @@ extern int g_nCurFormatVersion;
};} };}
namespace c_oSerTableTypes{enum c_oSerTableTypes namespace c_oSerTableTypes{enum c_oSerTableTypes
{ {
Signature = 0, Signature = 0,
Info = 1, Info = 1,
Media = 2, Media = 2,
Numbering = 3, Numbering = 3,
HdrFtr = 4, HdrFtr = 4,
Style = 5, Style = 5,
Document = 6, Document = 6,
Other = 7, Other = 7,
Comments = 8, Comments = 8,
Settings = 9, Settings = 9,
Footnotes = 10, Footnotes = 10,
Endnotes = 11, Endnotes = 11,
Background Background = 12,
VbaProject = 13
};} };}
namespace c_oSerSigTypes{enum c_oSerSigTypes namespace c_oSerSigTypes{enum c_oSerSigTypes
{ {
...@@ -203,10 +204,10 @@ extern int g_nCurFormatVersion; ...@@ -203,10 +204,10 @@ extern int g_nCurFormatVersion;
};} };}
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
{ {
ImageMap = 0, ImageMap = 0,
ImageMap_Src = 1, ImageMap_Src = 1,
EmbeddedFonts = 2, EmbeddedFonts = 2,
DocxTheme = 3 DocxTheme = 3
};} };}
namespace c_oSerFontsTypes{enum c_oSerFontsTypes namespace c_oSerFontsTypes{enum c_oSerFontsTypes
{ {
...@@ -521,6 +522,10 @@ extern int g_nCurFormatVersion; ...@@ -521,6 +522,10 @@ extern int g_nCurFormatVersion;
endnoteReference = 27, endnoteReference = 27,
arPr = 28 arPr = 28
};} };}
namespace c_oSerVbaProjectTypes{enum c_oSerVbaProjectType
{
Name = 0
};}
namespace c_oSerBackgroundType{enum c_oSerBackgroundType namespace c_oSerBackgroundType{enum c_oSerBackgroundType
{ {
Color = 0, Color = 0,
......
...@@ -82,11 +82,11 @@ namespace BinDocxRW ...@@ -82,11 +82,11 @@ namespace BinDocxRW
int m_nType; int m_nType;
public: public:
std::wstring m_sFld; std::wstring m_sFld;
public: FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){} FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
public: int GetType() int GetType()
{ {
return m_nType; return m_nType;
} }
}; };
class BinaryCommonWriter class BinaryCommonWriter
{ {
...@@ -3027,6 +3027,26 @@ namespace BinDocxRW ...@@ -3027,6 +3027,26 @@ namespace BinDocxRW
} }
pOfficeDrawingConverter->SetRels(oldRels); pOfficeDrawingConverter->SetRels(oldRels);
} }
void WriteVbaProjectContent(OOX::VbaProject& oVbaProject)
{
std::wstring file_name = oVbaProject.filename().GetFilename();
m_oBcw.m_oStream.WriteBYTE(c_oSerVbaProjectTypes::Name);
m_oBcw.m_oStream.WriteStringW(file_name);
//... todooo write parsing vba project
//write vbaData.... todooo
//copy file bin
oVbaProject.copy_to(m_oBcw.m_oStream.m_pCommon->m_pImageManager->m_strDstMedia);
}
void WriteVbaProject(OOX::VbaProject& oVbaProject)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteVbaProjectContent(oVbaProject);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void Write(std::vector<OOX::WritingElement*>& aElems) void Write(std::vector<OOX::WritingElement*>& aElems)
{ {
int nStart = m_oBcw.WriteItemWithLengthStart(); int nStart = m_oBcw.WriteItemWithLengthStart();
...@@ -7866,9 +7886,8 @@ namespace BinDocxRW ...@@ -7866,9 +7886,8 @@ namespace BinDocxRW
//Write DocumentTable //Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(poDocument); ParamsDocumentWriter oParamsDocumentWriter(poDocument);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels; m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add... //DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter); BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes); oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
...@@ -7876,7 +7895,15 @@ namespace BinDocxRW ...@@ -7876,7 +7895,15 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer(); oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.m_bWriteSectPr = true; oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if(NULL != oDocx.m_pVbaProject)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
// Write content // Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems); oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
......
...@@ -201,9 +201,12 @@ namespace OOX ...@@ -201,9 +201,12 @@ namespace OOX
public: public:
CDocument() CDocument()
{ {
m_bMacroEnabled = false;
} }
CDocument(const CPath& oRootPath, const CPath& oPath) CDocument(const CPath& oRootPath, const CPath& oPath)
{ {
m_bMacroEnabled = false;
read( oRootPath, oPath ); read( oRootPath, oPath );
} }
virtual ~CDocument() virtual ~CDocument()
...@@ -218,7 +221,6 @@ namespace OOX ...@@ -218,7 +221,6 @@ namespace OOX
m_arrItems.clear(); m_arrItems.clear();
} }
public:
virtual void read(const CPath& oPath) virtual void read(const CPath& oPath)
{ {
...@@ -317,7 +319,11 @@ namespace OOX ...@@ -317,7 +319,11 @@ namespace OOX
{ {
m_oReadPath = oPath; m_oReadPath = oPath;
IFileContainer::Read( oRootPath, oPath ); IFileContainer::Read( oRootPath, oPath );
if (IFileContainer::IsExist(OOX::FileTypes::VbaProject))
{
m_bMacroEnabled = true;
}
#ifdef USE_LITE_READER #ifdef USE_LITE_READER
Common::readAllShapeTypes(oPath, m_arrShapeTypes); Common::readAllShapeTypes(oPath, m_arrShapeTypes);
...@@ -491,7 +497,8 @@ namespace OOX ...@@ -491,7 +497,8 @@ namespace OOX
} }
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return FileTypes::Document; if (m_bMacroEnabled) return FileTypes::DocumentMacro;
else return FileTypes::Document;
} }
virtual const CPath DefaultDirectory() const virtual const CPath DefaultDirectory() const
{ {
...@@ -634,6 +641,7 @@ namespace OOX ...@@ -634,6 +641,7 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
public: public:
bool m_bMacroEnabled;
CPath m_oReadPath; CPath m_oReadPath;
// Attributes // Attributes
SimpleTypes::CConformanceClass<SimpleTypes::conformanceclassTransitional> m_oConformance; SimpleTypes::CConformanceClass<SimpleTypes::conformanceclassTransitional> m_oConformance;
......
...@@ -43,100 +43,80 @@ namespace OOX { ...@@ -43,100 +43,80 @@ namespace OOX {
// Ищем основной документ // Ищем основной документ
smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document); smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document);
if (pFile.IsInit() && OOX::FileTypes::Document == pFile->type()) if (pFile.IsInit() == false)
m_pDocument = (OOX::CDocument*)pFile.operator->(); {
else pFile = Find(OOX::FileTypes::DocumentMacro);
m_pDocument = NULL; }
if (pFile.IsInit())
m_pDocument = dynamic_cast<OOX::CDocument*>(pFile.operator->());
if ( m_pDocument ) if ( m_pDocument )
{ {
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
// Ищем таблицу шрифтов // Ищем таблицу шрифтов
pFile = pDocumentContainer->Find( OOX::FileTypes::FontTable ); pFile = m_pDocument->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() && OOX::FileTypes::FontTable == pFile->type() ) if ( pFile.IsInit() )
m_pFontTable = (OOX::CFontTable*)pFile.operator->(); m_pFontTable = dynamic_cast<OOX::CFontTable*>(pFile.operator->());
else
m_pFontTable = NULL;
// Ищем таблицу нумераций // Ищем таблицу нумераций
pFile = pDocumentContainer->Find( OOX::FileTypes::Numbering ); pFile = m_pDocument->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit() && OOX::FileTypes::Numbering == pFile->type() ) if ( pFile.IsInit())
m_pNumbering = (OOX::CNumbering*)pFile.operator->(); m_pNumbering = dynamic_cast<OOX::CNumbering*>(pFile.operator->());
else
m_pNumbering = NULL;
// Ищем таблицу стилей // Ищем таблицу стилей
pFile = pDocumentContainer->Find( OOX::FileTypes::Style ); pFile = m_pDocument->Find( OOX::FileTypes::Style );
if ( pFile.IsInit() && OOX::FileTypes::Style == pFile->type() ) if ( pFile.IsInit())
m_pStyles = (OOX::CStyles*)pFile.operator->(); m_pStyles = dynamic_cast<OOX::CStyles*>(pFile.operator->());
else
m_pStyles = NULL;
// Ищем сноски для страниц // Ищем сноски для страниц
pFile = pDocumentContainer->Find( OOX::FileTypes::FootNote ); pFile = m_pDocument->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit() && OOX::FileTypes::FootNote == pFile->type() ) if ( pFile.IsInit())
m_pFootnotes = (OOX::CFootnotes*)pFile.operator->(); m_pFootnotes = dynamic_cast<OOX::CFootnotes*>(pFile.operator->());
else
m_pFootnotes = NULL; pFile = m_pDocument->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit())
pFile = pDocumentContainer->Find( OOX::FileTypes::EndNote ); m_pEndnotes = dynamic_cast<OOX::CEndnotes*>(pFile.operator->());
if ( pFile.IsInit() && OOX::FileTypes::EndNote == pFile->type() )
m_pEndnotes = (OOX::CEndnotes*)pFile.operator->();
else
m_pEndnotes = NULL;
// Ищем файл с наcтройками // Ищем файл с наcтройками
pFile = pDocumentContainer->Find( OOX::FileTypes::Setting ); pFile = m_pDocument->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() && OOX::FileTypes::Setting == pFile->type() ) if ( pFile.IsInit() )
m_pSettings = (OOX::CSettings*)pFile.operator->(); m_pSettings = dynamic_cast<OOX::CSettings*>(pFile.operator->());
else
m_pSettings = NULL;
// Ищем файл с комментариями // Ищем файл с комментариями
pFile = pDocumentContainer->Find( OOX::FileTypes::Comments ); pFile = m_pDocument->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit() && OOX::FileTypes::Comments == pFile->type() ) if ( pFile.IsInit())
m_pComments = (OOX::CComments*)pFile.operator->(); m_pComments = dynamic_cast<OOX::CComments*>(pFile.operator->());
else
m_pComments = NULL;
// Ищем файл с комментариями Ext // Ищем файл с комментариями Ext
pFile = pDocumentContainer->Find( OOX::FileTypes::CommentsExt ); pFile = m_pDocument->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit() && OOX::FileTypes::CommentsExt == pFile->type() ) if ( pFile.IsInit())
m_pCommentsExt = (OOX::CCommentsExt*)pFile.operator->(); m_pCommentsExt = dynamic_cast<OOX::CCommentsExt*>(pFile.operator->());
else
m_pCommentsExt = NULL;
// Ищем файл с авторами // Ищем файл с авторами
pFile = pDocumentContainer->Find( OOX::FileTypes::People ); pFile = m_pDocument->Find( OOX::FileTypes::People );
if ( pFile.IsInit() && OOX::FileTypes::People == pFile->type() ) if ( pFile.IsInit())
m_pPeople = (OOX::CPeople*)pFile.operator->(); m_pPeople = dynamic_cast<OOX::CPeople*>(pFile.operator->());
else
m_pPeople = NULL;
//OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName()); //OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName());
//IFileContainer::Read(rels, oFilePath); //IFileContainer::Read(rels, oFilePath);
// Ищем файл с темами // Ищем файл с темами
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme); pFile = m_pDocument->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type()) if (pFile.IsInit())
m_pTheme = (PPTX::Theme*)pFile.operator->(); m_pTheme = dynamic_cast<PPTX::Theme*>(pFile.operator->());
else
m_pTheme = NULL; pFile = m_pDocument->Find(OOX::FileTypes::VbaProject);
} if (pFile.IsInit())
m_pVbaProject = dynamic_cast<OOX::VbaProject*>(pFile.operator->());
}
// Ищем настройки // Ищем настройки
pFile = Find( OOX::FileTypes::App ); pFile = Find( OOX::FileTypes::App );
if ( pFile.IsInit() && OOX::FileTypes::App == pFile->type() ) if ( pFile.IsInit())
m_pApp = (OOX::CApp*)pFile.operator->(); m_pApp = dynamic_cast<OOX::CApp*>(pFile.operator->());
else
m_pApp = NULL;
pFile = Find( OOX::FileTypes::Core ); pFile = Find( OOX::FileTypes::Core );
if ( pFile.IsInit() && OOX::FileTypes::Core == pFile->type() ) if ( pFile.IsInit())
m_pCore = (OOX::CCore*)pFile.operator->(); m_pCore = dynamic_cast<OOX::CCore*>(pFile.operator->());
else
m_pCore = NULL;
return true; return true;
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "Media/Image.h" #include "Media/Image.h"
#include "Media/OleObject.h" #include "Media/OleObject.h"
#include "Media/ActiveX.h" #include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "HeaderFooter.h" #include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h" #include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
...@@ -82,6 +83,7 @@ namespace OOX ...@@ -82,6 +83,7 @@ namespace OOX
m_pComments = NULL; m_pComments = NULL;
m_pCommentsExt = NULL; m_pCommentsExt = NULL;
m_pPeople = NULL; m_pPeople = NULL;
m_pVbaProject = NULL;
} }
CDocx(const CPath& oFilePath) CDocx(const CPath& oFilePath)
{ {
...@@ -98,6 +100,7 @@ namespace OOX ...@@ -98,6 +100,7 @@ namespace OOX
m_pComments = NULL; m_pComments = NULL;
m_pCommentsExt = NULL; m_pCommentsExt = NULL;
m_pPeople = NULL; m_pPeople = NULL;
m_pVbaProject = NULL;
Read( oFilePath ); Read( oFilePath );
} }
...@@ -198,21 +201,22 @@ namespace OOX ...@@ -198,21 +201,22 @@ namespace OOX
return NULL; return NULL;
} }
OOX::CApp *m_pApp; OOX::CApp *m_pApp;
OOX::CCore *m_pCore; OOX::CCore *m_pCore;
OOX::CDocument *m_pDocument; // Основной документ word/document.xml OOX::CDocument *m_pDocument; // Основной документ word/document.xml
OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml
OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml
OOX::CStyles *m_pStyles; // Стили word/styles.xml OOX::CStyles *m_pStyles; // Стили word/styles.xml
OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml
OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml
OOX::CSettings *m_pSettings; // Настройки word/settings.xml OOX::CSettings *m_pSettings; // Настройки word/settings.xml
OOX::CComments *m_pComments; // word/comments.xml OOX::CComments *m_pComments; // word/comments.xml
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml OOX::CPeople *m_pPeople; // word/people.xml
OOX::VbaProject *m_pVbaProject;
PPTX::Theme *m_pTheme; PPTX::Theme *m_pTheme;
}; };
} // OOX } // OOX
......
...@@ -75,7 +75,7 @@ namespace OOX ...@@ -75,7 +75,7 @@ namespace OOX
else else
oFileName = oPath / oRelationFilename; oFileName = oPath / oRelationFilename;
if ( oRelation.Type() == FileTypes::Document) if ( oRelation.Type() == FileTypes::Document || oRelation.Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::FontTable) else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName )); return smart_ptr<OOX::File>(new CFontTable( oFileName ));
...@@ -165,7 +165,7 @@ namespace OOX ...@@ -165,7 +165,7 @@ namespace OOX
return smart_ptr<OOX::File>(new CApp( oFileName )); return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( pRelation->Type() == FileTypes::Core) else if ( pRelation->Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName )); return smart_ptr<OOX::File>(new CCore( oFileName ));
else if ( pRelation->Type() == FileTypes::Document) else if ( pRelation->Type() == FileTypes::Document || pRelation->Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Theme) else if ( pRelation->Type() == FileTypes::Theme)
{ {
......
...@@ -52,6 +52,10 @@ namespace OOX ...@@ -52,6 +52,10 @@ namespace OOX
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument")); _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType DocumentMacro (L"word", L"document.xml",
_T("application/vnd.ms-word.document.macroEnabled.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType Theme (L"theme", L"theme.xml", const FileType Theme (L"theme", L"theme.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"), _T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"), true); _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"), true);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define OOX_VBA_PROJECT_INCLUDE_H_ #define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h" #include "Media.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h" #include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace OOX namespace OOX
......
...@@ -105,6 +105,8 @@ namespace OOX ...@@ -105,6 +105,8 @@ namespace OOX
{ {
m_pWorkbook = dynamic_cast<OOX::Spreadsheet::CWorkbook*>(pFile.operator->()); m_pWorkbook = dynamic_cast<OOX::Spreadsheet::CWorkbook*>(pFile.operator->());
} }
else
m_pWorkbook = NULL;
if ( m_pWorkbook ) if ( m_pWorkbook )
{ {
......
...@@ -133,35 +133,41 @@ namespace NExtractTools ...@@ -133,35 +133,41 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY: case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT2DOCX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT2RTF; else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT2RTF;
}break; }break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY: case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY:
{ {
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST2XLSX; if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST2XLSX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST2CSV; else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST2CSV;
}break; }break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY: case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY:
{ {
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT2PPTX; if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT2PPTX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD: case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT_BIN2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT_BIN2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT_BIN2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_BIN2T; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_BIN2T;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT_BIN2RTF; else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT_BIN2RTF;
}break; }break;
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET: case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
{ {
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST_BIN2XLSX; if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST_BIN2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST_BIN2XLSX;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_BIN2T; else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_BIN2T;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST_BIN2CSV; else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST_BIN2CSV;
}break; }break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION: case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION:
{ {
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT_BIN2PPTX; if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT_BIN2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT_BIN2PPTX;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_BIN2T; else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_BIN2T;
}break; }break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PDF: case AVS_OFFICESTUDIO_FILE_CANVAS_PDF:
...@@ -171,18 +177,21 @@ namespace NExtractTools ...@@ -171,18 +177,21 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
{ {
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX; if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_CSV2XLSX;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST; else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_RTF2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOC2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN;
}break; }break;
...@@ -195,12 +204,14 @@ namespace NExtractTools ...@@ -195,12 +204,14 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT: case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_TXT2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT:
{ {
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX; if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPT2PPTX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT; else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT;
}break; }break;
...@@ -215,6 +226,9 @@ namespace NExtractTools ...@@ -215,6 +226,9 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".docx")) || else if (0 == sExt2.compare(_T(".docx")) ||
0 == sExt2.compare(_T(".xlsx")) || 0 == sExt2.compare(_T(".xlsx")) ||
0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX; 0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX;
else if (0 == sExt2.compare(_T(".docm")) ||
0 == sExt2.compare(_T(".xlsm")) ||
0 == sExt2.compare(_T(".pptm"))) res = TCD_ODF2OOX;
}break; }break;
case AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO: case AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO:
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment