Commit c7dec2d2 authored by ElenaSubbotina's avatar ElenaSubbotina

x2t ver 2.0.2.390

parent 3d9308d0
......@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.0.2.389
VERSION = 2.0.2.390
DEFINES += INTVER=$$VERSION
TEMPLATE = app
......
......@@ -920,13 +920,25 @@ namespace NExtractTools
FileSystem::Directory::CreateDirectory(sResultDocxDir);
int nRes = doc2docx_dir(sFrom, sResultDocxDir, sTemp, params);
if(SUCCEEDED_X2T(nRes))
long hRes = doc2docx_dir(sFrom, sResultDocxDir, sTemp, params);
if(SUCCEEDED_X2T(hRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDocxDir, sTo, -1))
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 doc2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
......@@ -958,7 +970,7 @@ namespace NExtractTools
FileSystem::Directory::CreateDirectory(sResultDoctDir);
int nRes = doc2doct_bin(sFrom, sResultDoctFileEditor, sTemp, params);
long nRes = doc2doct_bin(sFrom, sResultDoctFileEditor, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
......@@ -979,7 +991,9 @@ namespace NExtractTools
COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp;
if (docFile.LoadFromFile( sFrom, sResultDocxDir, params.getPassword(), NULL)== S_OK)
long nRes = docFile.LoadFromFile( sFrom, sResultDocxDir, params.getPassword(), NULL);
if (SUCCEEDED_X2T(nRes))
{
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
......@@ -991,7 +1005,18 @@ namespace NExtractTools
int res = m_oCDocxSerializer.saveToFile (std_string2string(sTo), std_string2string(sResultDocxDir), std_string2string(xml_options)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return res;
}
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;
}
......@@ -1298,11 +1323,12 @@ namespace NExtractTools
}
int mscrypt2oox (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring password = params.getPassword();
//decrypt to sTo
ECMACryptReader cryptReader;
if (cryptReader.DecryptOfficeFile(sFrom, sTo, params.getPassword()) == false)
if (cryptReader.DecryptOfficeFile(sFrom, sTo, password) == false)
{
if (params.getPassword().empty()) return AVS_FILEUTILS_ERROR_CONVERT_DRM;
if (password.empty()) return AVS_FILEUTILS_ERROR_CONVERT_DRM;
else return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
......@@ -1343,14 +1369,20 @@ namespace NExtractTools
}
int fromMscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring sResultDecryptFile = sTemp + FILE_SEPARATOR_STR + L"uncrypt_file.oox";
std::wstring password = params.getPassword();
COfficeFileFormatChecker OfficeFileFormatChecker;
if (OfficeFileFormatChecker.isOfficeFile(sFrom))
if (password.empty())
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO)
if(!params.getDontSaveAdditional())
{
int nRes = mscrypt2oox(sFrom, sResultDecryptFile, sTemp, params);
copyOrigin(sFrom, sTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
std::wstring sResultDecryptFile = sTemp + FILE_SEPARATOR_STR + L"uncrypt_file.oox";
long nRes = mscrypt2oox(sFrom, sResultDecryptFile, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
......@@ -1376,21 +1408,19 @@ namespace NExtractTools
}
}
}
else if (AVS_FILEUTILS_ERROR_CONVERT_DRM == nRes && !params.getDontSaveAdditional())
else if (AVS_ERROR_DRM == nRes)
{
copyOrigin(sFrom, sTo);
}
}
else
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, sTo);
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else
else if (AVS_ERROR_PASSWORD == nRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_UNKNOWN_FORMAT;
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return 0;
return nRes;
}
//html
int html2doct_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
......
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