Commit f43a0bbf authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent 746c2282
...@@ -1675,7 +1675,7 @@ namespace NExtractTools ...@@ -1675,7 +1675,7 @@ namespace NExtractTools
} }
// ppt -> pptx // ppt -> pptx
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)
{ {
std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked"); std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sResultPptxDir); NSDirectory::CreateDirectory(sResultPptxDir);
...@@ -1701,14 +1701,15 @@ namespace NExtractTools ...@@ -1701,14 +1701,15 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
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)
{ {
COfficePPTFile pptFile; COfficePPTFile pptFile;
pptFile.put_TempDirectory(sTemp); pptFile.put_TempDirectory(sTemp);
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword()); bool bMacros = false;
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword(), bMacros);
if (AVS_ERROR_DRM == hRes) if (AVS_ERROR_DRM == hRes)
{ {
...@@ -1723,10 +1724,62 @@ namespace NExtractTools ...@@ -1723,10 +1724,62 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT; return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
} }
// ppt -> pptm
int ppt2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sResultPptxDir);
int hRes = ppt2pptm_dir(sFrom, sResultPptxDir, sTemp, params);
if(SUCCEEDED_X2T(hRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultPptxDir, sTo, true))
return 0;
}
else if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int ppt2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
COfficePPTFile pptFile;
pptFile.put_TempDirectory(sTemp);
bool bMacros = true;
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword(), bMacros);
if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
// ppt -> pptt // ppt -> pptt
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked"); std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked");
std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin"); std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin");
...@@ -1743,7 +1796,7 @@ namespace NExtractTools ...@@ -1743,7 +1796,7 @@ namespace NExtractTools
} }
// ppt -> pptt_bin // ppt -> pptt_bin
int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
// unzip pptx to temp folder // unzip pptx to temp folder
std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked")+ FILE_SEPARATOR_STR; // leading slash is very important! std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked")+ FILE_SEPARATOR_STR; // leading slash is very important!
...@@ -1753,7 +1806,8 @@ namespace NExtractTools ...@@ -1753,7 +1806,8 @@ namespace NExtractTools
pptFile.put_TempDirectory(sTemp); pptFile.put_TempDirectory(sTemp);
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword()); bool bMacros = true;
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword(), bMacros);
if (SUCCEEDED_X2T(nRes)) if (SUCCEEDED_X2T(nRes))
{ {
...@@ -3970,6 +4024,10 @@ namespace NExtractTools ...@@ -3970,6 +4024,10 @@ namespace NExtractTools
case TCD_PPT2PPTX: case TCD_PPT2PPTX:
{ {
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams); result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_PPT2PPTM:
{
result = ppt2pptm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break; }break;
case TCD_PPT2PPTT: case TCD_PPT2PPTT:
{ {
......
...@@ -115,6 +115,8 @@ namespace NExtractTools ...@@ -115,6 +115,8 @@ namespace NExtractTools
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);
int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int rtf2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int rtf2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int rtf2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int rtf2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
...@@ -261,7 +261,7 @@ namespace NExtractTools ...@@ -261,7 +261,7 @@ namespace NExtractTools
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(".pptm"))) res = TCD_PPT2PPTM;
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;
......
...@@ -108,6 +108,7 @@ namespace NExtractTools ...@@ -108,6 +108,7 @@ namespace NExtractTools
TCD_PPT2PPTX, TCD_PPT2PPTX,
TCD_PPT2PPTT, TCD_PPT2PPTT,
TCD_PPT2PPTT_BIN, TCD_PPT2PPTT_BIN,
TCD_PPT2PPTM,
//doc 2 //doc 2
TCD_DOC2DOCT, TCD_DOC2DOCT,
TCD_DOC2DOCT_BIN, TCD_DOC2DOCT_BIN,
...@@ -954,7 +955,10 @@ namespace NExtractTools ...@@ -954,7 +955,10 @@ namespace NExtractTools
else if (0 == sArg3.compare(_T("ppt2pptx"))) { else if (0 == sArg3.compare(_T("ppt2pptx"))) {
res = TCD_PPT2PPTX; res = TCD_PPT2PPTX;
} }
else if (0 == sArg3.compare(_T("doc2docx"))) { else if (0 == sArg3.compare(_T("ppt2pptm"))) {
res = TCD_PPT2PPTM;
}
else if (0 == sArg3.compare(_T("doc2docx"))) {
res = TCD_DOC2DOCX; res = TCD_DOC2DOCX;
} }
else if (0 == sArg3.compare(_T("doc2docm"))) { else if (0 == sArg3.compare(_T("doc2docm"))) {
......
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