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

@@ -73,16 +73,21 @@ function scRGB_to_sRGB(value) {
}
function checkRasterImageId(rasterImageId) {
var api_sheet = window["Asc"]["editor"];
var sFindString;
var sFindString, sFindString2;
if (api_sheet) {
sFindString = api_sheet.wbModel.sUrlPath + "media/";
} else {
sFindString = window.editor.DocumentUrl + "media/";
sFindString2 = documentOrigin + sFindString;
}
if (0 === rasterImageId.indexOf(sFindString)) {
return rasterImageId.substring(sFindString.length);
} else {
return rasterImageId;
if (0 === rasterImageId.indexOf(sFindString2)) {
return rasterImageId.substring(sFindString2.length);
} else {
return rasterImageId;
}
}
}
var g_oThemeFontsName = {};

View File

@@ -698,11 +698,16 @@ CFontSelect.prototype = {
if (bIsDictionary !== false) {
_len = fs.GetLong();
this.m_wsFontPath = fs.GetString(_len >> 1);
var _found1 = this.m_wsFontPath.lastIndexOf("/");
var _found2 = this.m_wsFontPath.lastIndexOf("\\");
var _found = Math.max(_found1, _found2);
if (0 <= _found) {
this.m_wsFontPath = this.m_wsFontPath.substring(_found + 1);
if (undefined === window["AscDesktopEditor"]) {
var _found1 = this.m_wsFontPath.lastIndexOf("/");
var _found2 = this.m_wsFontPath.lastIndexOf("\\");
var _found = Math.max(_found1, _found2);
if (0 <= _found) {
this.m_wsFontPath = this.m_wsFontPath.substring(_found + 1);
}
} else {
this.m_wsFontPath = this.m_wsFontPath.replace(/\\\\/g, "\\");
this.m_wsFontPath = this.m_wsFontPath.replace(/\\/g, "/");
}
}
this.m_lIndex = fs.GetLong();

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +1,5 @@
/*
* (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
*
*/
var editor = undefined;
var window = {};
@@ -400,12 +372,42 @@ function NativeGetFileData()
{
return _api.asc_nativeGetFileData();
}
function NativeGetFileDataHtml()
{
if (_api.asc_nativeGetHtml)
return _api.asc_nativeGetHtml();
return "";
}
function NativeStartMailMergeByList(database)
{
if (_api.asc_StartMailMergeByList)
return _api.asc_StartMailMergeByList(database);
return undefined;
}
function NativePreviewMailMergeResult(index)
{
if (_api.asc_PreviewMailMergeResult)
return _api.asc_PreviewMailMergeResult(index);
return undefined;
}
function NativeGetMailMergeFiledValue(index, name)
{
if (_api.asc_GetMailMergeFiledValue)
return _api.asc_GetMailMergeFiledValue(index, name);
return "";
}
function GetNativeCountPages()
{
return _api.asc_nativePrintPagesCount();
}
function GetNativeFileDataPDF()
{
return _api.asc_nativeGetPDF();
}
window.memory1 = null;
window.memory2 = null;

View File

@@ -1332,8 +1332,9 @@ function BinaryPPTYLoader() {
break;
case 3:
s.Skip2(6);
uni_fill.fill.setRasterImageId(s.GetString2());
var _s = uni_fill.fill.RasterImageId;
var sReadPath = s.GetString2();
uni_fill.fill.setRasterImageId(sReadPath);
var _s = sReadPath;
var indS = _s.lastIndexOf("emf");
if (indS == -1) {
indS = _s.lastIndexOf("wmf");
@@ -1341,16 +1342,18 @@ function BinaryPPTYLoader() {
if (indS != -1 && (indS == (_s.length - 3))) {
_s = _s.substring(0, indS);
_s += "svg";
sReadPath = _s;
uni_fill.fill.setRasterImageId(_s);
}
if (this.IsThemeLoader) {
uni_fill.fill.setRasterImageId("theme" + (this.Api.ThemeLoader.CurrentLoadThemeIndex + 1) + "/media/" + uni_fill.fill.RasterImageId);
sReadPath = "theme" + (this.Api.ThemeLoader.CurrentLoadThemeIndex + 1) + "/media/" + sReadPath;
uni_fill.fill.setRasterImageId(sReadPath);
}
if (this.ImageMapChecker != null) {
this.ImageMapChecker[uni_fill.fill.RasterImageId] = true;
this.ImageMapChecker[sReadPath] = true;
}
if (this.IsUseFullUrl) {
this.RebuildImages.push(new CBuilderImages(uni_fill.fill, uni_fill.fill.RasterImageId));
this.RebuildImages.push(new CBuilderImages(uni_fill.fill, sReadPath));
}
s.Skip2(1);
break;
@@ -4712,6 +4715,7 @@ function BinaryPPTYLoader() {
}
para_pr.DefaultRunPr.Set_FromObject(r_pr);
}
break;
default:
s.SkipRecord();
}

View File

@@ -38,6 +38,7 @@
return new asc_CAscEditorPermissions();
}
if (settings) {
this.canLicense = settings["canLicense"];
this.canEdit = settings["canEdit"];
this.canDownload = settings["canDownload"];
this.canCoAuthoring = settings["canCoAuthoring"];
@@ -60,6 +61,9 @@
}
asc_CAscEditorPermissions.prototype = {
constructor: asc_CAscEditorPermissions,
asc_getCanLicense: function () {
return this.canLicense;
},
asc_getCanEdit: function () {
return this.canEdit;
},
@@ -84,6 +88,9 @@
asc_getIsAnalyticsEnable: function () {
return this.isAnalyticsEnable;
},
asc_setCanLicense: function (v) {
this.canLicense = v;
},
asc_setCanEdit: function (v) {
this.canEdit = v;
},
@@ -111,6 +118,7 @@
};
window["Asc"]["asc_CAscEditorPermissions"] = window["Asc"].asc_CAscEditorPermissions = asc_CAscEditorPermissions;
prot = asc_CAscEditorPermissions.prototype;
prot["asc_getCanLicense"] = prot.asc_getCanLicense;
prot["asc_getCanEdit"] = prot.asc_getCanEdit;
prot["asc_getCanDownload"] = prot.asc_getCanDownload;
prot["asc_getCanCoAuthoring"] = prot.asc_getCanCoAuthoring;
@@ -904,12 +912,69 @@
}
window["Asc"].generateColor = generateColor;
window["Asc"].hsvToRgb = hsvToRgb;
function asc_CVersionHistory(newObj) {
this.docId = null;
this.url = null;
this.urlChanges = null;
this.currentChangeId = -1;
this.newChangeId = -1;
this.colors = null;
this.changes = null;
if (newObj) {
this.update(newObj);
}
}
asc_CVersionHistory.prototype.update = function (newObj) {
var bUpdate = (this.docId !== newObj.docId || this.url !== newObj.url || this.urlChanges !== newObj.urlChanges || this.currentChangeId > newObj.currentChangeId);
if (bUpdate) {
this.docId = newObj.docId;
this.url = newObj.url;
this.urlChanges = newObj.urlChanges;
this.currentChangeId = -1;
this.changes = null;
}
this.colors = newObj.colors;
this.newChangeId = newObj.currentChangeId;
return bUpdate;
};
asc_CVersionHistory.prototype.applyChanges = function (editor) {
var color;
this.newChangeId = (null == this.newChangeId) ? (this.changes.length - 1) : this.newChangeId;
for (var i = this.currentChangeId + 1; i <= this.newChangeId && i < this.changes.length; ++i) {
color = this.colors[i];
editor._coAuthoringSetChanges(this.changes[i], i !== this.newChangeId ? null : (color ? new CDocumentColor((color >> 16) & 255, (color >> 8) & 255, color & 255) : new CDocumentColor(191, 255, 199)));
}
this.currentChangeId = this.newChangeId;
};
asc_CVersionHistory.prototype.asc_setDocId = function (val) {
this.docId = val;
};
asc_CVersionHistory.prototype.asc_setUrl = function (val) {
this.url = val;
};
asc_CVersionHistory.prototype.asc_setUrlChanges = function (val) {
this.urlChanges = val;
};
asc_CVersionHistory.prototype.asc_setCurrentChangeId = function (val) {
this.currentChangeId = val;
};
asc_CVersionHistory.prototype.asc_setArrColors = function (val) {
this.colors = val;
};
window["Asc"].asc_CVersionHistory = window["Asc"]["asc_CVersionHistory"] = asc_CVersionHistory;
prot = asc_CVersionHistory.prototype;
prot["asc_setDocId"] = prot.asc_setDocId;
prot["asc_setUrl"] = prot.asc_setUrl;
prot["asc_setUrlChanges"] = prot.asc_setUrlChanges;
prot["asc_setCurrentChangeId"] = prot.asc_setCurrentChangeId;
prot["asc_setArrColors"] = prot.asc_setArrColors;
})(window);
var CColor = window["CColor"];
var asc_ChartSettings = window["asc_ChartSettings"];
var asc_ValAxisSettings = window["asc_ValAxisSettings"];
var asc_CatAxisSettings = window["asc_CatAxisSettings"];
var g_oArrUserColors = [15064320, 58807, 16724950, 1759488, 9981439, 56805, 15050496, 15224319, 10154496, 16731553, 62146, 47077, 1828096, 15859712, 15427327, 15919360, 15905024, 59890, 12733951, 13496832, 62072, 49906, 16734720, 10682112, 7890687, 16731610, 65406, 38655, 16747008, 14221056, 16737966, 1896960, 65484, 10970879, 16759296, 16711680, 63231, 16774656, 2031360, 52479, 13330175, 16743219, 3386367, 11927347, 16752947, 9404671, 4980531, 16744678, 3407830, 11960575, 16724787, 10878873, 14745395, 16762931, 15696127, 3397375, 16744636, 3407768, 3406079, 13926655, 15269734, 16751083, 6742271, 16766566, 13107046, 16775219, 16751718, 10852863, 6750176, 16737894, 14457343, 16759142, 6750130, 6865407, 15650047, 16769945, 7929702, 16751049, 6748927, 16751001, 12884479, 16775782, 16765081, 10087423, 10878873, 16757744, 10081791, 14352281, 15053823, 10092523, 16760217, 15728537, 13815039, 16776652, 16757719, 13432319, 16773580, 13828044, 15650047, 15893248, 16724883, 58737, 15007744, 36594, 12772608, 12137471, 6442495, 9561344, 15021055, 34789, 15039488, 44761, 16718470, 14274816, 11606783, 9099520, 53721, 16718545, 1625088, 15881472, 13419776, 50636, 14752511, 55659, 14261760, 32985, 11389952, 16711800, 8571904, 1490688, 16711884, 8991743, 13407488, 41932, 11010303, 7978752, 15028480, 52387, 15007927, 52325, 47295, 14549247, 12552960, 12564480, 39359, 15007852, 12114176, 1421824, 55726, 13041893, 10665728, 30924, 49049, 14251264, 48990, 14241024, 36530, 11709440, 13369507, 44210, 11698688, 7451136, 13397504, 45710, 34214];
var c_oAscArrUserColors = [15064320, 58807, 16724950, 1759488, 9981439, 56805, 15050496, 15224319, 10154496, 16731553, 62146, 47077, 1828096, 15859712, 15427327, 15919360, 15905024, 59890, 12733951, 13496832, 62072, 49906, 16734720, 10682112, 7890687, 16731610, 65406, 38655, 16747008, 14221056, 16737966, 1896960, 65484, 10970879, 16759296, 16711680, 63231, 16774656, 2031360, 52479, 13330175, 16743219, 3386367, 11927347, 16752947, 9404671, 4980531, 16744678, 3407830, 11960575, 16724787, 10878873, 14745395, 16762931, 15696127, 3397375, 16744636, 3407768, 3406079, 13926655, 15269734, 16751083, 6742271, 16766566, 13107046, 16775219, 16751718, 10852863, 6750176, 16737894, 14457343, 16759142, 6750130, 6865407, 15650047, 16769945, 7929702, 16751049, 6748927, 16751001, 12884479, 16775782, 16765081, 10087423, 10878873, 16757744, 10081791, 14352281, 15053823, 10092523, 16760217, 15728537, 13815039, 16776652, 16757719, 13432319, 16773580, 13828044, 15650047, 15893248, 16724883, 58737, 15007744, 36594, 12772608, 12137471, 6442495, 9561344, 15021055, 34789, 15039488, 44761, 16718470, 14274816, 11606783, 9099520, 53721, 16718545, 1625088, 15881472, 13419776, 50636, 14752511, 55659, 14261760, 32985, 11389952, 16711800, 8571904, 1490688, 16711884, 8991743, 13407488, 41932, 11010303, 7978752, 15028480, 52387, 15007927, 52325, 47295, 14549247, 12552960, 12564480, 39359, 15007852, 12114176, 1421824, 55726, 13041893, 10665728, 30924, 49049, 14251264, 48990, 14241024, 36530, 11709440, 13369507, 44210, 11698688, 7451136, 13397504, 45710, 34214];
window["c_oAscArrUserColors"] = c_oAscArrUserColors;
function CAscMathType() {
this.Id = 0;
this.X = 0;

View File

@@ -48,7 +48,7 @@
this.id = val["id"];
this.userName = val["username"];
this.indexUser = val["indexUser"];
this.color = g_oArrUserColors[this.indexUser % g_oArrUserColors.length];
this.color = c_oAscArrUserColors[this.indexUser % c_oAscArrUserColors.length];
this.state = val["state"];
this.view = val["view"];
}

View File

@@ -37,6 +37,68 @@ var g_sSpellCheckServiceLocalUrl = "/SpellChecker.ashx";
var g_sTrackingServiceLocalUrl = "/TrackingService.ashx";
var g_nMaxJsonLength = 2097152;
var g_nMaxJsonLengthChecked = g_nMaxJsonLength / 1000;
function OpenFileResult() {
this.bSerFormat = false;
this.data = null;
this.url = null;
this.changes = null;
}
function g_fOpenFileCommand(binUrl, changesUrl, Signature, callback) {
var bError = false,
oResult = new OpenFileResult(),
bEndLoadFile = false,
bEndLoadChanges = false;
var onEndOpen = function () {
if (bEndLoadFile && bEndLoadChanges) {
if (callback) {
callback(bError, oResult);
}
}
};
var sFileUrl = g_sResourceServiceLocalUrl + binUrl;
sFileUrl = sFileUrl.replace(/\\/g, "/");
asc_ajax({
url: sFileUrl,
dataType: "text",
success: function (result) {
var url;
var nIndex = sFileUrl.lastIndexOf("/");
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
if (0 < result.length) {
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
oResult.data = result;
oResult.url = url;
} else {
bError = true;
}
bEndLoadFile = true;
onEndOpen();
},
error: function () {
bEndLoadFile = true;
bError = true;
onEndOpen();
}
});
if (null != changesUrl) {
require("jsziputils").getBinaryContent(changesUrl, function (err, data) {
bEndLoadChanges = true;
if (err) {
bError = true;
onEndOpen();
return;
}
var oZipFile = new(require("jszip"))(data);
oResult.changes = [];
for (var i in oZipFile.files) {
oResult.changes.push(JSON.parse(oZipFile.file(i).asText()));
}
onEndOpen();
});
} else {
bEndLoadChanges = true;
}
}
function fSortAscending(a, b) {
return a - b;
}
@@ -708,4 +770,92 @@ if (AscBrowser.isIE) {
Child.superclass = Parent.prototype;
}
asc.extendClass = extendClass;
})(window);
})(window);
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);
}

View File

@@ -215,6 +215,32 @@ function Editor_Copy(api, bCut) {
rangeToSelect.select();
}
}
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
if (bCut) {
var __oncut = ElemToSelect.oncut;
ElemToSelect.oncut = function (e) {
ElemToSelect.oncut = __oncut;
__oncut = null;
if (false === api.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content)) {
ElemToSelect.innerHTML = "";
Editor_Copy_Event(e, ElemToSelect);
api.WordControl.m_oLogicDocument.Remove(1, true, true);
api.WordControl.m_oLogicDocument.Document_UpdateSelectionState();
}
};
window["AscDesktopEditor"]["Cut"]();
} else {
var __oncopy = ElemToSelect.oncopy;
ElemToSelect.oncopy = function (e) {
ElemToSelect.oncopy = __oncopy;
__oncopy = null;
ElemToSelect.innerHTML = "";
Editor_Copy_Event(e, ElemToSelect);
};
window["AscDesktopEditor"]["Copy"]();
}
return;
}
var time_interval = 200;
if (window.USER_AGENT_SAFARI_MACOS) {
time_interval = 200;
@@ -2053,6 +2079,24 @@ function Editor_Paste(api, bClean) {
rangeToSelect.select();
}
}
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
var __onpaste = pastebin.onpaste;
pastebin.onpaste = function (e) {
pastebin.onpaste = __onpaste;
__onpaste = null;
if (!window.GlobalPasteFlag) {
return;
}
if (window.GlobalPasteFlagCounter == 1) {
Body_Paste(api, e);
if (window.GlobalPasteFlag) {
window.GlobalPasteFlagCounter = 2;
}
}
};
window["AscDesktopEditor"]["Paste"]();
return;
}
var func_timeout = function () {
if (PASTE_EMPTY_USE && !oWordControl.bIsEventPaste) {
if (pastebin.innerHTML == "&nbsp;") {
@@ -3934,10 +3978,21 @@ PasteProcessor.prototype = {
if (true == this.bUploadImage || true == this.bUploadFonts) {
var aPrepeareFonts = this._Prepeare_recursive(node, true, true);
var aImagesToDownload = [];
var _mapLocal = {};
for (var image in this.oImages) {
var src = this.oImages[image];
if (0 == src.indexOf("file:")) {
this.oImages[image] = "local";
if (window["AscDesktopEditor"] !== undefined) {
var _base64 = window["AscDesktopEditor"]["GetImageBase64"](src);
if (_base64 != "") {
aImagesToDownload.push(_base64);
_mapLocal[_base64] = src;
} else {
this.oImages[image] = "local";
}
} else {
this.oImages[image] = "local";
}
} else {
if (false == (0 == src.indexOf(documentOrigin + this.api.DocumentUrl) || 0 == src.indexOf(this.api.DocumentUrl))) {
aImagesToDownload.push(src);
@@ -3960,6 +4015,9 @@ PasteProcessor.prototype = {
var sFrom = aImagesToDownload[i];
var sTo = oFromTo[sFrom];
if (sTo) {
if (_mapLocal[sFrom] !== undefined) {
sFrom = _mapLocal[sFrom];
}
oThis.oImages[sFrom] = sTo;
oPrepeareImages[i] = sTo;
}