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

@@ -245,6 +245,16 @@ function CFontFileLoader(id) {
return (0 == this.Status || 1 == this.Status);
};
this.LoadFontAsync = function (basePath, _callback) {
if (window["AscDesktopEditor"] !== undefined && this.CanUseOriginalFormat) {
if (-1 != this.Status) {
return true;
}
this.callback = null;
this.Status = 2;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
if (ASC_DOCS_API_USE_FONTS_ORIGINAL_FORMAT && this.CanUseOriginalFormat && bIsSupportOriginalFormatFonts && !window["qtDocBridge"] && !window["scriptBridge"]) {
this.LoadFontAsync2(basePath, _callback);
return;

View File

@@ -1507,8 +1507,159 @@ 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 == locktype_None || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode) {
return;
}
if (lock_type == locktype_Mine) {
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 (editor.isViewMode || this.IsThumbnail || lock_type == locktype_None) {
return;
}
if (editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false && lock_type == locktype_Mine) {
return;
}
if (lock_type == locktype_Mine) {
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 = editor.WordControl.m_oDrawingDocument.AutoShapesTrack;
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 || editor.isViewMode) && (editor.isShowTableEmptyLineAttack === false)) {
return;

View File

@@ -1403,6 +1403,11 @@ function CEditorPage(api) {
if (false === oThis.m_oApi.bInit_word_control) {
return;
}
if (undefined !== window["AscDesktopEditor"]) {
if (false === window["AscDesktopEditor"]["CheckNeedWheel"]()) {
return;
}
}
var _ctrl = false;
if (e.metaKey !== undefined) {
_ctrl = e.ctrlKey || e.metaKey;

View File

@@ -699,6 +699,7 @@ function CMetafile(width, height) {
Name: "",
Replace: null
};
this.StartOffset = 0;
}
CMetafile.prototype = {
p_color: function (r, g, b, a) {
@@ -1170,6 +1171,7 @@ CDocumentRenderer.prototype = {
this.m_arrayPages[this.m_arrayPages.length] = new CMetafile(width, height);
this.m_lPagesCount = this.m_arrayPages.length;
this.m_arrayPages[this.m_lPagesCount - 1].Memory = this.Memory;
this.m_arrayPages[this.m_lPagesCount - 1].StartOffset = this.Memory.pos;
this.m_arrayPages[this.m_lPagesCount - 1].VectorMemoryForPrint = this.VectorMemoryForPrint;
this.Memory.WriteByte(CommandType.ctPageStart);
this.Memory.WriteByte(CommandType.ctPageWidth);

View File

@@ -1,185 +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 == locktype_None || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode) {
return;
}
if (lock_type == locktype_Mine) {
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 (editor.isViewMode || this.IsThumbnail || lock_type == locktype_None) {
return;
}
if (editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false && lock_type == locktype_Mine) {
return;
}
if (lock_type == locktype_Mine) {
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 = editor.WordControl.m_oDrawingDocument.AutoShapesTrack;
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

@@ -984,8 +984,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.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;
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);

View File

@@ -50,6 +50,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;
};
}
var g_oIdCounter = new CIdCounter();
function CTableId() {
@@ -567,6 +573,11 @@ function CTableId() {
return true;
};
this.Unlock = function (Data) {};
this.Clear = function () {
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Add(this, g_oIdCounter.Get_NewId());
};
}
var g_oTableId = null;
function CCollaborativeChanges() {

View File

@@ -491,6 +491,7 @@ function CDocument(DrawingDocument) {
}
this.Spelling = new CDocumentSpelling();
this.UseTextShd = true;
this.CheckLanguageOnTextAdd = false;
g_oTableId.Add(this, this.Id);
}
var selected_None = -1;
@@ -6578,7 +6579,9 @@ CDocument.prototype = {
} else {
this.DrawingDocument.TargetStart();
this.DrawingDocument.TargetShow();
this.CheckLanguageOnTextAdd = true;
this.Paragraph_Add(new ParaSpace());
this.CheckLanguageOnTextAdd = false;
}
}
}
@@ -7236,7 +7239,9 @@ CDocument.prototype = {
this.Create_NewHistoryPoint(historydescription_Document_AddLetter);
this.DrawingDocument.TargetStart();
this.DrawingDocument.TargetShow();
this.CheckLanguageOnTextAdd = true;
this.Paragraph_Add(new ParaText(String.fromCharCode(Code)));
this.CheckLanguageOnTextAdd = false;
}
bRetValue = true;
}
@@ -8722,13 +8727,13 @@ CDocument.prototype = {
Create_NewHistoryPoint: function (Description) {
this.History.Create_NewPoint(Description);
},
Document_Undo: function () {
Document_Undo: function (Options) {
if (true === CollaborativeEditing.Get_GlobalLock()) {
return;
}
this.DrawingDocument.EndTrackTable(null, true);
this.DrawingObjects.TurnOffCheckChartSelection();
this.History.Undo();
this.History.Undo(Options);
this.DrawingObjects.TurnOnCheckChartSelection();
this.Recalculate(false, false, this.History.RecalculateData);
this.Document_UpdateSelectionState();

View File

@@ -126,7 +126,7 @@ CHistory.prototype = {
}
return false;
},
Undo: function () {
Undo: function (Options) {
this.Check_UninonLastPoints();
if (true != this.Can_Undo()) {
return null;
@@ -138,14 +138,28 @@ CHistory.prototype = {
this.LastState = this.Document.Get_SelectionState();
}
this.Document.Selection_Remove();
var Point = this.Points[this.Index--];
this.Internal_RecalcData_Clear();
for (var Index = Point.Items.length - 1; Index >= 0; Index--) {
var Item = Point.Items[Index];
Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
var Point = null;
if (undefined !== Options && null !== Options && true === Options.All) {
while (this.Index >= 0) {
Point = this.Points[this.Index--];
for (var Index = Point.Items.length - 1; Index >= 0; Index--) {
var Item = Point.Items[Index];
Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
}
} else {
Point = this.Points[this.Index--];
for (var Index = Point.Items.length - 1; Index >= 0; Index--) {
var Item = Point.Items[Index];
Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
}
if (null != Point) {
this.Document.Set_SelectionState(Point.State);
}
this.Document.Set_SelectionState(Point.State);
return this.RecalculateData;
},
Redo: function () {

View File

@@ -2834,13 +2834,15 @@ Paragraph.prototype = {
var ContentPos = new CParagraphContentPos();
var CurRange = Class.StartRange;
var CurLine = Class.StartLine;
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++) {
var Element = this.Content[CurPos];
ContentPos.Update(CurPos, 0);
if (true === Element.Get_PosByElement(Class, ContentPos, 1, true, CurRange, CurLine)) {
return ContentPos;
if (undefined !== this.Lines[CurLine] && undefined !== this.Lines[CurLine].Ranges[CurRange]) {
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++) {
var Element = this.Content[CurPos];
ContentPos.Update(CurPos, 0);
if (true === Element.Get_PosByElement(Class, ContentPos, 1, true, CurRange, CurLine)) {
return ContentPos;
}
}
}
var ContentLen = this.Content.length;
@@ -2851,6 +2853,7 @@ Paragraph.prototype = {
return ContentPos;
}
}
return null;
},
Get_RunElementByPos: function (ContentPos) {
var CurPos = ContentPos.Get(0);
@@ -3028,6 +3031,20 @@ Paragraph.prototype = {
this.Content[ContentLen - 1].Get_EndPos(BehindEnd, ContentPos, Depth + 1);
return ContentPos;
},
Get_EndPos2: function (BehindEnd) {
var ContentPos = new CParagraphContentPos();
var Depth = 0;
var ContentLen = this.Content.length;
var Pos;
if (this.Content.length > 1) {
Pos = ContentLen - 2;
} else {
Pos = ContentLen - 1;
}
ContentPos.Update(Pos, Depth);
this.Content[Pos].Get_EndPos(BehindEnd, ContentPos, Depth + 1);
return ContentPos;
},
Get_NextRunElements: function (RunElements) {
var ContentPos = RunElements.ContentPos;
var CurPos = ContentPos.Get(0);
@@ -7021,7 +7038,12 @@ Paragraph.prototype = {
},
Continue: function (NewParagraph) {
this.CopyPr(NewParagraph);
var TextPr = this.Get_TextPr(this.Get_EndPos(false));
var TextPr;
if (this.bFromDocument) {
TextPr = this.Get_TextPr(this.Get_EndPos(false));
} else {
TextPr = this.Get_TextPr(this.Get_EndPos2(false));
}
NewParagraph.Internal_Content_Add(0, new ParaRun(NewParagraph));
NewParagraph.Correct_Content();
NewParagraph.Cursor_MoveToStartPos(false);
@@ -8717,6 +8739,9 @@ CParagraphContentPos.prototype = {
Get_Depth: function () {
return this.Depth - 1;
},
Decrease_Depth: function (nCount) {
this.Depth = Math.max(0, this.Depth - nCount);
},
Copy: function () {
var PRPos = new CParagraphContentPos();
var Count = this.Data.length;

View File

@@ -215,6 +215,41 @@ ParaRun.prototype.Is_StartFromNewLine = function () {
return true;
};
ParaRun.prototype.Add = function (Item, bMath) {
if (this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.CheckLanguageOnTextAdd && editor && editor.asc_getKeyboardLanguage) {
var nRequiredLanguage = editor.asc_getKeyboardLanguage();
var nCurrentLanguage = this.Get_CompiledPr(false).Lang.Val;
if (-1 !== nRequiredLanguage && nRequiredLanguage !== nCurrentLanguage) {
var NewLang = new CLang();
NewLang.Val = nRequiredLanguage;
if (this.Is_Empty()) {
this.Set_Lang(NewLang);
} else {
var Parent = this.Get_Parent();
var RunPos = this.private_GetPosInParent();
if (null !== Parent && -1 !== RunPos) {
var NewRun = new ParaRun(this.Paragraph, bMath);
NewRun.Set_Pr(this.Pr.Copy());
NewRun.Set_Lang(NewLang);
NewRun.Cursor_MoveToStartPos();
NewRun.Add(Item, bMath);
var CurPos = this.State.ContentPos;
if (0 === CurPos) {
Parent.Add_ToContent(RunPos, NewRun);
} else {
if (this.Content.length === CurPos) {
Parent.Add_ToContent(RunPos + 1, NewRun);
} else {
var RightRun = this.Split2(CurPos);
Parent.Add_ToContent(RunPos + 1, NewRun);
Parent.Add_ToContent(RunPos + 2, RightRun);
}
}
NewRun.Make_ThisElementCurrent();
return;
}
}
}
}
this.Add_ToContent(this.State.ContentPos, Item, true, bMath);
};
ParaRun.prototype.Remove = function (Direction, bOnAddText) {
@@ -5634,6 +5669,39 @@ ParaRun.prototype.Get_RangesByPos = function (Pos) {
}
return Ranges;
};
ParaRun.prototype.Get_Parent = function () {
if (!this.Paragraph) {
return null;
}
var ContentPos = this.Paragraph.Get_PosByElement(this);
if (null == ContentPos || undefined == ContentPos || ContentPos.Get_Depth() < 0) {
return null;
}
ContentPos.Decrease_Depth(1);
return this.Paragraph.Get_ElementByPos(ContentPos);
};
ParaRun.prototype.private_GetPosInParent = function (_Parent) {
var Parent = (_Parent ? _Parent : this.Get_Parent());
if (!Parent) {
return -1;
}
var RunPos = -1;
for (var Pos = 0, Count = Parent.Content.length; Pos < Count; Pos++) {
if (this === Parent.Content[Pos]) {
RunPos = Pos;
break;
}
}
return RunPos;
};
ParaRun.prototype.Make_ThisElementCurrent = function () {
if (this.Paragraph) {
var ContentPos = this.Paragraph.Get_PosByElement(this);
ContentPos.Add(this.State.ContentPos);
this.Paragraph.Set_ParaContentPos(ContentPos, true, -1, -1);
this.Paragraph.Document_SetThisElementCurrent(false);
}
};
function CParaRunStartState(Run) {
this.Paragraph = Run.Paragraph;
this.Pr = Run.Pr.Copy();

View File

@@ -8322,9 +8322,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
this.oReadResult.bLastRun = true;
} else {
if (c_oSerRunType.object === type) {
var oDrawing = new Object();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadObject(t, l, oParStruct);
return oThis.ReadObject(t, l, oParStruct, oDrawing);
});
if (null != oDrawing.content.GraphicObj) {
oNewElem = oDrawing.content;
}
} else {
res = c_oSerConstants.ReadUnknown;
}
@@ -8378,7 +8382,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
}
oDrawing.content = oParaDrawing;
};
this.ReadObject = function (type, length, oParStruct) {
this.ReadObject = function (type, length, oParStruct, oDrawing) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
if (c_oSerParType.OMath === type) {
@@ -8391,15 +8395,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
}
} else {
if (c_oSerRunType.pptxDrawing === type) {
var oNewElem = null;
var oDrawing = new Object();
this.ReadDrawing(type, length, oParStruct, oDrawing, res);
if (null != oDrawing.content.GraphicObj) {
oNewElem = oDrawing.content;
var oNewRun = new ParaRun(oParStruct.paragraph);
oNewRun.Add_ToContent(0, oNewElem, false);
oParStruct.addToContent(oNewRun);
}
} else {
res = c_oSerConstants.ReadUnknown;
}

View File

@@ -41,6 +41,7 @@ var DOCUMENT_SPELLING_EXCEPTIONAL_WORDS = {
};
function CDocumentSpelling() {
this.Use = true;
this.TurnOn = 1;
this.ErrorsExceed = false;
this.Paragraphs = {};
this.Words = {};
@@ -51,6 +52,12 @@ function CDocumentSpelling() {
this.Words = DOCUMENT_SPELLING_EXCEPTIONAL_WORDS;
}
CDocumentSpelling.prototype = {
TurnOff: function () {
this.TurnOn -= 1;
},
TurnOn: function () {
this.TurnOn += 1;
},
Add_Paragraph: function (Id, Para) {
this.Paragraphs[Id] = Para;
},
@@ -90,6 +97,9 @@ CDocumentSpelling.prototype = {
return Count;
},
Continue_CheckSpelling: function () {
if (0 == this.TurnOn) {
return;
}
if (true === this.ErrorsExceed) {
return;
}
@@ -131,12 +141,19 @@ CDocumentSpelling.prototype = {
Para.SpellChecker.Check(undefined, true);
}
},
Add_WaitingParagraph: function (Para) {
Add_WaitingParagraph: function (Para, RecalcId, Words, Langs) {
var ParaId = Para.Get_Id();
if (undefined === this.WaitingParagraphs[ParaId]) {
this.WaitingParagraphs[Para.Get_Id()] = Para;
var WPara = this.WaitingParagraphs[ParaId];
if (undefined === WPara || RecalcId !== WPara.RecalcId || true !== this.private_CompareWordsAndLangs(WPara.Words, Words, WPara.Langs, Langs)) {
this.WaitingParagraphs[ParaId] = {
Words: Words,
Langs: Langs,
RecalcId: RecalcId
};
this.WaitingParagraphsCount++;
return true;
}
return false;
},
Check_WaitingParagraph: function (Para) {
var ParaId = Para.Get_Id();
@@ -151,6 +168,17 @@ CDocumentSpelling.prototype = {
delete this.WaitingParagraphs[ParaId];
this.WaitingParagraphsCount--;
}
},
private_CompareWordsAndLangs: function (Words1, Words2, Langs1, Langs2) {
if (undefined === Words1 || undefined === Words2 || undefined === Langs1 || undefined === Langs2 || Words1.length !== Words2.length || Words1.length !== Langs1.length || Words1.length !== Langs2.length) {
return false;
}
for (var nIndex = 0, nCount = Words1.length; nIndex < nCount; nIndex++) {
if (Words1[nIndex] !== Words2[nIndex] || Langs1[nIndex] !== Langs2[nIndex]) {
return false;
}
}
return true;
}
};
function CParaSpellChecker(Paragraph) {
@@ -220,16 +248,16 @@ CParaSpellChecker.prototype = {
}
}
if (0 < usrWords.length) {
editor.WordControl.m_oLogicDocument.Spelling.Add_WaitingParagraph(this.Paragraph);
this.RecalcId += "_checked";
spellCheck(editor, {
"type": "spell",
"ParagraphId": this.ParaId,
"RecalcId": this.RecalcId,
"ElementId": 0,
"usrWords": usrWords,
"usrLang": usrLang
});
if (true === editor.WordControl.m_oLogicDocument.Spelling.Add_WaitingParagraph(this.Paragraph, this.RecalcId, usrWords, usrLang)) {
spellCheck(editor, {
"type": "spell",
"ParagraphId": this.ParaId,
"RecalcId": this.RecalcId,
"ElementId": 0,
"usrWords": usrWords,
"usrLang": usrLang
});
} else {}
} else {
if (undefined != ParagraphForceRedraw) {
ParagraphForceRedraw.ReDraw();
@@ -507,9 +535,18 @@ CDocument.prototype.Restart_CheckSpelling = function () {
this.Content[Index].Restart_CheckSpelling();
}
};
CDocument.prototype.Stop_CheckSpelling = function () {
this.Spelling.Reset();
};
CDocument.prototype.Continue_CheckSpelling = function () {
this.Spelling.Continue_CheckSpelling();
};
CDocument.prototype.TurnOff_CheckSpelling = function () {
this.Spelling.TurnOff();
};
CDocument.prototype.TurnOn_CheckSpelling = function () {
this.Spelling.TurnOn();
};
CDocumentContent.prototype.Restart_CheckSpelling = function () {
var Count = this.Content.length;
for (var Index = 0; Index < Count; Index++) {

View File

@@ -35,6 +35,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var documentId = undefined;
var documentUserId = undefined;
var documentUrl = "null";
var documentUrlChanges = null;
var documentTitle = "null";
var documentTitleWithoutExtention = "null";
var documentFormat = "null";
@@ -748,6 +749,9 @@ function () {
};
};
function asc_docs_api(name) {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["CreateEditorApi"]();
}
g_fontApplication.Init();
var CDocsCoApi = window["CDocsCoApi"];
var CSpellCheckApi = window["CSpellCheckApi"];
@@ -787,7 +791,8 @@ function asc_docs_api(name) {
this.isCoAuthoringEnable = true;
this.isCoMarksDraw = false;
this.isDocumentCanSave = false;
this.SpellCheckApi = new CSpellCheckApi();
this.VersionHistory = null;
this.SpellCheckApi = (window["AscDesktopEditor"] === undefined) ? new CSpellCheckApi() : new CSpellCheckApi_desktop();
this.isSpellCheckEnable = true;
this.chartTranslate = new asc_CChartTranslate();
this.isOnlyReaderMode = false;
@@ -944,6 +949,9 @@ asc_docs_api.prototype.SetUnchangedDocument = function () {
asc_docs_api.prototype.SetDocumentModified = function (bValue) {
this.isDocumentModify = bValue;
this.asc_fireCallback("asc_onDocumentModifiedChanged");
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["onDocumentModifiedChanged"](bValue);
}
};
asc_docs_api.prototype.isDocumentModified = function () {
if (!this.canSave) {
@@ -1112,6 +1120,9 @@ asc_docs_api.prototype.LoadDocument = function (c_DocInfo) {
this.User.asc_setUserName(this.DocInfo.get_UserName());
}
this.DocumentName = documentTitle;
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["SetDocumentName"](this.DocumentName);
}
var oThis = this;
if (this.DocInfo.get_OfflineApp() === true) {
this.OfflineAppDocumentStartLoad();
@@ -1120,19 +1131,21 @@ asc_docs_api.prototype.LoadDocument = function (c_DocInfo) {
}
if (documentId) {
var oOpenOptions = this.DocInfo.get_Options();
var rData = {
"c": "",
"id": documentId,
"userid": documentUserId,
"format": documentFormat,
"vkey": documentVKey,
"editorid": c_oEditorId.Word,
"url": documentUrl,
"title": documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts,
"viewmode": this.isViewMode
};
if (false && oOpenOptions && oOpenOptions["isEmpty"]) {
var rData = {
"c": "create",
"id": documentId,
"userid": documentUserId,
"format": documentFormat,
"vkey": documentVKey,
"editorid": c_oEditorId.Word,
"url": documentUrl,
"title": documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts,
"data": g_sEmpty_bin
};
rData["c"] = "create";
rData["data"] = g_sEmpty_bin;
sendCommand(oThis, function () {},
rData);
editor.OpenDocument2(g_sResourceServiceLocalUrl + documentId + "/", g_sEmpty_bin);
@@ -1143,18 +1156,8 @@ asc_docs_api.prototype.LoadDocument = function (c_DocInfo) {
}
}
} else {
rData["c"] = "open";
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
var rData = {
"id": documentId,
"userid": documentUserId,
"format": documentFormat,
"vkey": documentVKey,
"editorid": c_oEditorId.Word,
"c": "open",
"url": documentUrl,
"title": documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts
};
sendCommand(oThis, function () {},
rData);
}
@@ -1239,6 +1242,9 @@ asc_docs_api.prototype.ContentToHTML = function (bIsRet) {
asc_docs_api.prototype.InitEditor = function () {
this.WordControl.m_oLogicDocument = new CDocument(this.WordControl.m_oDrawingDocument);
this.WordControl.m_oDrawingDocument.m_oLogicDocument = this.WordControl.m_oLogicDocument;
if (!this.isSpellCheckEnable) {
this.WordControl.m_oLogicDocument.TurnOff_CheckSpelling();
}
if (this.WordControl.MobileTouchManager) {
this.WordControl.MobileTouchManager.LogicDocument = this.WordControl.m_oLogicDocument;
}
@@ -1275,6 +1281,7 @@ asc_docs_api.prototype.OpenDocument = function (url, gObject) {
this.LoadedObject = null;
this.DocumentType = 1;
this.ServerIdWaitComplete = true;
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.Load(url, gObject);
this.FontLoader.LoadDocumentFonts(this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.Fonts, true);
};
@@ -1591,6 +1598,7 @@ asc_docs_api.prototype.asc_coAuthoringDisconnect = function () {
return;
}
this.CoAuthoringApi.disconnect();
this.isCoAuthoringEnable = false;
this.SetViewMode(true);
};
asc_docs_api.prototype._coSpellCheckInit = function () {
@@ -1600,21 +1608,33 @@ asc_docs_api.prototype._coSpellCheckInit = function () {
if (undefined !== window["g_cAscSpellCheckUrl"]) {
window.g_cAscSpellCheckUrl = window["g_cAscSpellCheckUrl"];
}
if (undefined !== window.g_cAscSpellCheckUrl) {
if (!this.isSpellCheckEnable) {
window.g_cAscSpellCheckUrl = "";
if (undefined === window["AscDesktopEditor"]) {
if (undefined !== window.g_cAscSpellCheckUrl) {
if (!this.isSpellCheckEnable) {
window.g_cAscSpellCheckUrl = "";
}
this.SpellCheckApi.set_url(window.g_cAscSpellCheckUrl);
}
this.SpellCheckApi.set_url(window.g_cAscSpellCheckUrl);
this.SpellCheckApi.onSpellCheck = function (e) {
var incomeObject = JSON.parse(e);
SpellCheck_CallBack(incomeObject);
};
}
this.SpellCheckApi.onSpellCheck = function (e) {
var incomeObject = JSON.parse(e);
SpellCheck_CallBack(incomeObject);
};
this.SpellCheckApi.init(documentId);
};
asc_docs_api.prototype.asc_getSpellCheckLanguages = function () {
return g_spellCheckLanguages;
};
asc_docs_api.prototype.asc_SpellCheckDisconnect = function () {
if (!this.SpellCheckApi) {
return;
}
this.SpellCheckApi.disconnect();
this.isSpellCheckEnable = false;
if (this.WordControl.m_oLogicDocument) {
this.WordControl.m_oLogicDocument.TurnOff_CheckSpelling();
}
};
asc_docs_api.prototype._onUpdateDocumentCanSave = function () {
var tmp = this.isDocumentModified() || (0 >= CollaborativeEditing.m_nUseType && 0 !== CollaborativeEditing.getOwnLocksLength());
if (tmp !== this.isDocumentCanSave) {
@@ -2496,6 +2516,16 @@ asc_docs_api.prototype.UpdateParagraphProp = function (ParaPr) {
this.sync_PrPropCallback(ParaPr);
};
asc_docs_api.prototype.asc_Print = function () {
if (window["AscDesktopEditor"]) {
if (null != this.WordControl.m_oDrawingDocument.m_oDocumentRenderer) {
if (window["AscDesktopEditor"]["IsSupportNativePrint"](this.DocumentUrl) === true) {
return;
}
} else {
window["AscDesktopEditor"]["Print"]();
return;
}
}
if (undefined != window["qtDocBridge"]) {
this.async_SaveToPdf();
} else {
@@ -2534,15 +2564,42 @@ asc_docs_api.prototype.Redo = function () {
this.WordControl.m_oLogicDocument.Document_Redo();
};
asc_docs_api.prototype.Copy = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 67;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
return Editor_Copy_Button(this);
};
asc_docs_api.prototype.Update_ParaTab = function (Default_Tab, ParaTabs) {
this.WordControl.m_oDrawingDocument.Update_ParaTab(Default_Tab, ParaTabs);
};
asc_docs_api.prototype.Cut = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 88;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
return Editor_Copy_Button(this, true);
};
asc_docs_api.prototype.Paste = function () {
if (window["AscDesktopEditor"]) {
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 86;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content)) {
if (!window.GlobalPasteFlag) {
if (!window.USER_AGENT_SAFARI_MACOS) {
@@ -2561,7 +2618,7 @@ asc_docs_api.prototype.Paste = function () {
asc_docs_api.prototype.Share = function () {};
function OnSave_Callback(e) {
if (false == e["saveLock"]) {
if (false !== editor.waitSave) {
if (editor.waitSave || editor.asc_IsLongAction()) {
editor.CoAuthoringApi.onUnSaveLock = function () {
editor.canSave = true;
};
@@ -2579,6 +2636,9 @@ function OnSave_Callback(e) {
editor.canSave = true;
editor.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
editor._onUpdateDocumentCanSave();
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"]();
}
};
CollaborativeEditing.Send_Changes();
} else {
@@ -2594,7 +2654,7 @@ function OnSave_Callback(e) {
}
}
asc_docs_api.prototype.asc_Save = function () {
if (false === this.waitSave && true === this.canSave) {
if (false === this.waitSave && true === this.canSave && !this.asc_IsLongAction()) {
this.canSave = false;
this.CoAuthoringApi.askSaveChanges(OnSave_Callback);
}
@@ -2794,6 +2854,9 @@ asc_docs_api.prototype.sync_EndAction = function (type, id) {
this.asc_fireCallback("asc_onEndAction", type, id);
if (c_oAscAsyncActionType.BlockInteraction == type) {
this.IsLongActionCurrent--;
if (this.IsLongActionCurrent < 0) {
this.IsLongActionCurrent = 0;
}
if (!this.asc_IsLongAction()) {
var _length = this.LongActionCallbacks.length;
for (var i = 0; i < _length; i++) {
@@ -5154,6 +5217,12 @@ asc_docs_api.prototype.asc_setDefaultLanguage = function (Lang) {
asc_docs_api.prototype.asc_getDefaultLanguage = function () {
return editor.WordControl.m_oLogicDocument.Get_DefaultLanguage();
};
asc_docs_api.prototype.asc_getKeyboardLanguage = function () {
if (undefined !== window["asc_current_keyboard_layout"]) {
return window["asc_current_keyboard_layout"];
}
return -1;
};
asc_docs_api.prototype.asc_setSpellCheck = function (isOn) {
if (editor.WordControl.m_oLogicDocument) {
editor.WordControl.m_oLogicDocument.Spelling.Use = isOn;
@@ -5245,24 +5314,7 @@ asc_docs_api.prototype.asc_hideComments = function () {
this.WordControl.m_oLogicDocument.Hide_Comments();
editor.sync_HideComment();
};
asc_docs_api.prototype.asc_addComment = function (AscCommentData) {
if (true === CollaborativeEditing.Get_GlobalLock()) {
return;
}
if (null == this.WordControl.m_oLogicDocument) {
return;
}
if (true !== this.can_AddQuotedComment() || false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content)) {
var CommentData = new CCommentData();
CommentData.Read_FromAscCommentData(AscCommentData);
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddComment);
var Comment = this.WordControl.m_oLogicDocument.Add_Comment(CommentData);
if (null != Comment) {
this.sync_AddComment(Comment.Get_Id(), CommentData);
}
return Comment.Get_Id();
}
};
asc_docs_api.prototype.asc_addComment = function (AscCommentData) {};
asc_docs_api.prototype.asc_removeComment = function (Id) {
if (null == this.WordControl.m_oLogicDocument) {
return;
@@ -5679,6 +5731,18 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function () {
}
return;
}
if (this.EndActionLoadImages == 1) {
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadDocumentImages);
} else {
if (this.EndActionLoadImages == 2) {
if (_bIsOldPaste) {
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
} else {
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
}
}
}
this.EndActionLoadImages = 0;
if (false === this.isPasteFonts_Images && false === this.isSaveFonts_Images && false === this.isLoadImagesCustom) {
this.ServerImagesWaitComplete = true;
if (true == this.ServerIdWaitComplete) {
@@ -5713,18 +5777,6 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function () {
}
}
}
if (this.EndActionLoadImages == 1) {
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadDocumentImages);
} else {
if (this.EndActionLoadImages == 2) {
if (_bIsOldPaste) {
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
} else {
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
}
}
}
this.EndActionLoadImages = 0;
};
asc_docs_api.prototype.OpenDocumentEndCallback = function () {
if (null == this.WordControl.m_oLogicDocument) {
@@ -6160,6 +6212,7 @@ asc_docs_api.prototype.add_SectionBreak = function (_Type) {
};
asc_docs_api.prototype.SetViewMode = function (isViewMode) {
if (isViewMode) {
this.asc_SpellCheckDisconnect();
this.isViewMode = true;
this.ShowParaMarks = false;
CollaborativeEditing.m_bGlobalLock = true;
@@ -6285,6 +6338,11 @@ function spellCheck(editor, rdata) {
break;
}
}
window["asc_nativeOnSpellCheck"] = function (response) {
if (editor.SpellCheckApi) {
editor.SpellCheckApi.onSpellCheck(response);
}
};
function _onSpellCheck_Callback2(response) {
var incomeObject = JSON.parse(response);
SpellCheck_CallBack(incomeObject);
@@ -6428,38 +6486,25 @@ function sendTrack(fCallback, url, rdata) {
});
}
function _onOpenCommand(fCallback, incomeObject) {
var sJsonUrl = g_sResourceServiceLocalUrl + incomeObject["data"];
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;
}
var bIsViewer = false;
if (result.length > 0) {
if (c_oSerFormat.Signature != result.substring(0, c_oSerFormat.Signature.length)) {
bIsViewer = true;
}
}
if (true == bIsViewer) {
editor.OpenDocument(url, result);
} else {
editor.OpenDocument2(url, result);
}
if (fCallback) {
fCallback(incomeObject);
}
},
error: function () {
g_fOpenFileCommand(incomeObject["data"], documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
if (error) {
editor.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
if (fCallback) {
fCallback();
}
return;
}
if (result.changes && editor.VersionHistory) {
editor.VersionHistory.changes = result.changes;
editor.VersionHistory.applyChanges(editor);
}
if (result.bSerFormat) {
editor.OpenDocument2(result.url, result.data);
} else {
editor.OpenDocument(result.url, result.data);
}
if (fCallback) {
fCallback();
}
});
}
@@ -6581,94 +6626,6 @@ function _mapAscServerErrorToAscError(nServerError) {
}
return nRes;
}
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);
}
function CErrorData() {
this.Value = 0;
}
@@ -6732,6 +6689,48 @@ asc_docs_api.prototype.asc_AddMath2 = function (Type) {
this.WordControl.m_oLogicDocument.Paragraph_Add(MathElement);
}
};
asc_docs_api.prototype.asc_showRevision = function (newObj) {
if (!newObj.docId) {
return;
}
if (this.isCoAuthoringEnable) {
this.asc_coAuthoringDisconnect();
}
var bUpdate = true;
if (null === this.VersionHistory) {
this.VersionHistory = new window["Asc"].asc_CVersionHistory(newObj);
} else {
bUpdate = this.VersionHistory.update(newObj);
}
if (bUpdate) {
this.asc_CloseFile();
this.DocInfo.put_Id(this.VersionHistory.docId);
this.DocInfo.put_Url(this.VersionHistory.url);
documentUrlChanges = this.VersionHistory.urlChanges;
this.LoadDocument();
} else {
if (this.VersionHistory.currentChangeId < newObj.currentChangeId) {
CollaborativeEditing.Clear_CollaborativeMarks();
editor.VersionHistory.applyChanges(editor);
CollaborativeEditing.Apply_Changes();
}
}
};
asc_docs_api.prototype.asc_undoAllChanges = function () {
this.WordControl.m_oLogicDocument.Document_Undo({
All: true
});
};
asc_docs_api.prototype.asc_CloseFile = function () {
History.Clear();
g_oIdCounter.Clear();
g_oTableId.Clear();
this.isApplyChangesOnOpenEnabled = true;
var oLogicDocument = this.WordControl.m_oLogicDocument;
oLogicDocument.Stop_Recalculate();
oLogicDocument.Stop_CheckSpelling();
window.global_pptx_content_loader.ImageMapChecker = {};
};
window["asc_docs_api"] = asc_docs_api;
window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function (base64File, version) {
this.DocumentUrl = "TeamlabNative";
@@ -6908,6 +6907,29 @@ window["asc_docs_api"].prototype["asc_nativeCheckPdfRenderer"] = function (_memo
};
window["asc_docs_api"].prototype["asc_nativeCalculate"] = function () {};
window["asc_docs_api"].prototype["asc_nativePrint"] = function (_printer, _page) {
if (undefined === _printer && _page === undefined) {
if (undefined !== window["AscDesktopEditor"]) {
var _drawing_document = this.WordControl.m_oDrawingDocument;
var pagescount = Math.min(_drawing_document.m_lPagesCount, _drawing_document.m_lCountCalculatePages);
window["AscDesktopEditor"]["Print_Start"](this.DocumentUrl, pagescount, "", this.getCurrentPage());
var oDocRenderer = new CDocumentRenderer();
oDocRenderer.VectorMemoryForPrint = new CMemory();
var bOldShowMarks = this.ShowParaMarks;
this.ShowParaMarks = false;
for (var i = 0; i < pagescount; i++) {
oDocRenderer.Memory.Seek(0);
oDocRenderer.VectorMemoryForPrint.ClearNoAttack();
var page = _drawing_document.m_arrPages[i];
oDocRenderer.BeginPage(page.width_mm, page.height_mm);
this.WordControl.m_oLogicDocument.DrawPage(i, oDocRenderer);
oDocRenderer.EndPage();
window["AscDesktopEditor"]["Print_Page"](oDocRenderer.Memory.GetBase64Memory(), page.width_mm, page.height_mm);
}
this.ShowParaMarks = bOldShowMarks;
window["AscDesktopEditor"]["Print_End"]();
}
return;
}
var page = this.WordControl.m_oDrawingDocument.m_arrPages[_page];
_printer.BeginPage(page.width_mm, page.height_mm);
this.WordControl.m_oLogicDocument.DrawPage(_page, _printer);
@@ -6915,4 +6937,33 @@ window["asc_docs_api"].prototype["asc_nativePrint"] = function (_printer, _page)
};
window["asc_docs_api"].prototype["asc_nativePrintPagesCount"] = function () {
return this.WordControl.m_oDrawingDocument.m_lPagesCount;
};
window["asc_docs_api"].prototype["asc_nativeGetPDF"] = function () {
var pagescount = this["asc_nativePrintPagesCount"]();
var _renderer = new CDocumentRenderer();
_renderer.VectorMemoryForPrint = new CMemory();
var _bOldShowMarks = this.ShowParaMarks;
this.ShowParaMarks = false;
for (var i = 0; i < pagescount; i++) {
this["asc_nativePrint"](_renderer, i);
}
this.ShowParaMarks = _bOldShowMarks;
window["native"]["Save_End"]("", _renderer.Memory.GetCurPosition());
return _renderer.Memory.data;
};
function CSpellCheckApi_desktop() {
this.docId = undefined;
this.init = function (docid) {
this.docId = docid;
};
this.set_url = function (url) {};
this.spellCheck = function (spellData) {
window["AscDesktopEditor"]["SpellCheck"](spellData);
};
this.onSpellCheck = function (spellData) {
SpellCheck_CallBack(spellData);
};
}
window["AscDesktopEditor_Save"] = function () {
return editor.asc_Save();
};

View File

@@ -463,7 +463,7 @@ function CorrectUniFill(asc_fill, unifill) {
_url = g_oUserTexturePresets[_tx_id];
}
if (_url != null && _url !== undefined && _url != "") {
ret.fill.RasterImageId = _url;
ret.fill.setRasterImageId(_url);
}
if (ret.fill.RasterImageId == null) {
ret.fill.RasterImageId = "";