Commit d6cd7c30 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - support macros

x2t  - oom->oox
parent 89b384ab
...@@ -61,7 +61,7 @@ HRESULT convert_single(std::wstring fileName) ...@@ -61,7 +61,7 @@ HRESULT convert_single(std::wstring fileName)
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath); std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL); hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL, true);
if (hr == S_OK) if (hr == S_OK)
{ {
......
...@@ -96,7 +96,63 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m ...@@ -96,7 +96,63 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
storage_ = NULL; storage_ = NULL;
Open(file_path, mode); Open(file_path, mode);
} }
// Opens "Workbook" stream and returns the only reference
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot)
{
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
if (!stream) return;
stream->seek(0);
int size_stream = stream->size();
if (withRoot == false)
{
int pos = streamName.find("/");
if (pos >= 0)
streamName = streamName.substr(pos + 1);
}
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
if (!streamNew) return;
unsigned char* data_stream = new unsigned char[size_stream];
if (data_stream)
{
stream->read(data_stream, size_stream);
streamNew->write(data_stream, size_stream);
delete []data_stream;
data_stream = NULL;
}
streamNew->flush();
delete streamNew;
delete stream;
}
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot)
{
std::list<std::string> entries;
entries = storage_->entries( path );
std::list<std::string>::iterator it;
for( it = entries.begin(); it != entries.end(); ++it )
{
std::string name = *it;
std::string fullname = path + name;
if( storage_->isDirectory( fullname ) )
{
copy( indent + 1, fullname + "/", storageOut, withRoot );
}
else
{
copy_stream(fullname, storageOut, withRoot);
}
}
}
CFStreamPtr CompoundFile::getWorkbookStream() CFStreamPtr CompoundFile::getWorkbookStream()
{ {
CFStreamPtr stream = getNamedStream("Workbook"); CFStreamPtr stream = getNamedStream("Workbook");
...@@ -123,7 +179,6 @@ CFStreamPtr CompoundFile::getNamedStream(const std::string& name) ...@@ -123,7 +179,6 @@ CFStreamPtr CompoundFile::getNamedStream(const std::string& name)
return streams[name]; return streams[name];
} }
CFStreamPtr CompoundFile::createNamedStream(const std::string& name) CFStreamPtr CompoundFile::createNamedStream(const std::string& name)
{ {
if(!streams[name]) if(!streams[name])
......
...@@ -58,11 +58,15 @@ public: ...@@ -58,11 +58,15 @@ public:
bool isError(); bool isError();
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true);
CFStreamPtr getWorkbookStream (); CFStreamPtr getWorkbookStream ();
CFStreamPtr getNamedStream (const std::string& name); CFStreamPtr getNamedStream (const std::string& name);
POLE::Storage *storage_; POLE::Storage *storage_;
private: private:
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true);
POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream) POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include "../../../Common/OfficeFileErrorDescription.h" #include "../../../Common/OfficeFileErrorDescription.h"
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack) long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack, bool bMacros)
{ {
XlsConverter converter(srcFile, dstPath, password, fontsPath, pCallBack); XlsConverter converter(srcFile, dstPath, password, fontsPath, pCallBack, bMacros);
if (converter.isError()) if (converter.isError())
{ {
......
...@@ -33,4 +33,4 @@ ...@@ -33,4 +33,4 @@
struct ProgressCallback; struct ProgressCallback;
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack); long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack, bool bMacros);
\ No newline at end of file \ No newline at end of file
...@@ -121,7 +121,7 @@ typedef struct tagBITMAPCOREHEADER { ...@@ -121,7 +121,7 @@ typedef struct tagBITMAPCOREHEADER {
} BITMAPCOREHEADER; } BITMAPCOREHEADER;
#endif #endif
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack) XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool bMacros)
{ {
xlsx_path = _xlsx_path; xlsx_path = _xlsx_path;
output_document = NULL; output_document = NULL;
...@@ -131,8 +131,10 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -131,8 +131,10 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
bUserStopConvert = false; bUserStopConvert = false;
is_older_version = false; is_older_version = false;
is_encrypted = false; is_encrypted = false;
output_document = new oox::package::xlsx_document();
try{ try
{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode); XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
if (cfile.isError()) if (cfile.isError())
...@@ -218,6 +220,25 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -218,6 +220,25 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
xls_global_info->mapPivotCache.insert(std::make_pair(index, pivot_cache)); xls_global_info->mapPivotCache.insert(std::make_pair(index, pivot_cache));
} }
} }
if (bMacros && cfile.storage_->isDirectory("_VBA_PROJECT_CUR"))
{
std::wstring xl_path = xlsx_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str());
std::wstring sVbaProjectFile = xl_path + FILE_SEPARATOR_STR + L"vbaProject.bin";
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
{
cfile.copy(0, "_VBA_PROJECT_CUR/", storageVbaProject, false);
storageVbaProject->close();
delete storageVbaProject;
output_document->get_xl_files().add_vba_project();
}
}
} }
catch(...) catch(...)
{ {
...@@ -231,8 +252,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -231,8 +252,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
Log::error("Version xls is old !!! - " + std::string(sVer.begin(), sVer.end())); Log::error("Version xls is old !!! - " + std::string(sVer.begin(), sVer.end()));
is_older_version = true; is_older_version = true;
} }
output_document = new oox::package::xlsx_document(); xlsx_context = new oox::xlsx_conversion_context(output_document);
xlsx_context = new oox::xlsx_conversion_context(output_document);
} }
XlsConverter::~XlsConverter() XlsConverter::~XlsConverter()
...@@ -268,6 +288,7 @@ bool XlsConverter::UpdateProgress(long nComplete) ...@@ -268,6 +288,7 @@ bool XlsConverter::UpdateProgress(long nComplete)
void XlsConverter::write() void XlsConverter::write()
{ {
if (!output_document)return; if (!output_document)return;
output_document->write(xlsx_path); output_document->write(xlsx_path);
delete output_document; output_document = NULL; delete output_document; output_document = NULL;
......
...@@ -93,7 +93,7 @@ namespace ODRAW ...@@ -93,7 +93,7 @@ namespace ODRAW
class XlsConverter class XlsConverter
{ {
public: public:
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack); XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool bMacros);
~XlsConverter() ; ~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context; oox::xlsx_conversion_context * xlsx_context;
......
...@@ -161,9 +161,9 @@ std::wstring external_items::media_path() ...@@ -161,9 +161,9 @@ std::wstring external_items::media_path()
void external_items::create_media_path(const std::wstring & out_path) void external_items::create_media_path(const std::wstring & out_path)
{ {
if (!media_path_.empty()) return; if (!media_path_.empty()) return;
std::wstring xl_path = out_path + FILE_SEPARATOR_STR + L"xl"; std::wstring xl_path = out_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str()); NSDirectory::CreateDirectory(xl_path.c_str());
NSDirectory::CreateDirectory((xl_path + FILE_SEPARATOR_STR + L"media").c_str()); NSDirectory::CreateDirectory((xl_path + FILE_SEPARATOR_STR + L"media").c_str());
......
...@@ -53,7 +53,6 @@ xlsx_content_types_file::xlsx_content_types_file() ...@@ -53,7 +53,6 @@ xlsx_content_types_file::xlsx_content_types_file()
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml"); content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml"); content_type_.add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
content_type_.add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"); content_type_.add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml"); content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml"); content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
...@@ -61,7 +60,7 @@ xlsx_content_types_file::xlsx_content_types_file() ...@@ -61,7 +60,7 @@ xlsx_content_types_file::xlsx_content_types_file()
xlsx_document::xlsx_document() xlsx_document::xlsx_document()
{ {
xl_files_.set_main_document(this); xl_files_.set_main_document(this);
rels_file_ptr relFile = rels_file::create(L".rels"); rels_file_ptr relFile = rels_file::create(L".rels");
relFile->get_rels().add(relationship(L"rId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"xl/workbook.xml")); relFile->get_rels().add(relationship(L"rId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"xl/workbook.xml"));
...@@ -73,7 +72,7 @@ xlsx_document::xlsx_document() ...@@ -73,7 +72,7 @@ xlsx_document::xlsx_document()
void xlsx_document::write(const std::wstring & RootPath) void xlsx_document::write(const std::wstring & RootPath)
{ {
xl_files_.write(RootPath); xl_files_.write(RootPath);
docProps_files_.write(RootPath); docProps_files_.write(RootPath);
content_type_.write(RootPath); content_type_.write(RootPath);
rels_files_.write(RootPath); rels_files_.write(RootPath);
...@@ -140,6 +139,7 @@ void sheets_files::write(const std::wstring & RootPath) ...@@ -140,6 +139,7 @@ void sheets_files::write(const std::wstring & RootPath)
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml"; const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type(); content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"; static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType); contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
...@@ -167,15 +167,18 @@ void sheets_files::write(const std::wstring & RootPath) ...@@ -167,15 +167,18 @@ void sheets_files::write(const std::wstring & RootPath)
xl_files::xl_files() xl_files::xl_files()
{ {
rels_files_.add_rel_file(rels_file::create(L"workbook.xml.rels")); rels_files_.add_rel_file(rels_file::create(L"workbook.xml.rels"));
bVbaProject = false;
} }
void xl_files::write(const std::wstring & RootPath) void xl_files::write(const std::wstring & RootPath)
{ {
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"xl"; std::wstring path = RootPath + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(path.c_str()); NSDirectory::CreateDirectory(path.c_str());
{ content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
{
pivot_cache_files_.set_rels(&rels_files_); pivot_cache_files_.set_rels(&rels_files_);
pivot_cache_files_.set_main_document(get_main_document()); pivot_cache_files_.set_main_document(get_main_document());
pivot_cache_files_.write(path); pivot_cache_files_.write(path);
...@@ -204,7 +207,6 @@ void xl_files::write(const std::wstring & RootPath) ...@@ -204,7 +207,6 @@ void xl_files::write(const std::wstring & RootPath)
connections_->write(path); connections_->write(path);
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) ); rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
contentTypes.add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"); contentTypes.add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
} }
...@@ -217,6 +219,18 @@ void xl_files::write(const std::wstring & RootPath) ...@@ -217,6 +219,18 @@ void xl_files::write(const std::wstring & RootPath)
if (workbook_) if (workbook_)
{ {
workbook_->write(path); workbook_->write(path);
if (bVbaProject)
{
rels_files_.add( relationship( L"vbId1", L"http://schemas.microsoft.com/office/2006/relationships/vbaProject", L"vbaProject.bin" ) );
contentTypes.add_override(L"/xl/vbaProject.bin", L"application/vnd.ms-office.vbaProject");
contentTypes.add_override(L"/xl/workbook.xml", L"application/vnd.ms-excel.sheet.macroEnabled.main+xml");
}
else
{
contentTypes.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
}
} }
if (theme_) if (theme_)
...@@ -253,6 +267,11 @@ void xl_files::write(const std::wstring & RootPath) ...@@ -253,6 +267,11 @@ void xl_files::write(const std::wstring & RootPath)
rels_files_.write(path); rels_files_.write(path);
} }
void xl_files::add_vba_project()
{
bVbaProject = true;
}
void xl_files::set_workbook(element_ptr Element) void xl_files::set_workbook(element_ptr Element)
{ {
workbook_ = Element; workbook_ = Element;
......
...@@ -226,6 +226,8 @@ public: ...@@ -226,6 +226,8 @@ public:
void add_charts (chart_content_ptr chart); void add_charts (chart_content_ptr chart);
void add_pivot_cache (pivot_cache_content_ptr cache); void add_pivot_cache (pivot_cache_content_ptr cache);
void add_pivot_table (pivot_table_content_ptr table); void add_pivot_table (pivot_table_content_ptr table);
void add_vba_project ();
private: private:
rels_files rels_files_; rels_files rels_files_;
sheets_files sheets_files_; sheets_files sheets_files_;
...@@ -244,14 +246,15 @@ private: ...@@ -244,14 +246,15 @@ private:
element_ptr vml_drawings_; element_ptr vml_drawings_;
element_ptr comments_; element_ptr comments_;
bool bVbaProject;
}; };
class xlsx_document : public document class xlsx_document : public document
{ {
public: public:
xlsx_document(); xlsx_document();
public:
virtual void write(const std::wstring & RootPath); virtual void write(const std::wstring & RootPath);
virtual content_types_file & content_type() { return content_type_; } virtual content_types_file & content_type() { return content_type_; }
xl_files & get_xl_files() { return xl_files_; } xl_files & get_xl_files() { return xl_files_; }
......
...@@ -357,47 +357,57 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName) ...@@ -357,47 +357,57 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName)
std::string::size_type res1 = std::string::npos; std::string::size_type res1 = std::string::npos;
std::string::size_type res = 0; std::string::size_type res = 0;
if ((std::string::npos != strContentTypes.find(docxFormatLine)) ||
(std::string::npos != strContentTypes.find(docmFormatLine))) if (std::string::npos != strContentTypes.find(docxFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
} }
else if ((std::string::npos != strContentTypes.find(dotxFormatLine))) else if (std::string::npos != strContentTypes.find(docmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM;
}
else if (std::string::npos != strContentTypes.find(dotxFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX; nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX;
} }
else if ((std::string::npos != strContentTypes.find(dotmFormatLine))) else if (std::string::npos != strContentTypes.find(dotmFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM; nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM;
} }
else if ((std::string::npos != strContentTypes.find(xlsxFormatLine)) || else if (std::string::npos != strContentTypes.find(xlsxFormatLine))
(std::string::npos != strContentTypes.find(xlsmFormatLine)))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX; nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
} }
else if ((std::string::npos != strContentTypes.find(xltxFormatLine))) else if (std::string::npos != strContentTypes.find(xlsmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM;
}
else if (std::string::npos != strContentTypes.find(xltxFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX; nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX;
} }
else if ((std::string::npos != strContentTypes.find(xltmFormatLine))) else if (std::string::npos != strContentTypes.find(xltmFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM; nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM;
} }
else if ((std::string::npos != strContentTypes.find(pptxFormatLine)) || else if (std::string::npos != strContentTypes.find(pptxFormatLine))
(std::string::npos != strContentTypes.find(pptmFormatLine)) ||
(std::string::npos != strContentTypes.find(ppsmFormatLine)))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX; nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
} }
else if ((std::string::npos != strContentTypes.find(ppsxFormatLine))) else if ((std::string::npos != strContentTypes.find(pptmFormatLine)) ||
(std::string::npos != strContentTypes.find(ppsmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM;
}
else if (std::string::npos != strContentTypes.find(ppsxFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX; nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX;
} }
else if ((std::string::npos != strContentTypes.find(potxFormatLine))) else if (std::string::npos != strContentTypes.find(potxFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX; nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX;
} }
else if ((std::string::npos != strContentTypes.find(potmFormatLine))) else if (std::string::npos != strContentTypes.find(potmFormatLine))
{ {
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM; nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM;
} }
......
This diff is collapsed.
...@@ -59,6 +59,8 @@ namespace NExtractTools ...@@ -59,6 +59,8 @@ namespace NExtractTools
int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotm2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int dotm2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotm2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int dotm2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int docm2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int docm2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions); int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions);
...@@ -71,6 +73,8 @@ namespace NExtractTools ...@@ -71,6 +73,8 @@ namespace NExtractTools
int xltx2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int xltx2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xltm2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xltm2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xltm2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int xltm2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsm2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsm2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptx2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int pptx2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
...@@ -94,6 +98,8 @@ namespace NExtractTools ...@@ -94,6 +98,8 @@ namespace NExtractTools
int potx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int potx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potm2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int potm2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int potm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params); int potm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
...@@ -119,6 +125,8 @@ namespace NExtractTools ...@@ -119,6 +125,8 @@ namespace NExtractTools
int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int txt2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int txt2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int txt2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int txt2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
...@@ -117,7 +117,13 @@ namespace NExtractTools ...@@ -117,7 +117,13 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOCX2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOCX2DOCT_BIN;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCX2RTF; else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCX2RTF;
else if (0 == sExt2.compare(_T(".odt"))) res = TCD_DOCX2ODT; else if (0 == sExt2.compare(_T(".odt"))) res = TCD_DOCX2ODT;
else if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOTX2DOCX; else if (0 == sExt2.compare(_T(".docx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX)
res = TCD_DOTX2DOCX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM)
res = TCD_DOCM2DOCX;
}
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM; else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM;
}break; }break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
...@@ -129,7 +135,13 @@ namespace NExtractTools ...@@ -129,7 +135,13 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLSX2XLST_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLSX2XLST_BIN;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLSX2CSV; else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLSX2CSV;
else if (0 == sExt2.compare(_T(".ods"))) res = TCD_XLSX2ODS; else if (0 == sExt2.compare(_T(".ods"))) res = TCD_XLSX2ODS;
else if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLTX2XLSX; else if (0 == sExt2.compare(_T(".xlsx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX)
res = TCD_XLTX2XLSX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
res = TCD_XLSM2XLSX;
}
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM; else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM;
}break; }break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
...@@ -146,6 +158,8 @@ namespace NExtractTools ...@@ -146,6 +158,8 @@ namespace NExtractTools
res = TCD_PPSX2PPTX; res = TCD_PPSX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX) if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX)
res = TCD_POTX2PPTX; res = TCD_POTX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM)
res = TCD_PPTM2PPTX;
} }
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_POTM2PPTM; else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_POTM2PPTM;
else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP; else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP;
...@@ -218,6 +232,7 @@ namespace NExtractTools ...@@ -218,6 +232,7 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS:
{ {
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLS2XLSX; if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLS2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLS2XLSM;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLS2XLST; else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLS2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLS2XLST_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLS2XLST_BIN;
}break; }break;
......
...@@ -63,6 +63,7 @@ namespace NExtractTools ...@@ -63,6 +63,7 @@ namespace NExtractTools
TCD_DOCX2DOCT_BIN, TCD_DOCX2DOCT_BIN,
TCD_DOCT_BIN2DOCX, TCD_DOCT_BIN2DOCX,
TCD_DOTX2DOCX, TCD_DOTX2DOCX,
TCD_DOCM2DOCX,
TCD_DOTM2DOCM, TCD_DOTM2DOCM,
TCD_XLSX2XLST, TCD_XLSX2XLST,
...@@ -70,6 +71,7 @@ namespace NExtractTools ...@@ -70,6 +71,7 @@ namespace NExtractTools
TCD_XLSX2XLST_BIN, TCD_XLSX2XLST_BIN,
TCD_XLST_BIN2XLSX, TCD_XLST_BIN2XLSX,
TCD_XLTX2XLSX, TCD_XLTX2XLSX,
TCD_XLSM2XLSX,
TCD_XLTM2XLSM, TCD_XLTM2XLSM,
TCD_PPTX2PPTT, TCD_PPTX2PPTT,
...@@ -78,6 +80,7 @@ namespace NExtractTools ...@@ -78,6 +80,7 @@ namespace NExtractTools
TCD_PPTT_BIN2PPTX, TCD_PPTT_BIN2PPTX,
TCD_PPSX2PPTX, TCD_PPSX2PPTX,
TCD_POTX2PPTX, TCD_POTX2PPTX,
TCD_PPTM2PPTX,
TCD_POTM2PPTM, TCD_POTM2PPTM,
TCD_ZIPDIR, TCD_ZIPDIR,
...@@ -108,6 +111,7 @@ namespace NExtractTools ...@@ -108,6 +111,7 @@ namespace NExtractTools
TCD_XLS2XLST, TCD_XLS2XLST,
TCD_XLS2XLST_BIN, TCD_XLS2XLST_BIN,
TCD_XLS2XLSX, TCD_XLS2XLSX,
TCD_XLS2XLSM,
//rtf 2 //rtf 2
TCD_RTF2DOCX, TCD_RTF2DOCX,
TCD_RTF2DOCT, TCD_RTF2DOCT,
...@@ -763,20 +767,42 @@ namespace NExtractTools ...@@ -763,20 +767,42 @@ namespace NExtractTools
*m_nFormatFrom = formatFrom; *m_nFormatFrom = formatFrom;
int toFormat = *m_nFormatTo; int toFormat = *m_nFormatTo;
if (AVS_OFFICESTUDIO_FILE_CANVAS == toFormat) { if (AVS_OFFICESTUDIO_FILE_CANVAS == toFormat)
if (AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom)) { {
if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET; toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET;
} else if (AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom)) { }
else if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom
|| 0 != ( AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION; toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
} else if (AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom)) { }
else if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_WORD; toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_WORD;
} }
} else if (AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER == toFormat) { }
if (AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom)) { else if ( AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER == toFormat)
{
if ( AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX; toFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
} else if (AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom)) { }
else if ( AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX; toFormat = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
} else if (AVS_OFFICESTUDIO_FILE_CANVAS_WORD == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom)) { }
else if ( AVS_OFFICESTUDIO_FILE_CANVAS_WORD == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; toFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
} }
size_t nIndex = m_sFileTo->rfind('.'); size_t nIndex = m_sFileTo->rfind('.');
......
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