Commit 0ed3f740 authored by ElenaSubbotina's avatar ElenaSubbotina

read/write docm

parent af2e76ae
......@@ -40,11 +40,11 @@ namespace Writers
class DocumentWriter : public ContentWriter
{
XmlUtils::CStringWriter m_oWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
std::wstring m_sDir;
public:
DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
std::wstring m_sDir;
DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
{
}
void Write()
......
......@@ -31,7 +31,9 @@
*/
#ifndef FILE_WRITER
#define FILE_WRITER
#include "../../DesktopEditor/common/Path.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "NumberingWriter.h"
#include "fontTableWriter.h"
......@@ -75,6 +77,8 @@ namespace Writers
DocumentRelsWriter m_oDocumentRelsWriter;
WebSettingsWriter m_oWebSettingsWriter;
DefaultThemeWriter m_oTheme;
smart_ptr<OOX::VbaProject> m_pVbaProject;
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
bool m_bSaveChartAsImg;
......
......@@ -34,6 +34,30 @@
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)
{
}
......@@ -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);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
}
......
......@@ -273,6 +273,21 @@ private:
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>
{
Writers::FileWriter& m_oFileWriter;
......@@ -282,12 +297,12 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe
int nCurHeaderType;
public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public:
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
int Read();
int ReadHdrFtrContent(BYTE type, long length, void* poResult);
int ReadHdrFtrFEO(BYTE type, long length, void* poResult);
int ReadHdrFtrItem(BYTE type, long length, void* poResult);
int ReadHdrFtrContent (BYTE type, long length, void* poResult);
int ReadHdrFtrFEO (BYTE type, long length, void* poResult);
int ReadHdrFtrItem (BYTE type, long length, void* poResult);
int ReadHdrFtrItemContent(BYTE type, long length, void* poResult);
};
class Binary_rPrReader : public Binary_CommonReader<Binary_rPrReader>
......@@ -551,7 +566,7 @@ public:
std::wstring strXml;
HRESULT hRes = m_oFileWriter.m_pDrawingConverter->GetRecordXml(nCurPos, length, XMLWRITER_RECORD_TYPE_TEXT_FILL, XMLWRITER_DOC_TYPE_WORDART, strXml);
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);
}
}
......@@ -560,35 +575,35 @@ public:
{
TrackRevision oDel;
oBinary_CommonReader2.ReadTrackRevision(length, &oDel);
orPr->Del = oDel.ToString(_T("w:del"));
orPr->Del = oDel.ToString(L"w:del");
}
break;
case c_oSerProp_rPrType::Ins:
{
TrackRevision oIns;
oBinary_CommonReader2.ReadTrackRevision(length, &oIns);
orPr->Ins = oIns.ToString(_T("w:ins"));
orPr->Ins = oIns.ToString(L"w:ins");
}
break;
case c_oSerProp_rPrType::MoveFrom:
{
TrackRevision oMoveFrom;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom"));
orPr->MoveFrom = oMoveFrom.ToString(L"w:moveFrom");
}
break;
case c_oSerProp_rPrType::MoveTo:
{
TrackRevision oMoveTo;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo"));
orPr->MoveTo = oMoveTo.ToString(L"w:moveTo");
}
break;
case c_oSerProp_rPrType::rPrChange:
{
TrackRevision oRPrChange;
res = Read1(length, &Binary_rPrReader::ReadrPrChange, this, &oRPrChange);
orPr->rPrChange = oRPrChange.ToString(_T("w:rPrChange"));
orPr->rPrChange = oRPrChange.ToString(L"w:rPrChange");
}
break;
default:
......@@ -647,9 +662,9 @@ public:
{
BYTE contextualSpacing = m_oBufferedStream.GetUChar();
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)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::Ind:
{
......@@ -657,9 +672,9 @@ public:
res = Read2(length, &Binary_pPrReader::ReadInd, this, &oTempWriter);
if(oTempWriter.GetCurSize() > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:ind")));
pCStringWriter->WriteString(std::wstring(L"<w:ind"));
pCStringWriter->Write(oTempWriter);
pCStringWriter->WriteString(std::wstring(_T("/>")));
pCStringWriter->WriteString(std::wstring(L"/>"));
}
break;
}
......@@ -668,35 +683,35 @@ public:
BYTE jc = m_oBufferedStream.GetUChar();
switch(jc)
{
case align_Right: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"right\" />")));break;
case align_Left: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"left\" />")));break;
case align_Center: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"center\" />")));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"both\" />")));break;
case align_Right: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"right\" />"));break;
case align_Left: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"left\" />"));break;
case align_Center: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"center\" />"));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"both\" />"));break;
}
}break;
case c_oSerProp_pPrType::KeepLines:
{
BYTE KeepLines = m_oBufferedStream.GetUChar();
if(0 != KeepLines)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepLines/>"));
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;
case c_oSerProp_pPrType::KeepNext:
{
BYTE KeepNext = m_oBufferedStream.GetUChar();
if(0 != KeepNext)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepNext/>"));
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;
case c_oSerProp_pPrType::PageBreakBefore:
{
BYTE pageBreakBefore = m_oBufferedStream.GetUChar();
if(0 != pageBreakBefore)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore/>")));
pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore/>"));
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;
}
case c_oSerProp_pPrType::Spacing:
......@@ -705,7 +720,7 @@ public:
res = Read2(length, &Binary_pPrReader::ReadSpacing, this, &oSpacing);
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;
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
if(oSpacing.bLine)
......@@ -745,9 +760,9 @@ public:
if(oSpacing.bAfterAuto)
{
if(true == oSpacing.AfterAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"1\""));
else
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"0\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"0\""));
}
if(oSpacing.bBefore)
{
......@@ -758,11 +773,11 @@ public:
if(oSpacing.bBeforeAuto)
{
if(true == oSpacing.BeforeAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"1\""));
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;
}
......@@ -776,7 +791,7 @@ public:
}
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);
}
break;
......@@ -787,10 +802,10 @@ public:
if(0 != WidowControl)
{
if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl/>")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl/>"));
}
else
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl w:val=\"off\" />")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl w:val=\"off\" />"));
break;
}
case c_oSerProp_pPrType::Tab:
......@@ -800,7 +815,7 @@ public:
size_t nLen = oTabs.m_aTabs.size();
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)
{
Tab& oTab = oTabs.m_aTabs[i];
......@@ -808,14 +823,14 @@ public:
std::wstring sVal;
switch(oTab.Val)
{
case g_tabtype_right: sVal=_T("right"); break;
case g_tabtype_center: sVal=_T("center"); break;
case g_tabtype_clear: sVal=_T("clear"); break;
default: sVal=_T("left"); break;
case g_tabtype_right: sVal = L"right"; break;
case g_tabtype_center: sVal = L"center"; break;
case g_tabtype_clear: sVal = L"clear"; break;
default: sVal = L"left"; break;
}
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;
case c_oSerProp_pPrType::ParaStyle:
......@@ -826,9 +841,9 @@ public:
}break;
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);
pCStringWriter->WriteString(std::wstring(_T("</w:numPr>")));
pCStringWriter->WriteString(std::wstring(L"</w:numPr>"));
}break;
case c_oSerProp_pPrType::pPr_rPr:
{
......@@ -2917,7 +2932,8 @@ class Binary_OtherTableReader : public Binary_CommonReader<Binary_OtherTableRead
Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir;
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()
......@@ -7022,13 +7038,13 @@ public:
{
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::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::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());
int nativeDocumentType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType;
......@@ -7922,9 +7938,9 @@ public:
int res = ReadTable(&Binary_NotesTableReader::ReadNotes, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + sFilename + _T(".rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
return res;
......@@ -7961,33 +7977,33 @@ public:
XmlUtils::CStringWriter& writer = pBinary_DocumentTableReader->m_oDocumentWriter.m_oContent;
if(m_bIsFootnote)
{
writer.WriteString(_T("<w:footnote"));
writer.WriteString(L"<w:footnote");
}
else
{
writer.WriteString(_T("<w:endnote"));
writer.WriteString(L"<w:endnote");
}
if(m_oType.IsInit())
{
writer.WriteString(_T(" w:type=\""));
writer.WriteString(L" w:type=\"");
writer.WriteString(m_oType->ToString());
writer.WriteString(_T("\""));
writer.WriteString(L"\"");
}
if(m_oId.IsInit())
{
writer.WriteString(_T(" w:id=\""));
writer.WriteString(L" w:id=\"");
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);
if(m_bIsFootnote)
{
writer.WriteString(_T("</w:footnote>"));
writer.WriteString(L"</w:footnote>");
}
else
{
writer.WriteString(_T("</w:endnote>"));
writer.WriteString(L"</w:endnote>");
}
}
else
......@@ -8087,8 +8103,8 @@ public:
}
else
{
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<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\"/>"));
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"708\"/>");
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_pDrawingConverter->LoadClrMap(sClrMap);
}
......@@ -8140,9 +8156,12 @@ public:
case c_oSerTableTypes::Endnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
break;
case c_oSerTableTypes::VbaProject:
res = Binary_VbaProjectTableReader(m_oBufferedStream, m_oFileWriter).Read();
break;
//Comments должны читаться раньше чем c_oSerTableTypes::Document
//case c_oSerTableTypes::Comments:
//case c_oSerTableTypes::Comments
// res = oBinary_CommentsTableReader.Read();
// break;
//case c_oSerTableTypes::Other:
......@@ -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/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.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");
......@@ -8175,19 +8205,19 @@ public:
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
{
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");
}
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
{
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");
}
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
{
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");
}
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i)
......@@ -8196,7 +8226,7 @@ public:
if(false == pHeader->IsEmpty())
{
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 );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", L"/word", pHeader->m_sFilename);
......@@ -8208,7 +8238,7 @@ public:
if(false == pFooter->IsEmpty())
{
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 );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename);
......@@ -8216,9 +8246,9 @@ public:
}
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")
+ FILE_SEPARATOR_STR + _T("_rels")
+ FILE_SEPARATOR_STR + _T("document.xml.rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"
+ FILE_SEPARATOR_STR + L"_rels"
+ FILE_SEPARATOR_STR + L"document.xml.rels";
CComments& oComments= oBinary_CommentsTableReader.m_oComments;
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
......@@ -8232,19 +8262,19 @@ public:
if(false == oCommentsWriter.m_sComment.empty())
{
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");
}
if(false == oCommentsWriter.m_sCommentExt.empty())
{
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");
}
if(false == oCommentsWriter.m_sPeople.empty())
{
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");
}
......
......@@ -142,19 +142,20 @@ extern int g_nCurFormatVersion;
};}
namespace c_oSerTableTypes{enum c_oSerTableTypes
{
Signature = 0,
Info = 1,
Media = 2,
Numbering = 3,
HdrFtr = 4,
Style = 5,
Document = 6,
Other = 7,
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11,
Background
Signature = 0,
Info = 1,
Media = 2,
Numbering = 3,
HdrFtr = 4,
Style = 5,
Document = 6,
Other = 7,
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11,
Background = 12,
VbaProject = 13
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{
......@@ -203,10 +204,10 @@ extern int g_nCurFormatVersion;
};}
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
{
ImageMap = 0,
ImageMap_Src = 1,
EmbeddedFonts = 2,
DocxTheme = 3
ImageMap = 0,
ImageMap_Src = 1,
EmbeddedFonts = 2,
DocxTheme = 3
};}
namespace c_oSerFontsTypes{enum c_oSerFontsTypes
{
......@@ -521,6 +522,10 @@ extern int g_nCurFormatVersion;
endnoteReference = 27,
arPr = 28
};}
namespace c_oSerVbaProjectTypes{enum c_oSerVbaProjectType
{
Name = 0
};}
namespace c_oSerBackgroundType{enum c_oSerBackgroundType
{
Color = 0,
......
......@@ -82,11 +82,11 @@ namespace BinDocxRW
int m_nType;
public:
std::wstring m_sFld;
public: FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
public: int GetType()
{
return m_nType;
}
FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
int GetType()
{
return m_nType;
}
};
class BinaryCommonWriter
{
......@@ -3027,6 +3027,26 @@ namespace BinDocxRW
}
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)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
......@@ -7866,9 +7886,8 @@ namespace BinDocxRW
//Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
......@@ -7876,7 +7895,15 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
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
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
this->WriteTableEnd(nCurPos);
......
......@@ -201,9 +201,12 @@ namespace OOX
public:
CDocument()
{
m_bMacroEnabled = false;
}
CDocument(const CPath& oRootPath, const CPath& oPath)
{
m_bMacroEnabled = false;
read( oRootPath, oPath );
}
virtual ~CDocument()
......@@ -218,7 +221,6 @@ namespace OOX
m_arrItems.clear();
}
public:
virtual void read(const CPath& oPath)
{
......@@ -317,7 +319,11 @@ namespace OOX
{
m_oReadPath = oPath;
IFileContainer::Read( oRootPath, oPath );
if (IFileContainer::IsExist(OOX::FileTypes::VbaProject))
{
m_bMacroEnabled = true;
}
#ifdef USE_LITE_READER
Common::readAllShapeTypes(oPath, m_arrShapeTypes);
......@@ -491,7 +497,8 @@ namespace OOX
}
virtual const OOX::FileType type() const
{
return FileTypes::Document;
if (m_bMacroEnabled) return FileTypes::DocumentMacro;
else return FileTypes::Document;
}
virtual const CPath DefaultDirectory() const
{
......@@ -634,6 +641,7 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
public:
bool m_bMacroEnabled;
CPath m_oReadPath;
// Attributes
SimpleTypes::CConformanceClass<SimpleTypes::conformanceclassTransitional> m_oConformance;
......
......@@ -43,100 +43,80 @@ namespace OOX {
// Ищем основной документ
smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document);
if (pFile.IsInit() && OOX::FileTypes::Document == pFile->type())
m_pDocument = (OOX::CDocument*)pFile.operator->();
else
m_pDocument = NULL;
if (pFile.IsInit() == false)
{
pFile = Find(OOX::FileTypes::DocumentMacro);
}
if (pFile.IsInit())
m_pDocument = dynamic_cast<OOX::CDocument*>(pFile.operator->());
if ( m_pDocument )
{
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
// Ищем таблицу шрифтов
pFile = pDocumentContainer->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() && OOX::FileTypes::FontTable == pFile->type() )
m_pFontTable = (OOX::CFontTable*)pFile.operator->();
else
m_pFontTable = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() )
m_pFontTable = dynamic_cast<OOX::CFontTable*>(pFile.operator->());
// Ищем таблицу нумераций
pFile = pDocumentContainer->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit() && OOX::FileTypes::Numbering == pFile->type() )
m_pNumbering = (OOX::CNumbering*)pFile.operator->();
else
m_pNumbering = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit())
m_pNumbering = dynamic_cast<OOX::CNumbering*>(pFile.operator->());
// Ищем таблицу стилей
pFile = pDocumentContainer->Find( OOX::FileTypes::Style );
if ( pFile.IsInit() && OOX::FileTypes::Style == pFile->type() )
m_pStyles = (OOX::CStyles*)pFile.operator->();
else
m_pStyles = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Style );
if ( pFile.IsInit())
m_pStyles = dynamic_cast<OOX::CStyles*>(pFile.operator->());
// Ищем сноски для страниц
pFile = pDocumentContainer->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit() && OOX::FileTypes::FootNote == pFile->type() )
m_pFootnotes = (OOX::CFootnotes*)pFile.operator->();
else
m_pFootnotes = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit() && OOX::FileTypes::EndNote == pFile->type() )
m_pEndnotes = (OOX::CEndnotes*)pFile.operator->();
else
m_pEndnotes = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit())
m_pFootnotes = dynamic_cast<OOX::CFootnotes*>(pFile.operator->());
pFile = m_pDocument->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit())
m_pEndnotes = dynamic_cast<OOX::CEndnotes*>(pFile.operator->());
// Ищем файл с наcтройками
pFile = pDocumentContainer->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() && OOX::FileTypes::Setting == pFile->type() )
m_pSettings = (OOX::CSettings*)pFile.operator->();
else
m_pSettings = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() )
m_pSettings = dynamic_cast<OOX::CSettings*>(pFile.operator->());
// Ищем файл с комментариями
pFile = pDocumentContainer->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit() && OOX::FileTypes::Comments == pFile->type() )
m_pComments = (OOX::CComments*)pFile.operator->();
else
m_pComments = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit())
m_pComments = dynamic_cast<OOX::CComments*>(pFile.operator->());
// Ищем файл с комментариями Ext
pFile = pDocumentContainer->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit() && OOX::FileTypes::CommentsExt == pFile->type() )
m_pCommentsExt = (OOX::CCommentsExt*)pFile.operator->();
else
m_pCommentsExt = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit())
m_pCommentsExt = dynamic_cast<OOX::CCommentsExt*>(pFile.operator->());
// Ищем файл с авторами
pFile = pDocumentContainer->Find( OOX::FileTypes::People );
if ( pFile.IsInit() && OOX::FileTypes::People == pFile->type() )
m_pPeople = (OOX::CPeople*)pFile.operator->();
else
m_pPeople = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::People );
if ( pFile.IsInit())
m_pPeople = dynamic_cast<OOX::CPeople*>(pFile.operator->());
//OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName());
//IFileContainer::Read(rels, oFilePath);
// Ищем файл с темами
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type())
m_pTheme = (PPTX::Theme*)pFile.operator->();
else
m_pTheme = NULL;
}
pFile = m_pDocument->Find(OOX::FileTypes::Theme);
if (pFile.IsInit())
m_pTheme = dynamic_cast<PPTX::Theme*>(pFile.operator->());
pFile = m_pDocument->Find(OOX::FileTypes::VbaProject);
if (pFile.IsInit())
m_pVbaProject = dynamic_cast<OOX::VbaProject*>(pFile.operator->());
}
// Ищем настройки
pFile = Find( OOX::FileTypes::App );
if ( pFile.IsInit() && OOX::FileTypes::App == pFile->type() )
m_pApp = (OOX::CApp*)pFile.operator->();
else
m_pApp = NULL;
if ( pFile.IsInit())
m_pApp = dynamic_cast<OOX::CApp*>(pFile.operator->());
pFile = Find( OOX::FileTypes::Core );
if ( pFile.IsInit() && OOX::FileTypes::Core == pFile->type() )
m_pCore = (OOX::CCore*)pFile.operator->();
else
m_pCore = NULL;
if ( pFile.IsInit())
m_pCore = dynamic_cast<OOX::CCore*>(pFile.operator->());
return true;
}
......
......@@ -53,6 +53,7 @@
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
......@@ -82,6 +83,7 @@ namespace OOX
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
m_pVbaProject = NULL;
}
CDocx(const CPath& oFilePath)
{
......@@ -98,6 +100,7 @@ namespace OOX
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
m_pVbaProject = NULL;
Read( oFilePath );
}
......@@ -198,21 +201,22 @@ namespace OOX
return NULL;
}
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
OOX::CDocument *m_pDocument; // Основной документ word/document.xml
OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml
OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml
OOX::CStyles *m_pStyles; // Стили word/styles.xml
OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml
OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml
OOX::CSettings *m_pSettings; // Настройки word/settings.xml
OOX::CComments *m_pComments; // word/comments.xml
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
OOX::CDocument *m_pDocument; // Основной документ word/document.xml
OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml
OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml
OOX::CStyles *m_pStyles; // Стили word/styles.xml
OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml
OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml
OOX::CSettings *m_pSettings; // Настройки word/settings.xml
OOX::CComments *m_pComments; // word/comments.xml
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml
OOX::VbaProject *m_pVbaProject;
PPTX::Theme *m_pTheme;
PPTX::Theme *m_pTheme;
};
} // OOX
......
......@@ -75,7 +75,7 @@ namespace OOX
else
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 ));
else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName ));
......@@ -165,7 +165,7 @@ namespace OOX
return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( pRelation->Type() == FileTypes::Core)
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 ));
else if ( pRelation->Type() == FileTypes::Theme)
{
......
......@@ -52,6 +52,10 @@ namespace OOX
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"),
_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",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"), true);
......
......@@ -34,6 +34,7 @@
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace OOX
......
......@@ -105,6 +105,8 @@ namespace OOX
{
m_pWorkbook = dynamic_cast<OOX::Spreadsheet::CWorkbook*>(pFile.operator->());
}
else
m_pWorkbook = NULL;
if ( m_pWorkbook )
{
......
......@@ -133,35 +133,41 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
{
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(".rtf"))) res = TCD_DOCT2RTF;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY:
{
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(".csv"))) res = TCD_XLST2CSV;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY:
{
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;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
{
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(".rtf"))) res = TCD_DOCT_BIN2RTF;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
{
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(".csv"))) res = TCD_XLST_BIN2CSV;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION:
{
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;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PDF:
......@@ -171,18 +177,21 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
{
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(".bin"))) res = TCD_CSV2XLST_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF:
{
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(".bin"))) res = TCD_RTF2DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
{
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(".bin"))) res = TCD_DOC2DOCT_BIN;
}break;
......@@ -195,12 +204,14 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT:
{
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(".bin"))) res = TCD_TXT2DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT:
{
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(".pptt"))) res = TCD_PPT2PPTT;
}break;
......@@ -215,6 +226,9 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".docx")) ||
0 == sExt2.compare(_T(".xlsx")) ||
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;
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