Commit 9968b1f8 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

(1.0.0.100): FileConverterUtils2

Добавил поддержку параметра fileType для mailMerge (чтобы отличать csv)
Поправил константы SaveTypes.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61244 954022d7-b5bf-4e40-9824-e11837661b57
parent 6199cba0
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
var g_bDate1904 = false; var g_bDate1904 = false;
var c_oAscAsyncActionType = {
Information : 0,
BlockInteraction : 1
};
var CellValueType = var CellValueType =
{ {
Number:0, Number:0,
...@@ -422,4 +427,11 @@ var c_oAscFormatPainterState = { ...@@ -422,4 +427,11 @@ var c_oAscFormatPainterState = {
kOff : 0, kOff : 0,
kOn : 1, kOn : 1,
kMultiple : 2 kMultiple : 2
};
var c_oAscSaveTypes = {
PartStart : 0,
Part : 1,
Complete : 2,
CompleteAll : 3
}; };
\ No newline at end of file
...@@ -1058,7 +1058,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1058,7 +1058,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var data; var data;
this.wb._initCommentsToSave(); this.wb._initCommentsToSave();
var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel); var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
data = oBinaryFileWriter.Write(); data = oBinaryFileWriter.Write();
oAdditionalData["data"] = data; oAdditionalData["data"] = data;
...@@ -1086,7 +1086,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1086,7 +1086,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oAdditionalData["delimiter"] = this.documentFormatSaveCsvDelimiter; oAdditionalData["delimiter"] = this.documentFormatSaveCsvDelimiter;
} }
oAdditionalData["innersave"] = true; oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
oAdditionalData["data"] = data; oAdditionalData["data"] = data;
this._asc_sendCommand (/*callback*/ function(incomeObject){ this._asc_sendCommand (/*callback*/ function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"]) if(null != incomeObject && "save" == incomeObject["type"])
...@@ -1121,10 +1121,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1121,10 +1121,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Закончили печатить // Закончили печатить
if (bStart) { if (bStart) {
// Первый раз отправляем данные // Первый раз отправляем данные
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
} else { } else {
// Не в первый раз отправляем данные // Не в первый раз отправляем данные
oAdditionalData["savetype"] = "complete"; oAdditionalData["savetype"] = c_oAscSaveTypes.Complete;
} }
// Очищаем данные о печати // Очищаем данные о печати
this.printPagesData = null; this.printPagesData = null;
...@@ -1132,10 +1132,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1132,10 +1132,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Продолжаем печать // Продолжаем печать
if (bStart) { if (bStart) {
// Первый раз отправляем данные // Первый раз отправляем данные
oAdditionalData["savetype"] = "partstart"; oAdditionalData["savetype"] = c_oAscSaveTypes.PartStart;
} else { } else {
// Не в первый раз отправляем данные // Не в первый раз отправляем данные
oAdditionalData["savetype"] = "part"; oAdditionalData["savetype"] = c_oAscSaveTypes.Part;
} }
} }
} else if (c_oAscFileType.CSV === sFormat && !options) { } else if (c_oAscFileType.CSV === sFormat && !options) {
...@@ -1151,7 +1151,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1151,7 +1151,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} else { } else {
this.wb._initCommentsToSave(); this.wb._initCommentsToSave();
var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel); var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
if (c_oAscFileType.CSV === sFormat) { if (c_oAscFileType.CSV === sFormat) {
if (options instanceof asc.asc_CCSVAdvancedOptions) { if (options instanceof asc.asc_CCSVAdvancedOptions) {
oAdditionalData["codepage"] = options.asc_getCodePage(); oAdditionalData["codepage"] = options.asc_getCodePage();
...@@ -3324,7 +3324,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3324,7 +3324,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.wb._initCommentsToSave(); t.wb._initCommentsToSave();
var oBinaryFileWriter = new Asc.BinaryFileWriter(t.wbModel); var oBinaryFileWriter = new Asc.BinaryFileWriter(t.wbModel);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
var data = oBinaryFileWriter.Write(); var data = oBinaryFileWriter.Write();
return data; return data;
......
...@@ -72,11 +72,6 @@ var c_oAscFileType = { ...@@ -72,11 +72,6 @@ var c_oAscFileType = {
XLSY : 0x1002 XLSY : 0x1002
}; };
var c_oAscAsyncActionType = {
Information : 0,
BlockInteraction : 1
};
var c_oAscAsyncAction = { var c_oAscAsyncAction = {
Open : 0, // открытие документа Open : 0, // открытие документа
Save : 1, Save : 1,
......
...@@ -5154,23 +5154,23 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) ...@@ -5154,23 +5154,23 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2()) if(dd.isComleteRenderer2())
{ {
if(false == bStart) if(false == bStart)
oAdditionalData["savetype"] = "complete"; oAdditionalData["savetype"] = c_oAscSaveTypes.Complete;
else else
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
} }
else else
{ {
if(false == bStart) if(false == bStart)
oAdditionalData["savetype"] = "part"; oAdditionalData["savetype"] = c_oAscSaveTypes.Part;
else else
oAdditionalData["savetype"] = "partstart"; oAdditionalData["savetype"] = c_oAscSaveTypes.PartStart;
} }
oAdditionalData["data"] = dd.ToRendererPart(); oAdditionalData["data"] = dd.ToRendererPart();
sendCommand(editor, fCallback, oAdditionalData); sendCommand(editor, fCallback, oAdditionalData);
} }
else else
{ {
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
oAdditionalData["data"] = editor.WordControl.SaveDocument(); oAdditionalData["data"] = editor.WordControl.SaveDocument();
sendCommand(editor, fCallback, oAdditionalData); sendCommand(editor, fCallback, oAdditionalData);
} }
......
...@@ -11,11 +11,6 @@ var c_oAscCollaborativeMarksShowType = { ...@@ -11,11 +11,6 @@ var c_oAscCollaborativeMarksShowType = {
LastChanges : 1 LastChanges : 1
}; };
var c_oAscAsyncActionType = {
Information : 0,
BlockInteraction : 1
};
var c_oAscHAnchor = { var c_oAscHAnchor = {
Margin : 0x00, Margin : 0x00,
Page : 0x01, Page : 0x01,
......
...@@ -562,7 +562,7 @@ function asc_docs_api(name) ...@@ -562,7 +562,7 @@ function asc_docs_api(name)
this.isApplyChangesOnOpen = false; this.isApplyChangesOnOpen = false;
this.isApplyChangesOnOpenEnabled = true; this.isApplyChangesOnOpenEnabled = true;
this.mailMergeFileUrl = null; this.mailMergeFileData = null;
// CoAuthoring and Chat // CoAuthoring and Chat
this.User = undefined; this.User = undefined;
...@@ -2823,7 +2823,7 @@ asc_docs_api.prototype.asc_Save = function () ...@@ -2823,7 +2823,7 @@ asc_docs_api.prototype.asc_Save = function ()
}; };
asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем число соответствующее своему формату. asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем число соответствующее своему формату.
var actionType = this.mailMergeFileUrl ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs; var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType);
var t = this; var t = this;
_downloadAs(this, typeFile, function (incomeObject) { _downloadAs(this, typeFile, function (incomeObject) {
...@@ -2880,8 +2880,8 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode) ...@@ -2880,8 +2880,8 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode)
}; };
asc_docs_api.prototype.processSavedFile = function(url, bInner) { asc_docs_api.prototype.processSavedFile = function(url, bInner) {
var t = this; var t = this;
if (this.mailMergeFileUrl) { if (this.mailMergeFileData) {
this.mailMergeFileUrl = null; this.mailMergeFileData = null;
asc_ajax({ asc_ajax({
url: url, url: url,
dataType: "text", dataType: "text",
...@@ -7551,23 +7551,20 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) { ...@@ -7551,23 +7551,20 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) {
if (c_oAscFileType.PDF === filetype) { if (c_oAscFileType.PDF === filetype) {
var dd = editor.WordControl.m_oDrawingDocument; var dd = editor.WordControl.m_oDrawingDocument;
if (dd.isComleteRenderer2()) { if (dd.isComleteRenderer2()) {
if (false == bStart) oAdditionalData["savetype"] = bStart ? c_oAscSaveTypes.Complete : c_oAscSaveTypes.CompleteAll;
oAdditionalData["savetype"] = "complete";
else
oAdditionalData["savetype"] = "completeall";
} else { } else {
if (false == bStart)
oAdditionalData["savetype"] = "part";
else
oAdditionalData["savetype"] = "partstart";
} }
oAdditionalData["data"] = dd.ToRendererPart(); oAdditionalData["data"] = dd.ToRendererPart();
} else if (c_oAscFileType.JSON === filetype) { } else if (c_oAscFileType.JSON === filetype) {
oAdditionalData["savetype"] = "completeall"; oAdditionalData['savetype'] = c_oAscSaveTypes.CompleteAll;
oAdditionalData["url"] = editor.mailMergeFileUrl; oAdditionalData['url'] = editor.mailMergeFileData['url'];
oAdditionalData['format'] = editor.mailMergeFileData['fileType'];
// ToDo select csv params
oAdditionalData['codepage'] = 65001;
oAdditionalData['delimiter'] = 4; // c_oAscCsvDelimiter.Comma
} else { } else {
var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument); var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
oAdditionalData["data"] = oBinaryFileWriter.Write(); oAdditionalData["data"] = oBinaryFileWriter.Write();
} }
sendCommand(editor, fCallback, oAdditionalData); sendCommand(editor, fCallback, oAdditionalData);
...@@ -7829,7 +7826,7 @@ asc_docs_api.prototype.asc_AddMath2 = function(Type) ...@@ -7829,7 +7826,7 @@ asc_docs_api.prototype.asc_AddMath2 = function(Type)
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
asc_docs_api.prototype.asc_StartMailMerge = function(oData) asc_docs_api.prototype.asc_StartMailMerge = function(oData)
{ {
this.mailMergeFileUrl = oData["url"]; this.mailMergeFileData = oData;
this.asc_DownloadAs(c_oAscFileType.JSON); this.asc_DownloadAs(c_oAscFileType.JSON);
}; };
asc_docs_api.prototype.asc_StartMailMergeByList = function(aList) asc_docs_api.prototype.asc_StartMailMergeByList = function(aList)
......
...@@ -6,11 +6,6 @@ var c_oAscZoomType = { ...@@ -6,11 +6,6 @@ var c_oAscZoomType = {
FitPage :2 FitPage :2
}; };
var c_oAscAsyncActionType = {
Information : 0,
BlockInteraction : 1
};
var c_oAscAsyncAction = { var c_oAscAsyncAction = {
Open : 0, // открытие документа Open : 0, // открытие документа
Save : 1, Save : 1,
......
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