Commit a197743a authored by konovalovsergey's avatar konovalovsergey Committed by Alexander Trofimov

add param:password; error: drm, password

parent 39a3fd1b
...@@ -206,3 +206,5 @@ ...@@ -206,3 +206,5 @@
#define AVS_FILEUTILS_ERROR_CONVERT_LIBREOFFICE (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0057) #define AVS_FILEUTILS_ERROR_CONVERT_LIBREOFFICE (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0057)
#define AVS_FILEUTILS_ERROR_CONVERT_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0058) #define AVS_FILEUTILS_ERROR_CONVERT_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0058)
#define AVS_FILEUTILS_ERROR_CONVERT_NEED_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0059) #define AVS_FILEUTILS_ERROR_CONVERT_NEED_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0059)
#define AVS_FILEUTILS_ERROR_CONVERT_DRM (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005a)
#define AVS_FILEUTILS_ERROR_CONVERT_PASSWORD (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005b)
This diff is collapsed.
...@@ -63,8 +63,8 @@ namespace NExtractTools ...@@ -63,8 +63,8 @@ namespace NExtractTools
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 &sTemp, const std::wstring &sFontPath);
int docx_dir2doc (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath); int docx_dir2doc (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath);
int xls2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath); int xls2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath, const InputParams& params);
int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath); int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sFontPath, const InputParams& params);
int xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions); int xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions);
int xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions); int xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions);
...@@ -95,7 +95,7 @@ namespace NExtractTools ...@@ -95,7 +95,7 @@ namespace NExtractTools
int fromXlsxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params); int fromXlsxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params);
int fromXlstBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params); int fromXlstBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params);
int fromSpreadsheet (const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sPassword, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params); int fromSpreadsheet (const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params);
int fromPptxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params); int fromPptxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params);
int fromPpttBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params); int fromPpttBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sFontPath, const std::wstring &sXmlOptions, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, const InputParams& params);
......
...@@ -124,6 +124,12 @@ namespace NExtractTools ...@@ -124,6 +124,12 @@ namespace NExtractTools
TCSVD_SPACE = 5 TCSVD_SPACE = 5
} TCsvDelimiter; } TCsvDelimiter;
static bool copyOrigin(const std::wstring& sFileFrom, const std::wstring& sFileTo)
{
size_t nIndex = sFileFrom.rfind('.');
return NSFile::CFileBinary::Copy(sFileFrom, NSSystemPath::GetDirectoryName(sFileTo) + FILE_SEPARATOR_STR + _T("origin") + sFileFrom.substr(nIndex));
}
class InputParamsMailMerge class InputParamsMailMerge
{ {
public: public:
...@@ -235,6 +241,7 @@ namespace NExtractTools ...@@ -235,6 +241,7 @@ namespace NExtractTools
InputParamsMailMerge* m_oMailMergeSend; InputParamsMailMerge* m_oMailMergeSend;
int* m_nDoctParams; int* m_nDoctParams;
std::wstring* m_sHtmlFileInternalPath; std::wstring* m_sHtmlFileInternalPath;
std::wstring* m_sPassword;
public: public:
InputParams() InputParams()
{ {
...@@ -254,6 +261,7 @@ namespace NExtractTools ...@@ -254,6 +261,7 @@ namespace NExtractTools
m_oMailMergeSend = NULL; m_oMailMergeSend = NULL;
m_nDoctParams = NULL; m_nDoctParams = NULL;
m_sHtmlFileInternalPath = NULL; m_sHtmlFileInternalPath = NULL;
m_sPassword = NULL;
} }
~InputParams() ~InputParams()
{ {
...@@ -273,6 +281,7 @@ namespace NExtractTools ...@@ -273,6 +281,7 @@ namespace NExtractTools
RELEASEOBJECT(m_oMailMergeSend); RELEASEOBJECT(m_oMailMergeSend);
RELEASEOBJECT(m_nDoctParams); RELEASEOBJECT(m_nDoctParams);
RELEASEOBJECT(m_sHtmlFileInternalPath); RELEASEOBJECT(m_sHtmlFileInternalPath);
RELEASEOBJECT(m_sPassword);
} }
bool FromXmlFile(std::wstring sFilename) bool FromXmlFile(std::wstring sFilename)
...@@ -329,6 +338,8 @@ namespace NExtractTools ...@@ -329,6 +338,8 @@ namespace NExtractTools
m_nDoctParams = new int(XmlUtils::GetInteger(sValue)); m_nDoctParams = new int(XmlUtils::GetInteger(sValue));
else if(_T("m_sHtmlFileInternalPath") == sName) else if(_T("m_sHtmlFileInternalPath") == sName)
m_sHtmlFileInternalPath = new std::wstring(sValue); m_sHtmlFileInternalPath = new std::wstring(sValue);
else if(_T("m_sPassword") == sName)
m_sPassword = new std::wstring(sValue);
} }
} }
} }
...@@ -337,9 +348,9 @@ namespace NExtractTools ...@@ -337,9 +348,9 @@ namespace NExtractTools
} }
return true; return true;
} }
std::wstring getPassword() std::wstring getPassword() const
{ {
return L""; return (NULL != m_sPassword) ? (*m_sPassword) : L"";
} }
std::wstring getXmlOptions() std::wstring getXmlOptions()
...@@ -445,8 +456,7 @@ namespace NExtractTools ...@@ -445,8 +456,7 @@ namespace NExtractTools
{ {
if(!getDontSaveAdditional()) if(!getDontSaveAdditional())
{ {
size_t nIndex = m_sFileFrom->rfind('.'); copyOrigin(*m_sFileFrom, *m_sFileTo);
NSFile::CFileBinary::Copy(*m_sFileFrom, NSSystemPath::GetDirectoryName(*m_sFileTo) + FILE_SEPARATOR_STR + _T("origin") + m_sFileFrom->substr(nIndex));
} }
eRes = TCD_ERROR; eRes = TCD_ERROR;
} }
...@@ -467,8 +477,7 @@ namespace NExtractTools ...@@ -467,8 +477,7 @@ namespace NExtractTools
oBuilder.WriteString(_T("}")); oBuilder.WriteString(_T("}"));
std::wstring sFilePath = NSSystemPath::GetDirectoryName(*m_sFileTo) + FILE_SEPARATOR_STR + _T("settings.json"); std::wstring sFilePath = NSSystemPath::GetDirectoryName(*m_sFileTo) + FILE_SEPARATOR_STR + _T("settings.json");
NSFile::CFileBinary::SaveToFile(sFilePath, oBuilder.GetData()); NSFile::CFileBinary::SaveToFile(sFilePath, oBuilder.GetData());
size_t nIndex = m_sFileFrom->rfind('.'); copyOrigin(*m_sFileFrom, *m_sFileTo);
NSFile::CFileBinary::Copy(*m_sFileFrom, NSSystemPath::GetDirectoryName(*m_sFileTo) + FILE_SEPARATOR_STR + _T("origin") + m_sFileFrom->substr(nIndex));
} }
eRes = TCD_ERROR; eRes = TCD_ERROR;
} }
......
...@@ -341,7 +341,7 @@ int main(int argc, char *argv[]) ...@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
} }
else if (TCD_XLS2XLSX == conversion) else if (TCD_XLS2XLSX == conversion)
{ {
result = xls2xlsx (sFileFrom, sFileTo, sPassword, sTempDir, sFontPath); result = xls2xlsx (sFileFrom, sFileTo, sTempDir, sFontPath, oInputParams);
} }
else if (TCD_XLS2XLST == conversion) else if (TCD_XLS2XLST == conversion)
{ {
...@@ -381,7 +381,7 @@ int main(int argc, char *argv[]) ...@@ -381,7 +381,7 @@ int main(int argc, char *argv[])
} }
else if (TCD_SPREADSHEET2 == conversion) else if (TCD_SPREADSHEET2 == conversion)
{ {
result = fromSpreadsheet(sFileFrom, nFormatFrom, sFileTo, nFormatTo, sPassword, sTempDir, sFontPath, sXmlOptions, sThemeDir, bFromChanges, bPaid, oInputParams); result = fromSpreadsheet(sFileFrom, nFormatFrom, sFileTo, nFormatTo, sTempDir, sFontPath, sXmlOptions, sThemeDir, bFromChanges, bPaid, oInputParams);
} }
else if (TCD_PRESENTATION2 == conversion) else if (TCD_PRESENTATION2 == conversion)
{ {
......
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