This commit is contained in:
Alexander Trofimov
2015-06-25 11:27:08 +03:00
parent dbf21ee32f
commit a10605c91f
174 changed files with 24121 additions and 8908 deletions

View File

@@ -1,82 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
(function ($, window, undefined) {
var asc = window["Asc"];
var asc_applyFunction = asc.applyFunction;
asc.spreadsheet_api.prototype._getIsLockObjectSheet = function (lockInfo, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
asc.spreadsheet_api.prototype._isLockedTabColor = function (index, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.wbModel.getWorksheet(index).getId();
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, c_oAscLockNameTabColor);
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
})(jQuery, window);

View File

@@ -66,6 +66,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.documentId = undefined;
this.documentUserId = undefined;
this.documentUrl = "null";
this.documentUrlChanges = null;
this.documentTitle = "null";
this.documentTitleWithoutExtention = "null";
this.documentFormat = "null";
@@ -371,6 +372,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.User.asc_setId(this.DocInfo["UserId"]);
this.User.asc_setUserName(this.DocInfo["UserName"]);
}
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["SetDocumentName"](this.documentTitle);
}
if (this.DocInfo["OfflineApp"] && (true == this.DocInfo["OfflineApp"])) {
this.isCoAuthoringEnable = false;
window["scriptBridge"] = {};
@@ -486,20 +490,55 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
});
};
spreadsheet_api.prototype.asc_Print = function (adjustPrint) {
if (window["AscDesktopEditor"]) {
window.AscDesktopEditor_PrintData = adjustPrint;
window["AscDesktopEditor"]["Print"]();
return;
}
this.adjustPrint = adjustPrint ? adjustPrint : new asc_CAdjustPrint();
this.asc_DownloadAs(c_oAscFileType.PDFPRINT);
};
spreadsheet_api.prototype.asc_Copy = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 67;
this.controller._onWindowKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
var result = this.wb.copyToClipboardButton();
this.wb.restoreFocus();
return result;
};
spreadsheet_api.prototype.asc_Paste = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 86;
this.controller._onWindowKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
var result = this.wb.pasteFromClipboardButton();
this.wb.restoreFocus();
return result;
};
spreadsheet_api.prototype.asc_Cut = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 88;
this.controller._onWindowKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
var result = this.wb.cutToClipboardButton();
this.wb.restoreFocus();
return result;
@@ -831,48 +870,26 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
dataType: "text"
});
};
spreadsheet_api.prototype._onOpenCommand = function (callback, url) {
spreadsheet_api.prototype._onOpenCommand = function (callback, data) {
var t = this;
var sJsonUrl = g_sResourceServiceLocalUrl + url;
asc_ajax({
url: sJsonUrl,
dataType: "text",
success: function (result) {
var url;
var nIndex = sJsonUrl.lastIndexOf("/");
if (-1 !== nIndex) {
url = sJsonUrl.substring(0, nIndex + 1);
} else {
url = sJsonUrl;
}
if (Asc.c_oSerFormat.Signature === result.substring(0, Asc.c_oSerFormat.Signature.length)) {
var wb = t.asc_OpenDocument(url, result);
if (callback) {
callback({
returnCode: 0,
val: wb
});
}
} else {
result = {
returnCode: c_oAscError.Level.Critical,
val: c_oAscError.ID.Unknown
};
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
if (callback) {
callback(result);
}
}
},
error: function () {
var result = {
g_fOpenFileCommand(data, this.documentUrlChanges, Asc.c_oSerFormat.Signature, function (error, result) {
if (error || !result.bSerFormat) {
var oError = {
returnCode: c_oAscError.Level.Critical,
val: c_oAscError.ID.Unknown
};
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
t.handlers.trigger("asc_onError", oError.val, oError.returnCode);
if (callback) {
callback(result);
callback(oError);
}
return;
}
var wb = t.asc_OpenDocument(result.url, result.data);
if (callback) {
callback({
returnCode: 0,
val: wb
});
}
});
};
@@ -915,7 +932,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
"editorid": c_oEditorId.Spreadsheet,
"url": this.documentUrl,
"title": this.documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts
"embeddedfonts": this.isUseEmbeddedCutFonts,
"viewmode": this.asc_getViewerMode()
};
if (false && this.documentOpenOptions && this.documentOpenOptions["isEmpty"]) {
var sEmptyWorkbook = getEmptyWorkbook();
@@ -1675,6 +1693,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.lastSaveTime = null;
t.asc_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
t.onUpdateDocumentModified(false);
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"]();
}
};
this.collaborativeEditing.sendChanges();
} else {
@@ -1706,6 +1727,52 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
spreadsheet_api.prototype._isLockedTabColor = function (index, callback) {
asc_applyFunction(callback, true);
};
spreadsheet_api.prototype._getIsLockObjectSheet = function (lockInfo, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
spreadsheet_api.prototype._isLockedTabColor = function (index, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.wbModel.getWorksheet(index).getId();
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, c_oAscLockNameTabColor);
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
spreadsheet_api.prototype._addWorksheet = function (name, i) {
this.wbModel.createWorksheet(i, name);
this.wb.spliceWorksheet(i, 0, null);
@@ -2114,14 +2181,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
ws.objectRender.cleanWorksheet();
}
};
spreadsheet_api.prototype.asc_addComment = function (oComment) {
if (oComment.bDocument) {
this.wb.cellCommentator.asc_addComment(oComment);
} else {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_addComment(oComment);
}
};
spreadsheet_api.prototype.asc_addComment = function (oComment) {};
spreadsheet_api.prototype.asc_changeComment = function (id, oComment) {
if (oComment.bDocument) {
this.wb.cellCommentator.asc_changeComment(id, oComment);
@@ -2681,6 +2741,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (this.canSave) {
this.handlers.trigger("asc_onDocumentModifiedChanged", bIsModified);
this._onUpdateDocumentCanSave();
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["onDocumentModifiedChanged"](bIsModified);
}
}
};
spreadsheet_api.prototype.offlineModeInit = function () {
@@ -2947,102 +3010,41 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
};
spreadsheet_api.prototype.asc_nativeCalculate = function () {};
spreadsheet_api.prototype.asc_nativePrint = function (_printer, _page) {
var _adjustPrint = new asc_CAdjustPrint();
var _adjustPrint = window.AscDesktopEditor_PrintData ? window.AscDesktopEditor_PrintData : new asc_CAdjustPrint();
window.AscDesktopEditor_PrintData = undefined;
var _printPagesData = this.wb.calcPagesPrint(_adjustPrint);
var isEndPrint = _api.wb.printSheet(_printer, _printPagesData);
if (undefined === _printer && _page === undefined) {
var pdf_writer = new CPdfPrinter(this.wbModel.sUrlPath);
while (!this.wb.printSheet(pdf_writer, _printPagesData)) {}
if (undefined !== window["AscDesktopEditor"]) {
var pagescount = pdf_writer.DocumentRenderer.m_lPagesCount;
window["AscDesktopEditor"]["Print_Start"](g_sResourceServiceLocalUrl + this.documentId + "/", pagescount, "", -1);
for (var i = 0; i < pagescount; i++) {
var _start = pdf_writer.DocumentRenderer.m_arrayPages[i].StartOffset;
var _end = pdf_writer.DocumentRenderer.Memory.pos;
if (i != (pagescount - 1)) {
_end = pdf_writer.DocumentRenderer.m_arrayPages[i + 1].StartOffset;
}
window["AscDesktopEditor"]["Print_Page"](pdf_writer.DocumentRenderer.Memory.GetBase64Memory2(_start, _end - _start), pdf_writer.DocumentRenderer.m_arrayPages[i].Width, pdf_writer.DocumentRenderer.m_arrayPages[i].Height);
}
window["AscDesktopEditor"]["Print_End"]();
}
return;
}
while (!this.wb.printSheet(pdf_writer, _printPagesData)) {}
return _printer.DocumentRenderer.Memory;
};
spreadsheet_api.prototype.asc_nativePrintPagesCount = function () {
return 1;
};
function asc_ajax(obj) {
var url = "",
type = "GET",
async = true,
data = null,
dataType = "text/xml",
error = null,
success = null,
httpRequest = null,
contentType = "application/x-www-form-urlencoded",
init = function (obj) {
if (typeof obj.url !== "undefined") {
url = obj.url;
}
if (typeof obj.type !== "undefined") {
type = obj.type;
}
if (typeof obj.async !== "undefined") {
async = obj.async;
}
if (typeof obj.data !== "undefined") {
data = obj.data;
}
if (typeof obj.dataType !== "undefined") {
dataType = obj.dataType;
}
if (typeof obj.error !== "undefined") {
error = obj.error;
}
if (typeof obj.success !== "undefined") {
success = obj.success;
}
if (typeof(obj.contentType) !== "undefined") {
contentType = obj.contentType;
}
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType(dataType);
}
} else {
if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {}
}
}
}
httpRequest.onreadystatechange = function () {
respons(this);
};
send();
},
send = function () {
httpRequest.open(type, url, async);
if (type === "POST") {
httpRequest.setRequestHeader("Content-Type", contentType);
}
httpRequest.send(data);
},
respons = function (httpRequest) {
switch (httpRequest.readyState) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
if (httpRequest.status === 200 || httpRequest.status === 1223) {
if (typeof success === "function") {
success(httpRequest.responseText);
}
} else {
if (typeof error === "function") {
error(httpRequest, httpRequest.statusText, httpRequest.status);
}
}
break;
}
};
init(obj);
}
spreadsheet_api.prototype.asc_nativeGetPDF = function () {
var _ret = this.asc_nativePrint();
window["native"]["Save_End"]("", _ret.GetCurPosition());
return _ret.data;
};
window["AscDesktopEditor_Save"] = function () {
return window["Asc"]["editor"].asc_Save();
};
asc["spreadsheet_api"] = spreadsheet_api;
prot = spreadsheet_api.prototype;
prot["asc_GetFontThumbnailsPath"] = prot.asc_GetFontThumbnailsPath;

View File

@@ -157,7 +157,7 @@ CPdfPrinter.prototype = {
var _g = val.getG();
var _b = val.getB();
var _a = val.getA();
this.DocumentRenderer.b_color1(_r, _g, _b, (_a * 255 + 0.5) >> 0);
this.DocumentRenderer.b_color1(_r, _g, _b, parseInt(_a * 255 + 0.5));
return this;
},
setFillPattern: function (val) {
@@ -168,7 +168,7 @@ CPdfPrinter.prototype = {
var _g = val.getG();
var _b = val.getB();
var _a = val.getA();
this.DocumentRenderer.p_color(_r, _g, _b, (_a * 255 + 0.5) >> 0);
this.DocumentRenderer.p_color(_r, _g, _b, parseInt(_a * 255 + 0.5));
return this;
},
setLineWidth: function (val) {

View File

@@ -568,7 +568,34 @@ CCellCommentator.prototype.isViewerMode = function () {
return this.worksheet.handlers.trigger("getViewerMode");
};
CCellCommentator.prototype.isLockedComment = function (oComment, callbackFunc) {
Asc.applyFunction(callbackFunc, true);
if (false === this.worksheet.collaborativeEditing.isCoAuthoringExcellEnable()) {
Asc.applyFunction(callbackFunc, true);
return;
}
var objectGuid = oComment.asc_getId();
if (objectGuid) {
var sheetId = CCellCommentator.sStartCommentId;
if (!oComment.bDocument) {
sheetId += this.worksheet.model.getId();
}
var lockInfo = this.worksheet.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, objectGuid);
if (false === this.worksheet.collaborativeEditing.getCollaborativeEditing()) {
Asc.applyFunction(callbackFunc, true);
callbackFunc = undefined;
}
if (false !== this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
Asc.applyFunction(callbackFunc, true);
return;
} else {
if (false !== this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
Asc.applyFunction(callbackFunc, false);
return;
}
}
this.worksheet.collaborativeEditing.onStartCheckLock();
this.worksheet.collaborativeEditing.addCheckLock(lockInfo);
this.worksheet.collaborativeEditing.onEndCheckLock(callbackFunc);
}
};
CCellCommentator.prototype.moveRangeComments = function (rangeFrom, rangeTo) {
if (rangeFrom && rangeTo) {

View File

@@ -116,6 +116,12 @@ function CIdCounter() {
this.Set_Load = function (bValue) {
this.m_bLoad = bValue;
};
this.Clear = function () {
this.m_sUserId = null;
this.m_bLoad = true;
this.m_nIdCounterLoad = 0;
this.m_nIdCounterEdit = 0;
};
}
function CTableId() {
this.m_aPairs = {};
@@ -560,7 +566,12 @@ CTableId.prototype = {
}
return true;
},
Unlock: function (Data) {}
Unlock: function (Data) {},
Clear: function () {
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Add(this, g_oIdCounter.Get_NewId());
}
};
var g_oIdCounter = null;
var g_oTableId = null;

View File

@@ -1402,8 +1402,156 @@ CGraphics.prototype = {
this.SetIntegerGrid(false);
}
},
DrawLockParagraph: function (lock_type, x, y1, y2) {},
DrawLockObjectRect: function (lock_type, x, y, w, h) {},
DrawLockParagraph: function (lock_type, x, y1, y2) {
if (lock_type == c_oAscLockTypes.kLockTypeNone || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode) {
return;
}
if (lock_type == c_oAscLockTypes.kLockTypeMine) {
this.p_color(22, 156, 0, 255);
} else {
this.p_color(238, 53, 37, 255);
}
var _x = this.m_oFullTransform.TransformPointX(x, y1) >> 0;
var _xT = this.m_oFullTransform.TransformPointX(x, y2) >> 0;
var _y1 = (this.m_oFullTransform.TransformPointY(x, y1) >> 0) + 0.5;
var _y2 = (this.m_oFullTransform.TransformPointY(x, y2) >> 0) - 1.5;
var ctx = this.m_oContext;
if (_x != _xT) {
var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001);
this.p_width(1000 * dKoefMMToPx);
var w_dot = 2 * dKoefMMToPx;
var w_dist = 1 * dKoefMMToPx;
var w_len_indent = 3;
var _interf = editor.WordControl.m_oDrawingDocument.AutoShapesTrack;
this._s();
_interf.AddLineDash(ctx, x, y1, x, y2, w_dot, w_dist);
_interf.AddLineDash(ctx, x, y1, x + w_len_indent, y1, w_dot, w_dist);
_interf.AddLineDash(ctx, x, y2, x + w_len_indent, y2, w_dot, w_dist);
this.ds();
return;
}
var bIsInt = this.m_bIntegerGrid;
if (!bIsInt) {
this.SetIntegerGrid(true);
}
ctx.lineWidth = 1;
var w_dot = 2;
var w_dist = 1;
var w_len_indent = (3 * this.m_oCoordTransform.sx) >> 0;
this._s();
var y_mem = _y1 - 0.5;
while (true) {
if ((y_mem + w_dot) > _y2) {
break;
}
ctx.moveTo(_x + 0.5, y_mem);
y_mem += w_dot;
ctx.lineTo(_x + 0.5, y_mem);
y_mem += w_dist;
}
var x_max = _x + w_len_indent;
var x_mem = _x;
while (true) {
if (x_mem > x_max) {
break;
}
ctx.moveTo(x_mem, _y1);
x_mem += w_dot;
ctx.lineTo(x_mem, _y1);
x_mem += w_dist;
}
x_mem = _x;
while (true) {
if (x_mem > x_max) {
break;
}
ctx.moveTo(x_mem, _y2);
x_mem += w_dot;
ctx.lineTo(x_mem, _y2);
x_mem += w_dist;
}
this.ds();
if (!bIsInt) {
this.SetIntegerGrid(false);
}
},
DrawLockObjectRect: function (lock_type, x, y, w, h) {
if (lock_type == c_oAscLockTypes.kLockTypeNone) {
return;
}
if (lock_type == c_oAscLockTypes.kLockTypeMine) {
this.p_color(22, 156, 0, 255);
} else {
this.p_color(238, 53, 37, 255);
}
var ctx = this.m_oContext;
var _m = this.m_oTransform;
if (_m.sx != 1 || _m.shx != 0 || _m.shy != 0 || _m.sy != 1) {
var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001);
this.p_width(1000 * dKoefMMToPx);
var w_dot = 2 * dKoefMMToPx;
var w_dist = 1 * dKoefMMToPx;
var _interf = this.m_oAutoShapesTrack;
var eps = 5 * dKoefMMToPx;
var _x = x - eps;
var _y = y - eps;
var _r = x + w + eps;
var _b = y + h + eps;
this._s();
_interf.AddRectDash(ctx, _x, _y, _r, _y, _x, _b, _r, _b, w_dot, w_dist, true);
this._s();
return;
}
var bIsInt = this.m_bIntegerGrid;
if (!bIsInt) {
this.SetIntegerGrid(true);
}
ctx.lineWidth = 1;
var w_dot = 2;
var w_dist = 2;
var eps = 5;
var _x = (this.m_oFullTransform.TransformPointX(x, y) >> 0) - eps + 0.5;
var _y = (this.m_oFullTransform.TransformPointY(x, y) >> 0) - eps + 0.5;
var _r = (this.m_oFullTransform.TransformPointX(x + w, y + h) >> 0) + eps + 0.5;
var _b = (this.m_oFullTransform.TransformPointY(x + w, y + h) >> 0) + eps + 0.5;
this._s();
for (var i = _x; i < _r; i += w_dist) {
ctx.moveTo(i, _y);
i += w_dot;
if (i > _r) {
i = _r;
}
ctx.lineTo(i, _y);
}
for (var i = _y; i < _b; i += w_dist) {
ctx.moveTo(_r, i);
i += w_dot;
if (i > _b) {
i = _b;
}
ctx.lineTo(_r, i);
}
for (var i = _r; i > _x; i -= w_dist) {
ctx.moveTo(i, _b);
i -= w_dot;
if (i < _x) {
i = _x;
}
ctx.lineTo(i, _b);
}
for (var i = _b; i > _y; i -= w_dist) {
ctx.moveTo(_x, i);
i -= w_dot;
if (i < _y) {
i = _y;
}
ctx.lineTo(_x, i);
}
this.ds();
if (!bIsInt) {
this.SetIntegerGrid(false);
}
},
DrawEmptyTableLine: function (x1, y1, x2, y2) {
if (!editor.isShowTableEmptyLine) {
return;

View File

@@ -1,182 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
CGraphics.prototype.DrawLockParagraph = function (lock_type, x, y1, y2) {
if (lock_type == c_oAscLockTypes.kLockTypeNone || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode) {
return;
}
if (lock_type == c_oAscLockTypes.kLockTypeMine) {
this.p_color(22, 156, 0, 255);
} else {
this.p_color(238, 53, 37, 255);
}
var _x = this.m_oFullTransform.TransformPointX(x, y1) >> 0;
var _xT = this.m_oFullTransform.TransformPointX(x, y2) >> 0;
var _y1 = (this.m_oFullTransform.TransformPointY(x, y1) >> 0) + 0.5;
var _y2 = (this.m_oFullTransform.TransformPointY(x, y2) >> 0) - 1.5;
var ctx = this.m_oContext;
if (_x != _xT) {
var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001);
this.p_width(1000 * dKoefMMToPx);
var w_dot = 2 * dKoefMMToPx;
var w_dist = 1 * dKoefMMToPx;
var w_len_indent = 3;
var _interf = editor.WordControl.m_oDrawingDocument.AutoShapesTrack;
this._s();
_interf.AddLineDash(ctx, x, y1, x, y2, w_dot, w_dist);
_interf.AddLineDash(ctx, x, y1, x + w_len_indent, y1, w_dot, w_dist);
_interf.AddLineDash(ctx, x, y2, x + w_len_indent, y2, w_dot, w_dist);
this.ds();
return;
}
var bIsInt = this.m_bIntegerGrid;
if (!bIsInt) {
this.SetIntegerGrid(true);
}
ctx.lineWidth = 1;
var w_dot = 2;
var w_dist = 1;
var w_len_indent = (3 * this.m_oCoordTransform.sx) >> 0;
this._s();
var y_mem = _y1 - 0.5;
while (true) {
if ((y_mem + w_dot) > _y2) {
break;
}
ctx.moveTo(_x + 0.5, y_mem);
y_mem += w_dot;
ctx.lineTo(_x + 0.5, y_mem);
y_mem += w_dist;
}
var x_max = _x + w_len_indent;
var x_mem = _x;
while (true) {
if (x_mem > x_max) {
break;
}
ctx.moveTo(x_mem, _y1);
x_mem += w_dot;
ctx.lineTo(x_mem, _y1);
x_mem += w_dist;
}
x_mem = _x;
while (true) {
if (x_mem > x_max) {
break;
}
ctx.moveTo(x_mem, _y2);
x_mem += w_dot;
ctx.lineTo(x_mem, _y2);
x_mem += w_dist;
}
this.ds();
if (!bIsInt) {
this.SetIntegerGrid(false);
}
};
CGraphics.prototype.DrawLockObjectRect = function (lock_type, x, y, w, h) {
if (lock_type == c_oAscLockTypes.kLockTypeNone) {
return;
}
if (lock_type == c_oAscLockTypes.kLockTypeMine) {
this.p_color(22, 156, 0, 255);
} else {
this.p_color(238, 53, 37, 255);
}
var ctx = this.m_oContext;
var _m = this.m_oTransform;
if (_m.sx != 1 || _m.shx != 0 || _m.shy != 0 || _m.sy != 1) {
var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001);
this.p_width(1000 * dKoefMMToPx);
var w_dot = 2 * dKoefMMToPx;
var w_dist = 1 * dKoefMMToPx;
var _interf = this.m_oAutoShapesTrack;
var eps = 5 * dKoefMMToPx;
var _x = x - eps;
var _y = y - eps;
var _r = x + w + eps;
var _b = y + h + eps;
this._s();
_interf.AddRectDash(ctx, _x, _y, _r, _y, _x, _b, _r, _b, w_dot, w_dist, true);
this._s();
return;
}
var bIsInt = this.m_bIntegerGrid;
if (!bIsInt) {
this.SetIntegerGrid(true);
}
ctx.lineWidth = 1;
var w_dot = 2;
var w_dist = 2;
var eps = 5;
var _x = (this.m_oFullTransform.TransformPointX(x, y) >> 0) - eps + 0.5;
var _y = (this.m_oFullTransform.TransformPointY(x, y) >> 0) - eps + 0.5;
var _r = (this.m_oFullTransform.TransformPointX(x + w, y + h) >> 0) + eps + 0.5;
var _b = (this.m_oFullTransform.TransformPointY(x + w, y + h) >> 0) + eps + 0.5;
this._s();
for (var i = _x; i < _r; i += w_dist) {
ctx.moveTo(i, _y);
i += w_dot;
if (i > _r) {
i = _r;
}
ctx.lineTo(i, _y);
}
for (var i = _y; i < _b; i += w_dist) {
ctx.moveTo(_r, i);
i += w_dot;
if (i > _b) {
i = _b;
}
ctx.lineTo(_r, i);
}
for (var i = _r; i > _x; i -= w_dist) {
ctx.moveTo(i, _b);
i -= w_dot;
if (i < _x) {
i = _x;
}
ctx.lineTo(i, _b);
}
for (var i = _b; i > _y; i -= w_dist) {
ctx.moveTo(_x, i);
i -= w_dot;
if (i < _y) {
i = _y;
}
ctx.lineTo(_x, i);
}
this.ds();
if (!bIsInt) {
this.SetIntegerGrid(false);
}
};

View File

@@ -977,14 +977,7 @@ CShapeDrawer.prototype = {
if (null == this.UniFill.fill.tile) {
if (null == this.UniFill.fill.srcRect) {
if (this.UniFill.fill.RasterImageId && this.UniFill.fill.RasterImageId.indexOf(".svg") != 0) {
this.Graphics.SaveGrState();
this.Graphics.StartClipPath();
this.Graphics.EndClipPath();
this.Graphics.drawImage(getFullImageSrc(this.UniFill.fill.RasterImageId), this.min_x, this.min_y, (this.max_x - this.min_x), (this.max_y - this.min_y), undefined, undefined);
bIsFill = false;
var _histClip = new CHist_Clip();
this.Graphics.GrState.Clips.push(_histClip);
this.Graphics.RestoreGrState();
this.Graphics.put_brushTexture(getFullImageSrc(this.UniFill.fill.RasterImageId), 0);
} else {
if (this.UniFill.fill.canvas) {
this.Graphics.put_brushTexture(this.UniFill.fill.canvas.toDataURL("image/png"), 0);
@@ -993,14 +986,8 @@ CShapeDrawer.prototype = {
}
}
} else {
this.Graphics.SaveGrState();
this.Graphics.StartClipPath();
this.Graphics.EndClipPath();
this.Graphics.drawImage(getFullImageSrc(this.UniFill.fill.RasterImageId), this.min_x, this.min_y, (this.max_x - this.min_x), (this.max_y - this.min_y), undefined, this.UniFill.fill.srcRect);
bIsFill = false;
var _histClip = new CHist_Clip();
this.Graphics.GrState.Clips.push(_histClip);
this.Graphics.RestoreGrState();
}
} else {
if (this.UniFill.fill.canvas) {

View File

@@ -1,62 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
CCellCommentator.prototype.isLockedComment = function (oComment, callbackFunc) {
if (false === this.worksheet.collaborativeEditing.isCoAuthoringExcellEnable()) {
Asc.applyFunction(callbackFunc, true);
return;
}
var objectGuid = oComment.asc_getId();
if (objectGuid) {
var sheetId = CCellCommentator.sStartCommentId;
if (!oComment.bDocument) {
sheetId += this.worksheet.model.getId();
}
var lockInfo = this.worksheet.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, objectGuid);
if (false === this.worksheet.collaborativeEditing.getCollaborativeEditing()) {
Asc.applyFunction(callbackFunc, true);
callbackFunc = undefined;
}
if (false !== this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
Asc.applyFunction(callbackFunc, true);
return;
} else {
if (false !== this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
Asc.applyFunction(callbackFunc, false);
return;
}
}
this.worksheet.collaborativeEditing.onStartCheckLock();
this.worksheet.collaborativeEditing.addCheckLock(lockInfo);
this.worksheet.collaborativeEditing.onEndCheckLock(callbackFunc);
}
};

View File

@@ -224,6 +224,66 @@
this.element = undefined;
}
},
copyDesktopEditorButton: function (ElemToSelect, isCut) {
if (isCut) {
var __oncut = ElemToSelect.oncut;
ElemToSelect.oncut = function (e) {
ElemToSelect.oncut = __oncut;
__oncut = null;
var api = window["Asc"]["editor"];
if (api.controller.isCellEditMode) {
return;
}
Editor_Copy_Event_Excel(e, ElemToSelect, true, true);
var selection = window.getSelection();
var rangeToSelect = window.document.createRange();
rangeToSelect.selectNodeContents(ElemToSelect);
selection.removeAllRanges();
selection.addRange(rangeToSelect);
};
ElemToSelect.focus();
window["AscDesktopEditor"]["Cut"]();
} else {
var __oncopy = ElemToSelect.oncopy;
ElemToSelect.oncopy = function (e) {
ElemToSelect.oncopy = __oncopy;
__oncopy = null;
var api = window["Asc"]["editor"];
if (api.controller.isCellEditMode) {
return;
}
Editor_Copy_Event_Excel(e, ElemToSelect, null, true);
var selection = window.getSelection();
var rangeToSelect = window.document.createRange();
rangeToSelect.selectNodeContents(ElemToSelect);
selection.removeAllRanges();
selection.addRange(rangeToSelect);
};
ElemToSelect.focus();
window["AscDesktopEditor"]["Copy"]();
}
},
pasteDesktopEditorButton: function (ElemToSelect) {
var __onpaste = ElemToSelect.onpaste;
var selection = window.getSelection();
var rangeToSelect = window.document.createRange();
rangeToSelect.selectNodeContents(ElemToSelect);
selection.removeAllRanges();
selection.addRange(rangeToSelect);
ElemToSelect.onpaste = function (e) {
if (!window.GlobalPasteFlag) {
return;
}
ElemToSelect.oncopy = __onpaste;
__onpaste = null;
var api = window["Asc"]["editor"];
var wb = api.wb;
var ws = wb.getWorksheet();
wb.clipboard._bodyPaste(ws, e);
};
ElemToSelect.focus();
window["AscDesktopEditor"]["Paste"]();
},
copyRange: function (range, worksheet, isCut) {
var t = this;
t._cleanElement();
@@ -292,6 +352,10 @@
}
}
History.TurnOn();
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
this.copyDesktopEditorButton(this.element, isCut);
return;
}
if (AscBrowser.isMozilla) {
t._selectElement(t._getStylesSelect);
} else {
@@ -300,6 +364,37 @@
this._endCopyOrPaste();
}
},
_getHtmlBase64: function (range, worksheet, isCut) {
var t = this;
t._cleanElement();
var objectRender = worksheet.objectRender;
var isIntoShape = objectRender.controller.getTargetDocContent();
var text = t._makeTableNode(range, worksheet, isCut, isIntoShape);
if (text == false) {
return;
}
this._startCopyOrPaste();
t.element.appendChild(text);
History.TurnOff();
if (copyPasteUseBinary) {
if (isIntoShape) {
this.lStorage = {};
this.lStorage.htmlInShape = text;
} else {
var sBase64 = this._getBinaryForCopy(worksheet);
if (this.element.children && this.element.children.length == 1 && (window.USER_AGENT_WEBKIT || window.USER_AGENT_SAFARI_MACOS)) {
$(this.element.children[0]).css("font-weight", "normal");
$(this.element.children[0]).wrap(document.createElement("b"));
}
if (this.element.children[0]) {
$(this.element.children[0]).addClass("xslData;" + sBase64);
}
this.lStorage = sBase64;
}
}
History.TurnOn();
this._endCopyOrPaste();
},
_getBinaryForCopy: function (worksheet) {
var fullUrl = this._getUseFullUrl();
window.global_pptx_content_writer.Start_UseFullUrl(fullUrl);
@@ -429,10 +524,14 @@
},
pasteRange: function (worksheet) {
var t = this;
if (AscBrowser.isMozilla) {
t._editorPaste(worksheet, t._getStylesSelect);
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
t.pasteDesktopEditorButton(t._editorPasteGetElem(worksheet, true));
} else {
t._editorPaste(worksheet);
if (AscBrowser.isMozilla) {
t._editorPaste(worksheet, t._getStylesSelect);
} else {
t._editorPaste(worksheet);
}
}
},
pasteRangeButton: function (worksheet) {
@@ -1030,6 +1129,9 @@
if (isNaN(oNewItem.format.fs)) {
oNewItem.format.fs = 11;
}
if (oNewItem.format.fs === 0) {
oNewItem.format.fs = 1;
}
oNewItem.format.b = (jqSpanObject.css("font-weight") == "bold");
oNewItem.format.i = (jqSpanObject.css("font-style") == "italic");
oNewItem.format.u = (jqSpanObject.css("text-decoration") == "underline") ? Asc.EUnderline.underlineSingle : Asc.EUnderline.underlineNone;
@@ -1800,7 +1902,7 @@
countChild = pasteFragment.children.length;
mainChildrens = pasteFragment.children;
}
if (mainChildrens && mainChildrens.length == 1 && mainChildrens[0].nodeName.toLowerCase() == "b") {
if (mainChildrens && mainChildrens.length == 1 && mainChildrens[0] != undefined && mainChildrens[0].nodeName.toLowerCase() == "b" && mainChildrens[0].children[0] != undefined) {
mainChildrens = mainChildrens[0].children;
}
var onlyImages = null;
@@ -4568,11 +4670,18 @@ function SafariIntervalFocus2() {
}
}
}
function Editor_Copy_Event_Excel(e, ElemToSelect, isCut) {
function Editor_Copy_Event_Excel(e, ElemToSelect, isCut, isAlreadyReadyHtml) {
var api = window["Asc"]["editor"];
var wb = api.wb;
var ws = wb.getWorksheet();
var sBase64 = wb.clipboard.copyRange(ws.getSelectedRange(), ws, isCut, true);
var sBase64;
if (!isAlreadyReadyHtml) {
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
sBase64 = wb.clipboard._getHtmlBase64(ws.getSelectedRange(), ws, isCut, true);
} else {
sBase64 = wb.clipboard.copyRange(ws.getSelectedRange(), ws, isCut, true);
}
}
if (isCut) {
ws.emptySelection(c_oAscCleanOptions.All);
}

View File

@@ -1303,6 +1303,11 @@
if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeRange) {
return true;
}
if (undefined !== window["AscDesktopEditor"]) {
if (false === window["AscDesktopEditor"]["CheckNeedWheel"]()) {
return true;
}
}
var delta = 0;
if (undefined !== event.wheelDelta && 0 !== event.wheelDelta) {
delta = -1 * event.wheelDelta / 40;

View File

@@ -1,181 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
(function ($, window, undefined) {
var asc = window["Asc"];
var asc_applyFunction = asc.applyFunction;
asc.WorksheetView.prototype._isLockedFrozenPane = function (callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.model.getId();
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, c_oAscLockNameFrozenPane);
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
asc.WorksheetView.prototype._isLockedAll = function (callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.model.getId();
var subType = c_oAscLockTypeElemSubType.ChangeProperties;
var ar = this.activeRange;
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, subType, sheetId, new asc.asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2));
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, true)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, true)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
asc.WorksheetView.prototype._isLockedCells = function (range, subType, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return true;
}
var sheetId = this.model.getId();
var isIntersection = false;
var newCallback = callback;
var t = this;
this.collaborativeEditing.onStartCheckLock();
var isArrayRange = Array.isArray(range);
var nLength = isArrayRange ? range.length : 1;
var nIndex = 0;
var ar = null;
for (; nIndex < nLength; ++nIndex) {
ar = isArrayRange ? range[nIndex].clone(true) : range.clone(true);
if (c_oAscLockTypeElemSubType.InsertColumns !== subType && c_oAscLockTypeElemSubType.InsertRows !== subType) {
isIntersection = this._recalcRangeByInsertRowsAndColumns(sheetId, ar);
}
if (false === isIntersection) {
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, subType, sheetId, new asc.asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2));
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return false;
} else {
if (c_oAscLockTypeElemSubType.InsertColumns === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.addColsRange(sheetId, range.clone(true));
t.collaborativeEditing.addCols(sheetId, range.c1, range.c2 - range.c1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.InsertRows === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.addRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.addRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.DeleteColumns === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.removeColsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeCols(sheetId, range.c1, range.c2 - range.c1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.DeleteRows === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.removeRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
callback(isSuccess);
};
}
}
}
}
this.collaborativeEditing.addCheckLock(lockInfo);
}
} else {
if (c_oAscLockTypeElemSubType.InsertColumns === subType) {
t.collaborativeEditing.addColsRange(sheetId, range.clone(true));
t.collaborativeEditing.addCols(sheetId, range.c1, range.c2 - range.c1 + 1);
} else {
if (c_oAscLockTypeElemSubType.InsertRows === subType) {
t.collaborativeEditing.addRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.addRows(sheetId, range.r1, range.r2 - range.r1 + 1);
} else {
if (c_oAscLockTypeElemSubType.DeleteColumns === subType) {
t.collaborativeEditing.removeColsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeCols(sheetId, range.c1, range.c2 - range.c1 + 1);
} else {
if (c_oAscLockTypeElemSubType.DeleteRows === subType) {
t.collaborativeEditing.removeRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
}
}
}
}
}
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
newCallback(true);
newCallback = undefined;
}
this.collaborativeEditing.onEndCheckLock(newCallback);
return true;
};
})(jQuery, window);

View File

@@ -8073,10 +8073,54 @@
return arnFor;
};
WorksheetView.prototype._isLockedFrozenPane = function (callback) {
asc_applyFunction(callback, true);
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.model.getId();
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, c_oAscLockNameFrozenPane);
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
WorksheetView.prototype._isLockedAll = function (callback) {
asc_applyFunction(callback, true);
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return;
}
var sheetId = this.model.getId();
var subType = c_oAscLockTypeElemSubType.ChangeProperties;
var ar = this.activeRange;
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, subType, sheetId, new asc.asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2));
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, true)) {
asc_applyFunction(callback, true);
return;
} else {
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, true)) {
asc_applyFunction(callback, false);
return;
}
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
WorksheetView.prototype._recalcRangeByInsertRowsAndColumns = function (sheetId, ar) {
var isIntersection = false,
@@ -8119,7 +8163,98 @@
return isIntersection;
};
WorksheetView.prototype._isLockedCells = function (range, subType, callback) {
asc_applyFunction(callback, true);
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
asc_applyFunction(callback, true);
return true;
}
var sheetId = this.model.getId();
var isIntersection = false;
var newCallback = callback;
var t = this;
this.collaborativeEditing.onStartCheckLock();
var isArrayRange = Array.isArray(range);
var nLength = isArrayRange ? range.length : 1;
var nIndex = 0;
var ar = null;
for (; nIndex < nLength; ++nIndex) {
ar = isArrayRange ? range[nIndex].clone(true) : range.clone(true);
if (c_oAscLockTypeElemSubType.InsertColumns !== subType && c_oAscLockTypeElemSubType.InsertRows !== subType) {
isIntersection = this._recalcRangeByInsertRowsAndColumns(sheetId, ar);
}
if (false === isIntersection) {
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, subType, sheetId, new asc.asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2));
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
asc_applyFunction(callback, false);
return false;
} else {
if (c_oAscLockTypeElemSubType.InsertColumns === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.addColsRange(sheetId, range.clone(true));
t.collaborativeEditing.addCols(sheetId, range.c1, range.c2 - range.c1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.InsertRows === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.addRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.addRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.DeleteColumns === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.removeColsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeCols(sheetId, range.c1, range.c2 - range.c1 + 1);
}
callback(isSuccess);
};
} else {
if (c_oAscLockTypeElemSubType.DeleteRows === subType) {
newCallback = function (isSuccess) {
if (isSuccess) {
t.collaborativeEditing.removeRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
callback(isSuccess);
};
}
}
}
}
this.collaborativeEditing.addCheckLock(lockInfo);
}
} else {
if (c_oAscLockTypeElemSubType.InsertColumns === subType) {
t.collaborativeEditing.addColsRange(sheetId, range.clone(true));
t.collaborativeEditing.addCols(sheetId, range.c1, range.c2 - range.c1 + 1);
} else {
if (c_oAscLockTypeElemSubType.InsertRows === subType) {
t.collaborativeEditing.addRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.addRows(sheetId, range.r1, range.r2 - range.r1 + 1);
} else {
if (c_oAscLockTypeElemSubType.DeleteColumns === subType) {
t.collaborativeEditing.removeColsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeCols(sheetId, range.c1, range.c2 - range.c1 + 1);
} else {
if (c_oAscLockTypeElemSubType.DeleteRows === subType) {
t.collaborativeEditing.removeRowsRange(sheetId, range.clone(true));
t.collaborativeEditing.removeRows(sheetId, range.r1, range.r2 - range.r1 + 1);
}
}
}
}
}
}
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
newCallback(true);
newCallback = undefined;
}
this.collaborativeEditing.onEndCheckLock(newCallback);
return true;
};
WorksheetView.prototype.changeWorksheet = function (prop, val) {