Commit 0ed3f740 authored by ElenaSubbotina's avatar ElenaSubbotina

read/write docm

parent af2e76ae
...@@ -43,7 +43,7 @@ namespace Writers ...@@ -43,7 +43,7 @@ namespace Writers
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)
{ {
} }
......
...@@ -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"
...@@ -76,6 +78,8 @@ namespace Writers ...@@ -76,6 +78,8 @@ namespace Writers
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;
std::wstring m_sThemePath; std::wstring m_sThemePath;
......
...@@ -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());
} }
......
This diff is collapsed.
...@@ -154,7 +154,8 @@ extern int g_nCurFormatVersion; ...@@ -154,7 +154,8 @@ extern int g_nCurFormatVersion;
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
{ {
...@@ -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,8 +82,8 @@ namespace BinDocxRW ...@@ -82,8 +82,8 @@ 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;
} }
...@@ -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();
...@@ -7868,7 +7888,6 @@ namespace BinDocxRW ...@@ -7868,7 +7888,6 @@ namespace BinDocxRW
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)
{ {
...@@ -318,6 +320,10 @@ namespace OOX ...@@ -318,6 +320,10 @@ 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 );
} }
...@@ -211,6 +214,7 @@ namespace OOX ...@@ -211,6 +214,7 @@ namespace OOX
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;
......
...@@ -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