Commit 8c751544 authored by ElenaSubbotina's avatar ElenaSubbotina

Merge remote-tracking branch 'origin/release/v4.4.1' into develop

parents 1d16f4ab 122a5cd0
......@@ -1148,6 +1148,7 @@ namespace NSFile
#if defined(__linux__) || defined(_MAC) && !defined(_IOS)
char buf[NS_FILE_MAX_PATH];
memset(buf, 0, NS_FILE_MAX_PATH);
if (readlink ("/proc/self/exe", buf, NS_FILE_MAX_PATH) <= 0)
{
#ifdef _MAC
......
......@@ -860,13 +860,26 @@ namespace NExtractTools
NSDirectory::CreateDirectory(sResultPptxDir);
int nRes = ppt2pptx_dir(sFrom, sResultPptxDir, sTemp, params);
if(SUCCEEDED_X2T(nRes))
int hRes = ppt2pptx_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 ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
......@@ -874,7 +887,22 @@ namespace NExtractTools
COfficePPTFile pptFile;
pptFile.put_TempDirectory(sTemp);
return S_OK == pptFile.LoadFromFile(sFrom, sTo, params.getPassword()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword());
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
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
......@@ -905,22 +933,36 @@ namespace NExtractTools
pptFile.put_TempDirectory(sTemp);
if ( pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword()) != S_OK) return AVS_FILEUTILS_ERROR_CONVERT;
// convert unzipped pptx to unzipped pptt
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword());
int nRes = 0;
if (SUCCEEDED_X2T(nRes))
{
// convert unzipped pptx to unzipped pptt
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
if (pptx_file)
{
pptx_file->SetFontDir (params.getFontPath());
nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
if (pptx_file)
{
pptx_file->SetFontDir (params.getFontPath());
nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
delete pptx_file;
}
delete pptx_file;
}
return nRes;
return nRes;
}
else if (AVS_ERROR_DRM == nRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == nRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
// pptx -> odp
......
......@@ -138,13 +138,15 @@ static std::wstring utf8_to_unicode(const char *src)
InputParams oInputParams;
oInputParams.m_sFileFrom = new std::wstring(sArg1);
oInputParams.m_sFileTo = new std::wstring(sArg2);
oInputParams.m_sPassword = new std::wstring(L"password");
// get conversion direction from 3rd argument
if (argc > 3)
{
oInputParams.m_sFontDir = new std::wstring(sArg3);
}
if (argc > 4)
{
oInputParams.m_sPassword = new std::wstring(sArg4);
}
result = NExtractTools::fromInputParams(oInputParams);
}
......
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