Commit 485e45c1 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

word dialog

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64871 954022d7-b5bf-4e40-9824-e11837661b57
parent 7f5aea56
......@@ -20,6 +20,10 @@
this.optionId = id;
this.options = new asc_CCSVOptions(opt);
break;
case c_oAscAdvancedOptionsID.TXT:
this.optionId = id;
this.options = new asc_CTXTOptions(opt);
break;
}
}
asc_CAdvancedOptions.prototype.asc_getOptionId = function(){ return this.optionId; };
......@@ -53,6 +57,29 @@
prot["asc_getCodePages"] = prot.asc_getCodePages;
prot["asc_getRecommendedSettings"] = prot.asc_getRecommendedSettings;
/** @constructor */
function asc_CTXTOptions(opt){
this.codePages = function(){
var arr = [], c, encodings = opt["encodings"];
for(var i = 0; i < encodings.length; i++ ){
c = new asc_CCodePage();
c.init(encodings[i]);
arr.push(c);
}
return arr;
}();
this.recommendedSettings = new asc_CTXTAdvancedOptions (opt["codepage"]);
}
asc_CTXTOptions.prototype.asc_getCodePages = function(){ return this.codePages;};
asc_CTXTOptions.prototype.asc_getRecommendedSettings = function () { return this.recommendedSettings; };
window["Asc"].asc_CTXTOptions = asc_CTXTOptions;
window["Asc"]["asc_CTXTOptions"] = asc_CTXTOptions;
prot = asc_CTXTOptions.prototype;
prot["asc_getCodePages"] = prot.asc_getCodePages;
prot["asc_getRecommendedSettings"] = prot.asc_getRecommendedSettings;
/** @constructor */
function asc_CCSVAdvancedOptions(codepage,delimiter){
this.codePage = codepage;
......@@ -69,6 +96,18 @@
prot["asc_setDelimiter"] = prot.asc_setDelimiter;
prot["asc_getCodePage"] = prot.asc_getCodePage;
prot["asc_setCodePage"] = prot.asc_setCodePage;
/** @constructor */
function asc_CTXTAdvancedOptions(codepage){
this.codePage = codepage;
}
asc_CTXTAdvancedOptions.prototype.asc_getCodePage = function(){return this.codePage;};
asc_CTXTAdvancedOptions.prototype.asc_setCodePage = function(v){this.codePage = v;};
window["Asc"].asc_CTXTAdvancedOptions = window["Asc"]["asc_CTXTAdvancedOptions"] = asc_CTXTAdvancedOptions;
prot = asc_CTXTAdvancedOptions.prototype;
prot["asc_getCodePage"] = prot.asc_getCodePage;
prot["asc_setCodePage"] = prot.asc_setCodePage;
/** @constructor */
function asc_CCodePage(){
......
......@@ -57,6 +57,11 @@ var c_oAscAsyncAction = {
SendMailMerge : 15 // рассылка mail merge по почте
};
var c_oAscAdvancedOptionsID = {
CSV: 0,
TXT: 1
};
var c_oAscAdvancedOptionsAction = {
None: 0,
Open: 1,
......@@ -678,6 +683,7 @@ var c_oAscEncodings = [
[ 50, 12000, "UTF-32", "Unicode (UTF-32)" ],
[ 51, 12001, "UTF-32BE", "Unicode (UTF-32 Big Endian)" ]
];
var c_oAscCodePageUtf8 = 46;//65001
var c_oAscMaxTooltipLength = 256;
var c_oAscMaxCellOrCommentLength = 32767; // По идее должно быть 32768, но видимо сравнение идеть на меньше (а не меньше либо равно)
......
......@@ -886,44 +886,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
});
}
break;
case "needparams":
// Проверяем, возможно нам пришли опции для CSV
if (this.documentOpenOptions) {
codePageCsv = this.documentOpenOptions["codePage"];
delimiterCsv = this.documentOpenOptions["delimiter"];
if (null !== codePageCsv && undefined !== codePageCsv && null !== delimiterCsv && undefined !== delimiterCsv) {
this.asc_setAdvancedOptions(c_oAscAdvancedOptionsID.CSV, new asc.asc_CCSVAdvancedOptions(codePageCsv, delimiterCsv));
break;
}
}
asc_ajax({
url: result["data"],
dataType: "text",
success: function(result) {
var cp = JSON.parse(result);
t.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV, cp), t.advancedOptionsAction);
},
error: function() {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
if (fCallback) {
fCallback({returnCode: c_oAscError.Level.Critical, val: c_oAscError.ID.Unknown});
}
}
});
break;
case "getcodepage":
// Проверяем, возможно нам пришли опции для CSV
if (this.documentOpenOptions) {
codePageCsv = this.documentOpenOptions["codePage"];
delimiterCsv = this.documentOpenOptions["delimiter"];
if (null !== codePageCsv && undefined !== codePageCsv && null !== delimiterCsv && undefined !== delimiterCsv) {
this.asc_setAdvancedOptions(c_oAscAdvancedOptionsID.CSV, new asc.asc_CCSVAdvancedOptions(codePageCsv, delimiterCsv));
break;
}
}
var cp = JSON.parse(result["data"]);
this.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV, cp), this.advancedOptionsAction);
break;
}
};
......@@ -1051,7 +1013,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} else if (c_oAscFileType.CSV === sFormat && !options) {
// Мы открывали команду, надо ее закрыть.
this.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
var cp = {'delimiter': c_oAscCsvDelimiter.Comma, 'codepage': 46, 'encodings': getEncodingParams()};
var cp = {'delimiter': c_oAscCsvDelimiter.Comma, 'codepage': c_oAscCodePageUtf8, 'encodings': getEncodingParams()};
this.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV, cp), this.advancedOptionsAction);
return;
} else {
......
......@@ -84,10 +84,6 @@ var c_oAscCsvDelimiter = {
Space: 5
};
var c_oAscAdvancedOptionsID = {
CSV: 0
};
var c_oAscMergeOptions = {
Unmerge: 0,
Merge: 1,
......
......@@ -15,7 +15,6 @@ var documentFormat = 'null';
var documentVKey = null;
var documentOrigin = "";
var documentFormatSave = c_oAscFileType.DOCX;
var documentFormatSaveTxtCodepage = 46;//65001 utf8
var documentCallbackUrl = undefined; // Ссылка для отправления информации о документе
function CDocOpenProgress()
......@@ -1415,20 +1414,8 @@ asc_docs_api.prototype._coAuthoringInit = function()
}
break;
case "needparams":
//todo dialog
var rData = {
"id":documentId,
"userid": documentUserId,
"format": documentFormat,
"vkey": documentVKey,
"editorid": c_oEditorId.Word,
"c":"reopen",
"url": documentUrl,
"title": documentTitle,
"codepage": documentFormatSaveTxtCodepage,
"embeddedfonts": t.isUseEmbeddedCutFonts
};
sendCommand2(t, null, rData);
var cp = {'codepage': c_oAscCodePageUtf8, 'encodings': getEncodingParams()};
t.asc_fireCallback("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.TXT, cp), t.advancedOptionsAction);
break;
case "err":
t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical);
......@@ -2200,7 +2187,7 @@ asc_docs_api.prototype.asc_Print = function()
else {
// Меняем тип состояния (на сохранение)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save;
_downloadAs(this, "save", null, null, c_oAscFileType.PDF, function(input){
_downloadAs(this, "save", null, null, null, c_oAscFileType.PDF, function(input){
if(null != input && "save" == input["type"]) {
if('ok' == input["status"]){
var url = g_fGetSaveUrl(input["data"]);
......@@ -2370,13 +2357,13 @@ asc_docs_api.prototype.asc_Save = function ()
}
};
asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем число соответствующее своему формату.
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, txtOptions) {//передаем число соответствующее своему формату.
var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType);
var t = this;
// Меняем тип состояния (на сохранение)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save;
_downloadAs(this, "save", null, null, typeFile, function (input) {
_downloadAs(this, "save", null, null, txtOptions, typeFile, function (input) {
if(null != input && ("save" == input["type"] || "sfct" == input["type"])) {
if('ok' == input["status"]){
var url = g_fGetSaveUrl(input["data"]);
......@@ -2405,7 +2392,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex,
var t = this;
// Меняем тип состояния (на сохранение)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save;
_downloadAs(this, "save", oDocumentMailMerge, null, typeFile, function (input) {
_downloadAs(this, "save", oDocumentMailMerge, null, null, typeFile, function (input) {
if(null != input && "save" == input["type"]) {
if('ok' == input["status"]){
var url = g_fGetSaveUrl(input["data"]);
......@@ -2443,6 +2430,36 @@ asc_docs_api.prototype.AddURL = function(url){
};
asc_docs_api.prototype.Help = function(){
};
/*
idOption идентификатор дополнительного параметра, c_oAscAdvancedOptionsID.TXT.
option - какие свойства применить, пока массив. для TXT объект asc_CTXTAdvancedOptions(codepage)
exp: asc_setAdvancedOptions(c_oAscAdvancedOptionsID.TXT, new Asc.asc_CCSVAdvancedOptions(1200) );
*/
asc_docs_api.prototype.asc_setAdvancedOptions = function(idOption, option) {
var t = this;
switch (idOption) {
case c_oAscAdvancedOptionsID.TXT:
// Проверяем тип состояния в данный момент
if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Open) {
var rData = {
"id":documentId,
"userid": documentUserId,
"format": documentFormat,
"vkey": documentVKey,
"editorid": c_oEditorId.Word,
"c":"reopen",
"url": documentUrl,
"title": documentTitle,
"codepage": option.asc_getCodePage(),
"embeddedfonts": t.isUseEmbeddedCutFonts
};
sendCommand2(t, null, rData);
} else if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Save) {
t.asc_DownloadAs(c_oAscFileType.TXT, option);
}
break;
}
};
asc_docs_api.prototype.SetFontRenderingMode = function(mode)
{
......@@ -6824,7 +6841,7 @@ function _onOpenCommand(fCallback, incomeObject) {
if(fCallback) fCallback();
});
}
function _downloadAs(editor, command, oDocumentMailMerge, oMailMergeSendData, filetype, fCallback, fCallbackRequest) {
function _downloadAs(editor, command, oDocumentMailMerge, oMailMergeSendData, txtOptions, filetype, fCallback, fCallbackRequest) {
var dataContainer = {data: null, part: null, index: 0, count: 0};
var oAdditionalData = {};
oAdditionalData["c"] = command;
......@@ -6843,6 +6860,16 @@ function _downloadAs(editor, command, oDocumentMailMerge, oMailMergeSendData, fi
// ToDo select csv params
oAdditionalData['codepage'] = 65001;
oAdditionalData['delimiter'] = 4; // c_oAscCsvDelimiter.Comma
} else if (c_oAscFileType.TXT === filetype) {
if (!txtOptions) {
// Мы открывали команду, надо ее закрыть.
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
var cp = {'codepage': c_oAscCodePageUtf8, 'encodings': getEncodingParams()};
editor.asc_fireCallback("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.TXT, cp), t.advancedOptionsAction);
return;
} else if (txtOptions instanceof asc.asc_CTXTAdvancedOptions) {
oAdditionalData["codepage"] = txtOptions.asc_getCodePage();
}
} else {
var oLogicDocument;
if(null != oDocumentMailMerge)
......@@ -7108,7 +7135,7 @@ asc_docs_api.prototype.asc_sendMailMergeData = function(oData)
oData.put_UserId(documentUserId);
oData.put_RecordCount(oData.get_RecordTo() - oData.get_RecordFrom() + 1);
var t = this;
_downloadAs(this, "sendmm", null, oData, c_oAscFileType.TXT, null, function(input){
_downloadAs(this, "sendmm", null, oData, null, c_oAscFileType.TXT, null, function(input){
if(null != input && "sendmm" == input["type"]) {
if("ok" == input["status"]) {
;
......
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