mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fix spaces and tabs
This commit is contained in:
@ -866,10 +866,10 @@ void CGraphics::AddClipRect(double x, double y, double w, double h)
|
|||||||
_histClip->Transform.SetElements(sx, shy, shx, sy, tx, ty);
|
_histClip->Transform.SetElements(sx, shy, shx, sy, tx, ty);
|
||||||
|
|
||||||
_histClip->IsIntegerGrid = m_pRenderer->get_IntegerGrid();
|
_histClip->IsIntegerGrid = m_pRenderer->get_IntegerGrid();
|
||||||
_histClip->Rect.left = x;
|
_histClip->Rect.left = x;
|
||||||
_histClip->Rect.top = y;
|
_histClip->Rect.top = y;
|
||||||
_histClip->Rect.right = x + w;
|
_histClip->Rect.right = x + w;
|
||||||
_histClip->Rect.bottom = y + h;
|
_histClip->Rect.bottom = y + h;
|
||||||
|
|
||||||
m_oGrState.Clips.push_back(_histClip);
|
m_oGrState.Clips.push_back(_histClip);
|
||||||
|
|
||||||
|
|||||||
@ -12,11 +12,11 @@ namespace NSGraphics
|
|||||||
{
|
{
|
||||||
enum EGrStateType
|
enum EGrStateType
|
||||||
{
|
{
|
||||||
gstPen = 0,
|
gstPen = 0,
|
||||||
gstBrush = 1,
|
gstBrush = 1,
|
||||||
gstPenBrush = 2,
|
gstPenBrush = 2,
|
||||||
gstState = 3,
|
gstState = 3,
|
||||||
gstNone = 4
|
gstNone = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IGrState
|
struct IGrState
|
||||||
@ -50,16 +50,16 @@ namespace NSGraphics
|
|||||||
struct CHist_Clip
|
struct CHist_Clip
|
||||||
{
|
{
|
||||||
Aggplus::CDoubleRect Rect;
|
Aggplus::CDoubleRect Rect;
|
||||||
bool IsIntegerGrid;
|
bool IsIntegerGrid;
|
||||||
Aggplus::CMatrix Transform;
|
Aggplus::CMatrix Transform;
|
||||||
|
|
||||||
CHist_Clip() : IsIntegerGrid(false) {}
|
CHist_Clip() : IsIntegerGrid(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CGrStateState : public IGrState
|
struct CGrStateState : public IGrState
|
||||||
{
|
{
|
||||||
Aggplus::CMatrix Transform;
|
Aggplus::CMatrix Transform;
|
||||||
bool IsIntegerGrid;
|
bool IsIntegerGrid;
|
||||||
std::vector<CHist_Clip*> Clips;
|
std::vector<CHist_Clip*> Clips;
|
||||||
|
|
||||||
CGrStateState()
|
CGrStateState()
|
||||||
|
|||||||
@ -1500,119 +1500,119 @@ namespace NExtractTools
|
|||||||
|
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// doct_bin -> epub
|
// doct_bin -> epub
|
||||||
_UINT32 doct_bin2epub(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
_UINT32 doct_bin2epub(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
||||||
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
||||||
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
||||||
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
||||||
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
||||||
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
||||||
std::wstring sResult;
|
std::wstring sResult;
|
||||||
oDoctRenderer.Execute(sXml, sResult);
|
oDoctRenderer.Execute(sXml, sResult);
|
||||||
if (sResult.find(L"error") != std::wstring::npos)
|
if (sResult.find(L"error") != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CEpubFile oFile;
|
CEpubFile oFile;
|
||||||
std::wstring sEpubTemp = sTemp + FILE_SEPARATOR_STR + L"tmp";
|
std::wstring sEpubTemp = sTemp + FILE_SEPARATOR_STR + L"tmp";
|
||||||
NSDirectory::CreateDirectory(sEpubTemp);
|
NSDirectory::CreateDirectory(sEpubTemp);
|
||||||
oFile.SetTempDirectory(sEpubTemp);
|
oFile.SetTempDirectory(sEpubTemp);
|
||||||
if (S_FALSE == oFile.FromHtml(sFileFromDir + FILE_SEPARATOR_STR + L"..", sTo))
|
if (S_FALSE == oFile.FromHtml(sFileFromDir + FILE_SEPARATOR_STR + L"..", sTo))
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// doct_bin -> fb2
|
// doct_bin -> fb2
|
||||||
_UINT32 doct_bin2fb(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
_UINT32 doct_bin2fb(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
||||||
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
||||||
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
||||||
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
||||||
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
||||||
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
||||||
std::wstring sResult;
|
std::wstring sResult;
|
||||||
oDoctRenderer.Execute(sXml, sResult);
|
oDoctRenderer.Execute(sXml, sResult);
|
||||||
if (sResult.find(L"error") != std::wstring::npos)
|
if (sResult.find(L"error") != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CFb2File fb2File;
|
CFb2File fb2File;
|
||||||
fb2File.SetTmpDirectory(sTemp);
|
fb2File.SetTmpDirectory(sTemp);
|
||||||
if (S_FALSE == fb2File.FromHtml(sFileFromDir + FILE_SEPARATOR_STR + L"..", sTo))
|
if (S_FALSE == fb2File.FromHtml(sFileFromDir + FILE_SEPARATOR_STR + L"..", sTo))
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// doct_bin -> html_zip
|
// doct_bin -> html_zip
|
||||||
_UINT32 doct_bin2html_zip(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
_UINT32 doct_bin2html_zip(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::HTML;
|
||||||
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sFileFromDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
std::wstring sFileToDir = NSDirectory::GetFolderPath(sTo);
|
||||||
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
std::wstring sImagesDirectory = sFileFromDir + FILE_SEPARATOR_STR + L"media";
|
||||||
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
std::wstring sHtmlFile = sFileFromDir + FILE_SEPARATOR_STR + L"index.html";
|
||||||
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L"");
|
||||||
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
std::wstring sXml = getDoctXml(eFromType, eToType, sFileFromDir, sHtmlFile, sImagesDirectory, sThemeDir, -1, L"", params);
|
||||||
std::wstring sResult;
|
std::wstring sResult;
|
||||||
oDoctRenderer.Execute(sXml, sResult);
|
oDoctRenderer.Execute(sXml, sResult);
|
||||||
if (sResult.find(L"error") != std::wstring::npos)
|
if (sResult.find(L"error") != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
std::wcerr << L"DoctRenderer:" << sResult << std::endl;
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Удаляем Editor.bin, иначе он попадёт в архив
|
// Удаляем Editor.bin, иначе он попадёт в архив
|
||||||
NSFile::CFileBinary::Remove(sFileFromDir + FILE_SEPARATOR_STR + L"Editor.bin");
|
NSFile::CFileBinary::Remove(sFileFromDir + FILE_SEPARATOR_STR + L"Editor.bin");
|
||||||
NSDirectory::DeleteDirectory(sImagesDirectory);
|
NSDirectory::DeleteDirectory(sImagesDirectory);
|
||||||
std::wstring sName = NSFile::GetFileName(sFrom);
|
std::wstring sName = NSFile::GetFileName(sFrom);
|
||||||
size_t nDot = sName.rfind(L'.');
|
size_t nDot = sName.rfind(L'.');
|
||||||
if(nDot != std::wstring::npos)
|
if(nDot != std::wstring::npos)
|
||||||
sName.erase(nDot);
|
sName.erase(nDot);
|
||||||
COfficeUtils oZip;
|
COfficeUtils oZip;
|
||||||
if (S_FALSE == oZip.CompressFileOrDirectory(sFileFromDir, sFileToDir + FILE_SEPARATOR_STR + sName + L".zip"))
|
if (S_FALSE == oZip.CompressFileOrDirectory(sFileFromDir, sFileToDir + FILE_SEPARATOR_STR + sName + L".zip"))
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// doct_bin -> pdf
|
// doct_bin -> pdf
|
||||||
_UINT32 doct_bin2pdf(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
_UINT32 doct_bin2pdf(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::PDF;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::PDF;
|
||||||
std::wstring sTFileDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sTFileDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
std::wstring sImagesDirectory = sTFileDir + FILE_SEPARATOR_STR + _T("media");
|
std::wstring sImagesDirectory = sTFileDir + FILE_SEPARATOR_STR + _T("media");
|
||||||
std::wstring sPdfBinFile = sTFileDir + FILE_SEPARATOR_STR + _T("pdf.bin");
|
std::wstring sPdfBinFile = sTFileDir + FILE_SEPARATOR_STR + _T("pdf.bin");
|
||||||
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : _T(""));
|
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : _T(""));
|
||||||
std::wstring sXml = getDoctXml(eFromType, eToType, sTFileDir, sPdfBinFile, sImagesDirectory, sThemeDir, -1, _T(""), params);
|
std::wstring sXml = getDoctXml(eFromType, eToType, sTFileDir, sPdfBinFile, sImagesDirectory, sThemeDir, -1, _T(""), params);
|
||||||
std::wstring sResult;
|
std::wstring sResult;
|
||||||
bool bRes = oDoctRenderer.Execute(sXml, sResult);
|
bool bRes = oDoctRenderer.Execute(sXml, sResult);
|
||||||
if (sResult.find(L"error") != std::wstring::npos)
|
if (sResult.find(L"error") != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::wcerr << _T("DoctRenderer:") << sResult << std::endl;
|
std::wcerr << _T("DoctRenderer:") << sResult << std::endl;
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSFonts::IApplicationFonts* pApplicationFonts = NSFonts::NSApplication::Create();
|
NSFonts::IApplicationFonts* pApplicationFonts = NSFonts::NSApplication::Create();
|
||||||
initApplicationFonts(pApplicationFonts, params);
|
initApplicationFonts(pApplicationFonts, params);
|
||||||
|
|
||||||
|
CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA());
|
||||||
|
|
||||||
CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA());
|
|
||||||
|
|
||||||
pdfWriter.SetTempFolder(sTemp);
|
pdfWriter.SetTempFolder(sTemp);
|
||||||
pdfWriter.SetThemesPlace(sThemeDir);
|
pdfWriter.SetThemesPlace(sThemeDir);
|
||||||
|
|
||||||
@ -1623,23 +1623,23 @@ namespace NExtractTools
|
|||||||
std::wstring password = params.getSavePassword();
|
std::wstring password = params.getSavePassword();
|
||||||
if (false == password.empty())
|
if (false == password.empty())
|
||||||
pdfWriter.SetPassword(password);
|
pdfWriter.SetPassword(password);
|
||||||
|
|
||||||
int nReg = (bPaid == false) ? 0 : 1;
|
|
||||||
nRes = (S_OK == pdfWriter.OnlineWordToPdfFromBinary(sPdfBinFile, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
|
||||||
RELEASEOBJECT(pApplicationFonts);
|
|
||||||
}
|
|
||||||
//удаляем sPdfBinFile, потому что он не в Temp
|
|
||||||
if (NSFile::CFileBinary::Exists(sPdfBinFile))
|
|
||||||
NSFile::CFileBinary::Remove(sPdfBinFile);
|
|
||||||
return nRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// doct_bin -> image
|
int nReg = (bPaid == false) ? 0 : 1;
|
||||||
|
nRes = (S_OK == pdfWriter.OnlineWordToPdfFromBinary(sPdfBinFile, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
|
RELEASEOBJECT(pApplicationFonts);
|
||||||
|
}
|
||||||
|
//удаляем sPdfBinFile, потому что он не в Temp
|
||||||
|
if (NSFile::CFileBinary::Exists(sPdfBinFile))
|
||||||
|
NSFile::CFileBinary::Remove(sPdfBinFile);
|
||||||
|
return nRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// doct_bin -> image
|
||||||
_UINT32 doct_bin2image(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
_UINT32 doct_bin2image(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::PDF;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eToType = NSDoctRenderer::DoctRendererFormat::FormatFile::PDF;
|
||||||
std::wstring sTFileDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sTFileDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
std::wstring sImagesDirectory = sTFileDir + FILE_SEPARATOR_STR + _T("media");
|
std::wstring sImagesDirectory = sTFileDir + FILE_SEPARATOR_STR + _T("media");
|
||||||
std::wstring sPdfBinFile = sTFileDir + FILE_SEPARATOR_STR + _T("pdf.bin");
|
std::wstring sPdfBinFile = sTFileDir + FILE_SEPARATOR_STR + _T("pdf.bin");
|
||||||
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : _T(""));
|
NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : _T(""));
|
||||||
@ -3309,7 +3309,7 @@ namespace NExtractTools
|
|||||||
if (!bIsOnlyFirst)
|
if (!bIsOnlyFirst)
|
||||||
{
|
{
|
||||||
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
|
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
|
||||||
NSDirectory::CreateDirectory(sThumbnailDir);
|
NSDirectory::CreateDirectory(sThumbnailDir);
|
||||||
sFileToExt = getExtentionByRasterFormat(nRasterFormat);
|
sFileToExt = getExtentionByRasterFormat(nRasterFormat);
|
||||||
}
|
}
|
||||||
int nPagesCount = pReader->GetPagesCount();
|
int nPagesCount = pReader->GetPagesCount();
|
||||||
@ -3380,15 +3380,15 @@ namespace NExtractTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
_UINT32 fromDocxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
_UINT32 fromDocxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
bool bIsNeedDoct = false;
|
bool bIsNeedDoct = false;
|
||||||
switch (nFormatTo)
|
switch (nFormatTo)
|
||||||
{
|
{
|
||||||
// перечислить все "документные" форматы, которым нужна конвертация через doct
|
// перечислить все "документные" форматы, которым нужна конвертация через doct
|
||||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER:
|
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER:
|
||||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2:
|
case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2:
|
||||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB:
|
case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB:
|
||||||
bIsNeedDoct = true;
|
bIsNeedDoct = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -3427,98 +3427,98 @@ namespace NExtractTools
|
|||||||
nRes = dir2zip(sFrom, sTo, true);
|
nRes = dir2zip(sFrom, sTo, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2doc(sFrom, sTo, sTemp, params);
|
nRes = docx_dir2doc(sFrom, sTo, sTemp, params);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, false);
|
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, false);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, true);
|
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, true);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2rtf(sFrom, sTo, sTemp, params);
|
nRes = docx_dir2rtf(sFrom, sTo, sTemp, params);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2txt(sFrom, sTo, sTemp, params);
|
nRes = docx_dir2txt(sFrom, sTo, sTemp, params);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatTo)
|
||||||
{
|
{
|
||||||
nRes = docx_dir2doct_bin(sFrom, sTo, sTemp, params);
|
nRes = docx_dir2doct_bin(sFrom, sTo, sTemp, params);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring sDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
std::wstring sDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
||||||
NSDirectory::CreateDirectory(sDoctDir);
|
NSDirectory::CreateDirectory(sDoctDir);
|
||||||
std::wstring sTFile = sDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
std::wstring sTFile = sDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||||
|
|
||||||
nRes = docx_dir2doct_bin(sFrom, sTFile, sTemp, params);
|
nRes = docx_dir2doct_bin(sFrom, sTFile, sTemp, params);
|
||||||
|
|
||||||
if(SUCCEEDED_X2T(nRes))
|
if(SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
nRes = fromDoctBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
nRes = fromDoctBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 fromDoctBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
_UINT32 fromDoctBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;
|
_UINT32 nRes = 0;
|
||||||
if(AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == nFormatTo)
|
if(AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == nFormatTo)
|
||||||
{
|
{
|
||||||
std::wstring sFromDir = NSDirectory::GetFolderPath(sFrom);
|
std::wstring sFromDir = NSDirectory::GetFolderPath(sFrom);
|
||||||
nRes = dir2zip(sFromDir, sTo);
|
nRes = dir2zip(sFromDir, sTo);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB == nFormatTo)
|
||||||
{
|
{
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||||
nRes = doct_bin2epub(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
nRes = doct_bin2epub(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 == nFormatTo)
|
||||||
{
|
{
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||||
nRes = doct_bin2fb(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
nRes = doct_bin2fb(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER == nFormatTo)
|
||||||
{
|
{
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||||
nRes = doct_bin2html_zip(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
nRes = doct_bin2html_zip(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||||
}
|
}
|
||||||
else if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatTo)
|
else if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatTo)
|
||||||
{
|
{
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||||
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||||
}
|
}
|
||||||
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
||||||
{
|
{
|
||||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||||
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||||
}
|
}
|
||||||
else if(0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatTo))
|
else if(0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatTo))
|
||||||
{
|
{
|
||||||
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
||||||
NSDirectory::CreateDirectory(sDocxDir);
|
NSDirectory::CreateDirectory(sDocxDir);
|
||||||
nRes = doct_bin2docx_dir(sFrom, sTo, sDocxDir, bFromChanges, sThemeDir, params);
|
nRes = doct_bin2docx_dir(sFrom, sTo, sDocxDir, bFromChanges, sThemeDir, params);
|
||||||
if(SUCCEEDED_X2T(nRes))
|
if(SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
nRes = fromDocxDir(sDocxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
nRes = fromDocxDir(sDocxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
|
nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 fromDocument(const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTemp, InputParams& params)
|
_UINT32 fromDocument(const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sTo = *params.m_sFileTo;
|
std::wstring sTo = *params.m_sFileTo;
|
||||||
int nFormatTo = AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
int nFormatTo = AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||||
if(NULL != params.m_nFormatTo)
|
if(NULL != params.m_nFormatTo)
|
||||||
@ -4204,30 +4204,30 @@ namespace NExtractTools
|
|||||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
_UINT32 xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
_UINT32 xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
bool bMacros = false;
|
bool bMacros = false;
|
||||||
|
|
||||||
int lcid = (NULL != params.m_nLcid) ? *params.m_nLcid : -1;
|
int lcid = (NULL != params.m_nLcid) ? *params.m_nLcid : -1;
|
||||||
|
|
||||||
_UINT32 nRes = ConvertXls2Xlsx( sFrom, sTo, params.getPassword(), params.getFontPath(), sTemp, lcid, bMacros);
|
_UINT32 nRes = ConvertXls2Xlsx( sFrom, sTo, params.getPassword(), params.getFontPath(), sTemp, lcid, bMacros);
|
||||||
|
|
||||||
nRes = processEncryptionError(nRes, sFrom, params);
|
nRes = processEncryptionError(nRes, sFrom, params);
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// xls -> xlsm
|
// xls -> xlsm
|
||||||
_UINT32 xls2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
_UINT32 xls2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sResultXlsmDir = sTemp + FILE_SEPARATOR_STR + _T("xlsm_unpacked");
|
std::wstring sResultXlsmDir = sTemp + FILE_SEPARATOR_STR + _T("xlsm_unpacked");
|
||||||
|
|
||||||
NSDirectory::CreateDirectory(sResultXlsmDir);
|
NSDirectory::CreateDirectory(sResultXlsmDir);
|
||||||
|
|
||||||
_UINT32 nRes = xls2xlsm_dir(sFrom, sResultXlsmDir, sTemp, params);
|
_UINT32 nRes = xls2xlsm_dir(sFrom, sResultXlsmDir, sTemp, params);
|
||||||
|
|
||||||
if(SUCCEEDED_X2T(nRes))
|
if(SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
COfficeUtils oCOfficeUtils(NULL);
|
COfficeUtils oCOfficeUtils(NULL);
|
||||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultXlsmDir, sTo, true))
|
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultXlsmDir, sTo, true))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
@ -4239,48 +4239,48 @@ namespace NExtractTools
|
|||||||
|
|
||||||
nRes = processEncryptionError(nRes, sFrom, params);
|
nRes = processEncryptionError(nRes, sFrom, params);
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
// xls -> xlst
|
// xls -> xlst
|
||||||
_UINT32 xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
_UINT32 xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
// Extract xlsx to temp directory
|
// Extract xlsx to temp directory
|
||||||
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("xlst_unpacked");
|
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("xlst_unpacked");
|
||||||
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||||
|
|
||||||
NSDirectory::CreateDirectory(sResultDoctDir);
|
NSDirectory::CreateDirectory(sResultDoctDir);
|
||||||
|
|
||||||
_UINT32 nRes = xls2xlst_bin(sFrom, sResultDoctFileEditor, sTemp, params);
|
_UINT32 nRes = xls2xlst_bin(sFrom, sResultDoctFileEditor, sTemp, params);
|
||||||
|
|
||||||
if (SUCCEEDED_X2T(nRes))
|
if (SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
COfficeUtils oCOfficeUtils(NULL);
|
COfficeUtils oCOfficeUtils(NULL);
|
||||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// xls -> xlst_bin
|
// xls -> xlst_bin
|
||||||
_UINT32 xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
_UINT32 xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sResultXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked");
|
std::wstring sResultXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked");
|
||||||
|
|
||||||
NSDirectory::CreateDirectory(sResultXlsxDir);
|
NSDirectory::CreateDirectory(sResultXlsxDir);
|
||||||
|
|
||||||
bool bMacros = true;
|
bool bMacros = true;
|
||||||
_UINT32 nRes = ConvertXls2Xlsx( sFrom, sResultXlsxDir, params.getPassword(), params.getFontPath(), sTemp, NULL, bMacros);
|
_UINT32 nRes = ConvertXls2Xlsx( sFrom, sResultXlsxDir, params.getPassword(), params.getFontPath(), sTemp, NULL, bMacros);
|
||||||
|
|
||||||
nRes = processEncryptionError(nRes, sFrom, params);
|
nRes = processEncryptionError(nRes, sFrom, params);
|
||||||
if (SUCCEEDED_X2T(nRes))
|
if (SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||||
|
|
||||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||||
|
|
||||||
return m_oCXlsxSerializer.saveToFile (sTo, sResultXlsxDir, params.getXmlOptions());
|
return m_oCXlsxSerializer.saveToFile (sTo, sResultXlsxDir, params.getXmlOptions());
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 html2doct_bin(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
_UINT32 html2doct_bin(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
||||||
@ -4305,18 +4305,18 @@ namespace NExtractTools
|
|||||||
}
|
}
|
||||||
_UINT32 html2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
_UINT32 html2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
||||||
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||||
|
|
||||||
NSDirectory::CreateDirectory(sResultDoctDir);
|
NSDirectory::CreateDirectory(sResultDoctDir);
|
||||||
|
|
||||||
_UINT32 nRes = html2doct_bin(sFrom, sResultDoctFileEditor, sTemp, params);
|
_UINT32 nRes = html2doct_bin(sFrom, sResultDoctFileEditor, sTemp, params);
|
||||||
|
|
||||||
if (SUCCEEDED_X2T(nRes))
|
if (SUCCEEDED_X2T(nRes))
|
||||||
{
|
{
|
||||||
COfficeUtils oCOfficeUtils(NULL);
|
COfficeUtils oCOfficeUtils(NULL);
|
||||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 html_zip2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
_UINT32 html_zip2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||||
@ -4335,7 +4335,7 @@ namespace NExtractTools
|
|||||||
}
|
}
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 html2docx(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
_UINT32 html2docx(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||||
{
|
{
|
||||||
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
||||||
NSDirectory::CreateDirectory(sDocxDir);
|
NSDirectory::CreateDirectory(sDocxDir);
|
||||||
@ -4366,17 +4366,17 @@ namespace NExtractTools
|
|||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
_UINT32 detectMacroInFile(InputParams& oInputParams)
|
_UINT32 detectMacroInFile(InputParams& oInputParams)
|
||||||
{
|
{
|
||||||
_UINT32 nRes = 0;// no macro
|
_UINT32 nRes = 0;// no macro
|
||||||
std::wstring sFileFrom = *oInputParams.m_sFileFrom;
|
std::wstring sFileFrom = *oInputParams.m_sFileFrom;
|
||||||
|
|
||||||
COfficeFileFormatChecker OfficeFileFormatChecker;
|
COfficeFileFormatChecker OfficeFileFormatChecker;
|
||||||
|
|
||||||
if (OfficeFileFormatChecker.isOfficeFile(sFileFrom))
|
if (OfficeFileFormatChecker.isOfficeFile(sFileFrom))
|
||||||
{
|
{
|
||||||
if (OfficeFileFormatChecker.bMacroEnabled)
|
if (OfficeFileFormatChecker.bMacroEnabled)
|
||||||
{
|
{
|
||||||
nRes = AVS_ERROR_MACRO;
|
nRes = AVS_ERROR_MACRO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nRes;
|
return nRes;
|
||||||
@ -4458,7 +4458,7 @@ namespace NExtractTools
|
|||||||
return AVS_FILEUTILS_ERROR_CONVERT_LIMITS;
|
return AVS_FILEUTILS_ERROR_CONVERT_LIMITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDoctRenderer::CDocBuilder::Initialize();
|
NSDoctRenderer::CDocBuilder::Initialize();
|
||||||
|
|
||||||
_UINT32 result = 0;
|
_UINT32 result = 0;
|
||||||
switch(conversion)
|
switch(conversion)
|
||||||
@ -4663,20 +4663,20 @@ namespace NExtractTools
|
|||||||
}break;
|
}break;
|
||||||
case TCD_BIN2T:
|
case TCD_BIN2T:
|
||||||
{
|
{
|
||||||
result = dir2zip (NSDirectory::GetFolderPath(sFileFrom), sFileTo);
|
result = dir2zip (NSDirectory::GetFolderPath(sFileFrom), sFileTo);
|
||||||
}break;
|
}break;
|
||||||
case TCD_T2BIN:
|
case TCD_T2BIN:
|
||||||
{
|
{
|
||||||
result = zip2dir (sFileFrom, NSDirectory::GetFolderPath(sFileTo));
|
result = zip2dir (sFileFrom, NSDirectory::GetFolderPath(sFileTo));
|
||||||
}break;
|
}break;
|
||||||
case TCD_PPT2PPTX:
|
case TCD_PPT2PPTX:
|
||||||
{
|
{
|
||||||
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
}break;
|
}break;
|
||||||
case TCD_PPT2PPTM:
|
case TCD_PPT2PPTM:
|
||||||
{
|
{
|
||||||
result = ppt2pptm (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = ppt2pptm (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
}break;
|
}break;
|
||||||
case TCD_PPT2PPTT:
|
case TCD_PPT2PPTT:
|
||||||
{
|
{
|
||||||
result = ppt2pptt (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = ppt2pptt (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
@ -4760,7 +4760,7 @@ namespace NExtractTools
|
|||||||
case TCD_ODF2OOT_BIN:
|
case TCD_ODF2OOT_BIN:
|
||||||
{
|
{
|
||||||
result = odf2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = odf2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
}break;
|
}break;
|
||||||
case TCD_ODF_FLAT2OOX:
|
case TCD_ODF_FLAT2OOX:
|
||||||
{
|
{
|
||||||
result = odf_flat2oox (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = odf_flat2oox (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
@ -4772,7 +4772,7 @@ namespace NExtractTools
|
|||||||
case TCD_ODF_FLAT2OOT_BIN:
|
case TCD_ODF_FLAT2OOT_BIN:
|
||||||
{
|
{
|
||||||
result = odf_flat2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = odf_flat2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
}break;
|
}break;
|
||||||
case TCD_DOCX2ODT:
|
case TCD_DOCX2ODT:
|
||||||
{
|
{
|
||||||
result = docx2odt (sFileFrom, sFileTo, sTempDir, oInputParams);
|
result = docx2odt (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||||
@ -4894,7 +4894,7 @@ namespace NExtractTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
//clean up v8
|
//clean up v8
|
||||||
// NSDoctRenderer::CDocBuilder::Dispose();
|
// NSDoctRenderer::CDocBuilder::Dispose();
|
||||||
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
|
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
|
||||||
{
|
{
|
||||||
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;
|
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;
|
||||||
|
|||||||
Reference in New Issue
Block a user