Commit cf2aaa04 authored by ElenaSubbotina's avatar ElenaSubbotina

x2t - add template for decrypt

parent 3e44b5d8
...@@ -119,17 +119,6 @@ namespace DocFileFormat ...@@ -119,17 +119,6 @@ namespace DocFileFormat
lineWeight = reader->ReadInt16(); lineWeight = reader->ReadInt16();
lineStyle = reader->ReadInt16(); lineStyle = reader->ReadInt16();
} }
const static int shemeDefaultColor[] =
{
0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF,
0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF,
0x00800000, 0x00008000, 0x00000080, 0x00808000, 0x00800080, 0x00008080, 0x00C0C0C0, 0x00808080,
0x009999FF, 0x00993366, 0x00FFFFCC, 0x00CCFFFF, 0x00660066, 0x00FF8080, 0x000066CC, 0x00CCCCFF,
0x00000080, 0x00FF00FF, 0x00FFFF00, 0x0000FFFF, 0x00800080, 0x00800000, 0x00008080, 0x000000FF,
0x0000CCFF, 0x00CCFFFF, 0x00CCFFCC, 0x00FFFF99, 0x0099CCFF, 0x00FF99CC, 0x00CC99FF, 0x00FFCC99,
0x003366FF, 0x0033CCCC, 0x0099CC00, 0x00FFCC00, 0x00FF9900, 0x00FF6600, 0x00666699, 0x00969696,
0x00003366, 0x00339966, 0x00003300, 0x00333300, 0x00993300, 0x00993366, 0x00333399, 0x00333333
};
long DrawingPrimitive::read_color(VirtualStreamReader* reader) long DrawingPrimitive::read_color(VirtualStreamReader* reader)
{ {
...@@ -223,6 +212,7 @@ namespace DocFileFormat ...@@ -223,6 +212,7 @@ namespace DocFileFormat
read_fill (reader); read_fill (reader);
read_shadow (reader); read_shadow (reader);
} }
DrawingPrimitiveTextBox::DrawingPrimitiveTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitiveRect(reader, length) DrawingPrimitiveTextBox::DrawingPrimitiveTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitiveRect(reader, length)
{ {
} }
...@@ -253,6 +243,8 @@ namespace DocFileFormat ...@@ -253,6 +243,8 @@ namespace DocFileFormat
DrawingPrimitiveCTextBox::~DrawingPrimitiveCTextBox() DrawingPrimitiveCTextBox::~DrawingPrimitiveCTextBox()
{ {
if (polyline) delete polyline;
if (txbx) delete txbx;
} }
DrawingPrimitivePolyline::DrawingPrimitivePolyline(VirtualStreamReader *reader, int length) : DrawingPrimitiveLine(reader, length, false) DrawingPrimitivePolyline::DrawingPrimitivePolyline(VirtualStreamReader *reader, int length) : DrawingPrimitiveLine(reader, length, false)
......
...@@ -142,7 +142,7 @@ namespace NExtractTools ...@@ -142,7 +142,7 @@ namespace NExtractTools
return nRes; return nRes;
} }
// bin -> docx dir // bin -> docx dir
int doct_bin2docx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sToDir, const std::wstring &sFontPath, bool bFromChanges, const std::wstring &sThemeDir, const InputParams& params) int doct_bin2docx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, const std::wstring &sFontPath, bool bFromChanges, const std::wstring &sThemeDir, const InputParams& params)
{ {
int nRes = 0; int nRes = 0;
std::wstring sTargetBin; std::wstring sTargetBin;
...@@ -162,7 +162,7 @@ namespace NExtractTools ...@@ -162,7 +162,7 @@ namespace NExtractTools
CString sMediaPath; // will be filled by 'CreateDocxFolders' method CString sMediaPath; // will be filled by 'CreateDocxFolders' method
CString sEmbedPath; // will be filled by 'CreateDocxFolders' method CString sEmbedPath; // will be filled by 'CreateDocxFolders' method
CString sToDir2 = std_string2string(sToDir); CString sToDir2 = std_string2string(sTo);
m_oCDocxSerializer.CreateDocxFolders (sToDir2, sThemePath, sMediaPath, sEmbedPath); m_oCDocxSerializer.CreateDocxFolders (sToDir2, sThemePath, sMediaPath, sEmbedPath);
if (SUCCEEDED_X2T(nRes)) if (SUCCEEDED_X2T(nRes))
...@@ -882,13 +882,13 @@ namespace NExtractTools ...@@ -882,13 +882,13 @@ namespace NExtractTools
} }
// doc -> docx // doc -> docx
int doc2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp) int doc2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const InputParams& params)
{ {
std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked"); std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
FileSystem::Directory::CreateDirectory(sResultDocxDir); FileSystem::Directory::CreateDirectory(sResultDocxDir);
int nRes = doc2docx_dir(sFrom, sResultDocxDir, sTemp); int nRes = doc2docx_dir(sFrom, sResultDocxDir, sTemp, params);
if(SUCCEEDED_X2T(nRes)) if(SUCCEEDED_X2T(nRes))
{ {
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
...@@ -897,16 +897,16 @@ namespace NExtractTools ...@@ -897,16 +897,16 @@ namespace NExtractTools
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int doc2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp) int doc2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const InputParams& params)
{ {
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp; docFile.m_sTempFolder = sTemp;
return S_OK == docFile.LoadFromFile( sFrom, sTo, L"", NULL) ? 0 : AVS_FILEUTILS_ERROR_CONVERT; return S_OK == docFile.LoadFromFile( sFrom, sTo, params.m_sPassword ? *params.m_sPassword : L"", NULL) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
} }
// doc -> doct // doc -> doct
int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath) int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath)
{ {
// Extract docx to temp directory // Extract docx to temp directory
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked"); std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
...@@ -914,7 +914,7 @@ namespace NExtractTools ...@@ -914,7 +914,7 @@ namespace NExtractTools
FileSystem::Directory::CreateDirectory(sResultDoctDir); FileSystem::Directory::CreateDirectory(sResultDoctDir);
int nRes = doc2doct_bin(sFrom, sResultDoctFileEditor, sTemp, sFontPath); int nRes = doc2doct_bin(sFrom, sResultDoctFileEditor, sPassword, sTemp, sFontPath);
if (SUCCEEDED_X2T(nRes)) if (SUCCEEDED_X2T(nRes))
{ {
...@@ -926,7 +926,7 @@ namespace NExtractTools ...@@ -926,7 +926,7 @@ namespace NExtractTools
} }
// doc -> doct_bin // doc -> doct_bin
int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath) int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath)
{ {
std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked"); std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
...@@ -935,7 +935,7 @@ namespace NExtractTools ...@@ -935,7 +935,7 @@ namespace NExtractTools
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp; docFile.m_sTempFolder = sTemp;
if (docFile.LoadFromFile( sFrom, sResultDocxDir, L"", NULL)== S_OK) if (docFile.LoadFromFile( sFrom, sResultDocxDir, sPassword, NULL)== S_OK)
{ {
BinDocxRW::CDocxSerializer m_oCDocxSerializer; BinDocxRW::CDocxSerializer m_oCDocxSerializer;
...@@ -1216,6 +1216,7 @@ namespace NExtractTools ...@@ -1216,6 +1216,7 @@ namespace NExtractTools
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath ) int xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath )
{ {
std::wstring sTempUnpackedODS = sTemp + FILE_SEPARATOR_STR + _T("ods_unpacked"); std::wstring sTempUnpackedODS = sTemp + FILE_SEPARATOR_STR + _T("ods_unpacked");
...@@ -1236,7 +1237,41 @@ namespace NExtractTools ...@@ -1236,7 +1237,41 @@ namespace NExtractTools
{ {
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int mscrypt2oot (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, const std::wstring &sFontPath, const InputParams& params)
{
std::wstring sResultOotDir = sTemp + FILE_SEPARATOR_STR + _T("oot_unpacked");
std::wstring sResultOotFileEditor = sResultOotDir + FILE_SEPARATOR_STR + _T("Editor.bin");
FileSystem::Directory::CreateDirectory(sResultOotDir);
int nRes = mscrypt2oot_bin(sFrom, sResultOotFileEditor, sTemp, sFontPath, params);
if (SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultOotDir, sTo, -1)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
return nRes;
}
int mscrypt2oot_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, const std::wstring &sFontPath, const InputParams& params)
{
if (!params.m_sPassword) return AVS_FILEUTILS_ERROR_CONVERT_DRM;
if ( params.m_sPassword->empty()) return AVS_FILEUTILS_ERROR_CONVERT_DRM;
//decrypt to temp
std::wstring sResultDecryptDir = sTemp + FILE_SEPARATOR_STR + _T("crypt_unpacked");
FileSystem::Directory::CreateDirectory(sResultDecryptDir);
//convert from format (detect before) to temp binary folder
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
//html //html
int html2doct_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const InputParams& params) int html2doct_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const InputParams& params)
{ {
...@@ -1567,7 +1602,7 @@ namespace NExtractTools ...@@ -1567,7 +1602,7 @@ namespace NExtractTools
} }
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatFrom) else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatFrom)
{ {
nRes = doc2docx_dir(sFrom, sDocxDir, sTemp); nRes = doc2docx_dir(sFrom, sDocxDir, sTemp, params);
} }
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatFrom) else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatFrom)
{ {
...@@ -1890,7 +1925,7 @@ namespace NExtractTools ...@@ -1890,7 +1925,7 @@ namespace NExtractTools
FileSystem::Directory::CreateDirectory(sResultDocxDir); FileSystem::Directory::CreateDirectory(sResultDocxDir);
int nRes = xls2xlsx_dir(sFrom, sResultDocxDir, sFontPath, sTemp, params); int nRes = xls2xlsx_dir(sFrom, sResultDocxDir, sTemp, sFontPath, params);
if(SUCCEEDED_X2T(nRes)) if(SUCCEEDED_X2T(nRes))
{ {
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
......
This diff is collapsed.
...@@ -165,43 +165,43 @@ namespace NExtractTools ...@@ -165,43 +165,43 @@ namespace NExtractTools
}break; }break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PDF: case AVS_OFFICESTUDIO_FILE_CANVAS_PDF:
{ {
if (0 == sExt2.compare(_T(".pdf"))) res = TCD_BIN2PDF; if (0 == sExt2.compare(_T(".pdf"))) res = TCD_BIN2PDF;
}break; }break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
{ {
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX; if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST; else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN;
}break; }break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN;
}break; }break;
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(".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;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT: case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN;
}break; }break;
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(".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;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT: case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS:
...@@ -215,6 +215,13 @@ namespace NExtractTools ...@@ -215,6 +215,13 @@ namespace NExtractTools
0 == sExt2.compare(_T(".xlsx")) || 0 == sExt2.compare(_T(".xlsx")) ||
0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX; 0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX;
}break; }break;
case AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO:
{
if (0 == sExt2.compare(_T(".doct"))) res = TCD_MSCRYPT2DOCT;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_MSCRYPT2XLST;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_MSCRYPT2PPTT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_MSCRYPT2BIN;
}break;
} }
} }
} }
......
...@@ -132,7 +132,12 @@ namespace NExtractTools ...@@ -132,7 +132,12 @@ namespace NExtractTools
TCD_XML2DOCX, TCD_XML2DOCX,
TCD_DOCX2XML, TCD_DOCX2XML,
//
TCD_MSCRYPT2DOCT,
TCD_MSCRYPT2XLST,
TCD_MSCRYPT2PPTT,
TCD_MSCRYPT2BIN,
//
TCD_MAILMERGE, TCD_MAILMERGE,
TCD_T2, TCD_T2,
TCD_DOCT_BIN2, TCD_DOCT_BIN2,
......
This diff is collapsed.
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