Commit f9e80f36 authored by ElenaSubbotina's avatar ElenaSubbotina

variations for oox formats

parent 2d570818
......@@ -358,26 +358,34 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName)
std::string::size_type res1 = std::string::npos;
std::string::size_type res = 0;
if ((std::string::npos != strContentTypes.find(docxFormatLine)) ||
(std::string::npos != strContentTypes.find(dotxFormatLine)) ||
(std::string::npos != strContentTypes.find(docmFormatLine)) ||
(std::string::npos != strContentTypes.find(dotmFormatLine)))
(std::string::npos != strContentTypes.find(docmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
}
else if ((std::string::npos != strContentTypes.find(xlsxFormatLine)) ||
(std::string::npos != strContentTypes.find(xltxFormatLine)) ||
(std::string::npos != strContentTypes.find(xlsmFormatLine)) ||
(std::string::npos != strContentTypes.find(xltmFormatLine)))
else if ((std::string::npos != strContentTypes.find(dotxFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX;
}
else if ((std::string::npos != strContentTypes.find(dotmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM;
}
else if ((std::string::npos != strContentTypes.find(xlsxFormatLine)) ||
(std::string::npos != strContentTypes.find(xlsmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
}
else if ((std::string::npos != strContentTypes.find(pptxFormatLine)) ||
(std::string::npos != strContentTypes.find(potxFormatLine)) ||
else if ((std::string::npos != strContentTypes.find(xltxFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX;
}
else if ((std::string::npos != strContentTypes.find(xltmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM;
}
else if ((std::string::npos != strContentTypes.find(pptxFormatLine)) ||
(std::string::npos != strContentTypes.find(pptmFormatLine)) ||
(std::string::npos != strContentTypes.find(ppsmFormatLine)) ||
(std::string::npos != strContentTypes.find(potmFormatLine)))
(std::string::npos != strContentTypes.find(ppsmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
}
......@@ -385,7 +393,14 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX;
}
else if ((std::string::npos != strContentTypes.find(potxFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX;
}
else if ((std::string::npos != strContentTypes.find(potmFormatLine)))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM;
}
delete []pBuffer;
pBuffer = NULL;
......@@ -519,6 +534,9 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
switch (type)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: return L".docx";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: return L".docm";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX: return L".dotx";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM: return L".dotm";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: return L".doc";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT: return L".odt";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: return L".rtf";
......@@ -530,11 +548,17 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI: return L".mobi";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: return L".pptx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: return L".pptm";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: return L".ppt";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP: return L".odp";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX: return L".ppsx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX: return L".potx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM: return L".potm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: return L".xlsx";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: return L".xlsm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX: return L".xltx";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM: return L".xltm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: return L".xls";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: return L".ods";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: return L".csv";
......@@ -581,6 +605,12 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring& ext)
{
if (L".docx" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
if (L".docm" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM;
if (L".dotx" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX;
if (L".dotm" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM;
if (L".doc" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
if (L".odt" == ext)
......@@ -603,15 +633,27 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring& ext)
if (L".pptx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
if (L".pptm" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM;
if (L".ppt" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT;
if (L".odp" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
if (L".ppsx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX;
if (L".potx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX;
if (L".potm" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM;
if (L".xlsx" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
if (L".xlsm" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM;
if (L".xltx" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX;
if (L".xltm" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM;
if (L".xls" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
if (L".ods" == ext)
......
......@@ -44,18 +44,27 @@
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0008
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0009
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000a
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000b
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000c
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000d
#define AVS_OFFICESTUDIO_FILE_PRESENTATION 0x0080
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0001
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0002
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0004
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0005
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET 0x0100
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0002
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0003
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0004
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM 0x0200
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
......
......@@ -225,7 +225,86 @@ namespace NExtractTools
return doct_bin2docx(sTempDoctFileEditor, sTo, sTemp, bFromChanges, sThemeDir, params);
}
// dotx -> docx
int dotx2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedDOCX = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedDOCX);
int nRes = dotx2docx_dir(sFrom, sTempUnpackedDOCX, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedDOCX, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml");
std::wstring sCTTo = _T("application/vnd.ms-word.document.macroEnabled.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// dotm -> docm
int dotm2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedDOCM = sTemp + FILE_SEPARATOR_STR + _T("docm_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedDOCM);
int nRes = dotm2docm_dir(sFrom, sTempUnpackedDOCM, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedDOCM, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int dotm2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.ms-word.template.macroEnabledTemplate.main+xml");
std::wstring sCTTo = _T("application/vnd.ms-word.document.macroEnabled.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// xslx -> bin
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
......@@ -347,6 +426,86 @@ namespace NExtractTools
return xlst_bin2xlsx(sTempXlstFileEditor, sTo, sTemp, bFromChanges, sThemeDir, params);
}
// xltx -> xlsx
int xltx2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedXLSX = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedXLSX);
int nRes = xltx2xlsx_dir(sFrom, sTempUnpackedXLSX, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedXLSX, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int xltx2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml");
std::wstring sCTTo = _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// xltm -> xlsm
int xltm2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedXLSM = sTemp + FILE_SEPARATOR_STR + _T("xlsm_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedXLSM);
int nRes = xltm2xlsm_dir(sFrom, sTempUnpackedXLSM, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedXLSM, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int xltm2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.ms-excel.sheet.macroEnabled.main+xml");
std::wstring sCTTo = _T("application/vnd.ms-excel.template.macroEnabled.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// pptx -> bin
int pptx2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
......@@ -833,21 +992,21 @@ namespace NExtractTools
// ppsx -> pptx
int ppsx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedPPSX = sTemp + FILE_SEPARATOR_STR + _T("ppsx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedPPSX);
{
std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedPPTX);
int nRes = ppsx2pptx_dir(sFrom, sTempUnpackedPPSX, params);
int nRes = ppsx2pptx_dir(sFrom, sTempUnpackedPPTX, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPSX, sTo, true))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPTX, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
}
int ppsx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
......@@ -871,7 +1030,86 @@ namespace NExtractTools
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// potx -> pptx
int potx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedPPTX);
int nRes = potx2pptx_dir(sFrom, sTempUnpackedPPTX, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPTX, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int potx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");
std::wstring sCTTo = _T("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// potm -> pptm
int potm2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sTempUnpackedPPTM = sTemp + FILE_SEPARATOR_STR + _T("pptm_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedPPTM);
int nRes = potm2pptm_dir(sFrom, sTempUnpackedPPTM, params);
if(SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPTM, sTo, true))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int potm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
{
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
{
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + _T("[Content_Types].xml");
if(NSFile::CFileBinary::Exists(sContentTypesPath))
{
std::wstring sData;
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
{
std::wstring sCTFrom = _T("application/vnd.ms-powerpoint.template.macroEnabled.main+xml");
std::wstring sCTTo = _T("application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
sData = string_replaceAll(sData, sCTFrom, sCTTo);
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
{
return 0;
}
}
}
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// ppt -> pptx
int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
......@@ -1558,16 +1796,25 @@ namespace NExtractTools
switch (OfficeFileFormatChecker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM:
{
return docx2doct_bin(sResultDecryptFile, sTo, sTemp, params);
}break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM:
{
const std::wstring & sXmlOptions = params.getXmlOptions();
return xlsx2xlst_bin(sResultDecryptFile, sTo, sTemp, params);
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM:
{
return pptx2pptt_bin(sResultDecryptFile, sTo, sTemp,params);
}break;
......@@ -1615,16 +1862,25 @@ namespace NExtractTools
switch (OfficeFileFormatChecker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM:
{
return fromDocument(sResultDecryptFile, AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX, sTemp, params);
}break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM:
{
return fromSpreadsheet(sResultDecryptFile, AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX, sTemp, params);
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX:
{
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM:
{
return fromPresentation(sResultDecryptFile, AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX, sTemp, params);
}break;
}
......@@ -2140,11 +2396,20 @@ namespace NExtractTools
{
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sDocxDir);
if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatFrom)
if (AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatFrom ||
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM == nFormatFrom)
{
nRes = zip2dir(sFrom, sDocxDir);
}
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatFrom)
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX == nFormatFrom)
{
nRes = dotx2docx_dir(sFrom, sDocxDir, params);
}
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM == nFormatFrom)
{
nRes = dotm2docm_dir(sFrom, sDocxDir, params);
}
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatFrom)
{
nRes = doc2docx_dir(sFrom, sDocxDir, sTemp, params);
}
......@@ -2308,7 +2573,8 @@ namespace NExtractTools
std::wstring sXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked");
NSDirectory::CreateDirectory(sXlsxDir);
bool isSavedXFile = false;
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatFrom)
if (AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatFrom ||
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM == nFormatFrom)
{
nRes = zip2dir(sFrom, sXlsxDir);
if (SUCCEEDED_X2T(nRes) && params.getSaveXFile())
......@@ -2317,7 +2583,15 @@ namespace NExtractTools
isSavedXFile = true;
}
}
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatFrom)
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX == nFormatFrom)
{
nRes = xltx2xlsx_dir(sFrom, sXlsxDir, params);
}
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM == nFormatFrom)
{
nRes = xltm2xlsm_dir(sFrom, sXlsxDir, params);
}
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatFrom)
{
nRes = xls2xlsx_dir(sFrom, sXlsxDir, sTemp, params);
}
......@@ -2436,11 +2710,12 @@ namespace NExtractTools
int nRes = 0;
std::wstring sPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sPptxDir);
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatFrom)
if (AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatFrom ||
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM == nFormatFrom)
{
nRes = zip2dir(sFrom, sPptxDir);
}
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatFrom)
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatFrom)
{
nRes = ppt2pptx_dir(sFrom, sPptxDir, sTemp, params);
}
......@@ -2452,7 +2727,15 @@ namespace NExtractTools
{
nRes = ppsx2pptx_dir(sFrom, sPptxDir, params);
}
else
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX == nFormatFrom)
{
nRes = potx2pptx_dir(sFrom, sPptxDir, params);
}
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM == nFormatFrom)
{
nRes = potm2pptm_dir(sFrom, sPptxDir, params);
}
else
nRes = AVS_FILEUTILS_ERROR_CONVERT;
if(SUCCEEDED_X2T(nRes))
{
......@@ -2776,6 +3059,34 @@ namespace NExtractTools
case TCD_PPTT2PPTX:
{
result = pptt2pptx (sFileFrom, sFileTo, sTempDir, bFromChanges, sThemeDir, oInputParams);
}break;
case TCD_DOTX2DOCX:
{
result = dotx2docx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_DOTM2DOCM:
{
result = dotm2docm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_XLTX2XLSX:
{
result = xltx2xlsx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_XLTM2XLSM:
{
result = xltm2xlsm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_PPSX2PPTX:
{
result = ppsx2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_POTX2PPTX:
{
result = potx2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_POTM2PPTM:
{
result = potm2pptm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_ZIPDIR:
{
......@@ -2837,10 +3148,6 @@ namespace NExtractTools
{
result = zip2dir (sFileFrom, NSDirectory::GetFolderPath(sFileTo));
}break;
case TCD_PPSX2PPTX:
{
result = ppsx2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_PPT2PPTX:
{
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
......
......@@ -55,12 +55,22 @@ namespace NExtractTools
int doct_bin2docx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int doct2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotx2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, 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_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 xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions);
int xlsx2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlst_bin2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xlst_bin2xlsx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xlst2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xltx2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, 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_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 pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......@@ -80,6 +90,10 @@ namespace NExtractTools
int ppsx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppsx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, 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_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_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
......@@ -109,25 +109,45 @@ namespace NExtractTools
switch (OfficeFileFormatChecker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM:
{
if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOCX2DOCT;
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(".odt"))) res = TCD_DOCX2ODT;
else if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOTX2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM;
}break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM:
{
if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLSX2XLST;
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(".ods"))) res = TCD_XLSX2ODS;
else if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLTX2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM;
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM:
{
if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPTX2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPTX2PPTT;
else if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPSX2PPTX;
else if (0 == sExt2.compare(_T(".pptx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX)
res = TCD_PPSX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX)
res = TCD_POTX2PPTX;
}
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_POTM2PPTM;
else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
......
......@@ -62,16 +62,23 @@ namespace NExtractTools
TCD_DOCT2DOCX,
TCD_DOCX2DOCT_BIN,
TCD_DOCT_BIN2DOCX,
TCD_DOTX2DOCX,
TCD_DOTM2DOCM,
TCD_XLSX2XLST,
TCD_XLST2XLSX,
TCD_XLSX2XLST_BIN,
TCD_XLST_BIN2XLSX,
TCD_XLTX2XLSX,
TCD_XLTM2XLSM,
TCD_PPTX2PPTT,
TCD_PPTT2PPTX,
TCD_PPTX2PPTT_BIN,
TCD_PPTT_BIN2PPTX,
TCD_PPSX2PPTX,
TCD_POTX2PPTX,
TCD_POTM2PPTM,
TCD_ZIPDIR,
TCD_UNZIPDIR,
......@@ -89,7 +96,6 @@ namespace NExtractTools
TCD_T2BIN,
TCD_BIN2T,
TCD_PPSX2PPTX,
//ppt 2
TCD_PPT2PPTX,
TCD_PPT2PPTT,
......@@ -136,7 +142,7 @@ namespace NExtractTools
TCD_PPTT2ODP,
TCD_PPTX_BIN2ODP,
TCD_XML2DOCX,
TCD_XML2DOCX,
TCD_DOCX2XML,
//
TCD_MSCRYPT2,
......@@ -718,7 +724,7 @@ namespace NExtractTools
int nDelimitersCount = 6;
int aDelimiters[6] = { 0, 0, 0, 0, 0, 0 };
for(int i = 0; i < dwBytesRead; ++i)
for (DWORD i = 0; i < dwBytesRead; ++i)
{
char cCurChar = pBuffer[i];
if ('\n' == cCurChar)
......@@ -900,7 +906,25 @@ namespace NExtractTools
else if (0 == sArg3.compare(_T("ppsx2pptx"))) {
res = TCD_PPSX2PPTX;
}
else if (0 == sArg3.compare(_T("ppt2pptx"))) {
else if (0 == sArg3.compare(_T("potx2pptx"))) {
res = TCD_POTX2PPTX;
}
else if (0 == sArg3.compare(_T("potm2pptm"))) {
res = TCD_POTM2PPTM;
}
else if (0 == sArg3.compare(_T("xltx2xlsx"))) {
res = TCD_XLTX2XLSX;
}
else if (0 == sArg3.compare(_T("xltm2xlsm"))) {
res = TCD_XLTM2XLSM;
}
else if (0 == sArg3.compare(_T("dotx2docx"))) {
res = TCD_DOTX2DOCX;
}
else if (0 == sArg3.compare(_T("dotm2docm"))) {
res = TCD_DOTM2DOCM;
}
else if (0 == sArg3.compare(_T("ppt2pptx"))) {
res = TCD_PPT2PPTX;
}
else if (0 == sArg3.compare(_T("doc2docx"))) {
......
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