Commit 57109cc4 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

реализация spreadsheet_api.asc_nativeApplyChanges2

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59504 954022d7-b5bf-4e40-9824-e11837661b57
parent ee7a286a
...@@ -88,6 +88,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -88,6 +88,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.DocumentLoadComplete = false; this.DocumentLoadComplete = false;
// Переменная, которая отвечает, послали ли мы окончание открытия документа // Переменная, которая отвечает, послали ли мы окончание открытия документа
this.IsSendDocumentLoadCompleate = false; this.IsSendDocumentLoadCompleate = false;
//текущий обьект куда записываются информация для update, когда принимаются изменения в native редакторе
this.oRedoObjectParamNative = null;
// CoAuthoring and Chat // CoAuthoring and Chat
this.User = undefined; this.User = undefined;
...@@ -3452,7 +3454,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3452,7 +3454,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
spreadsheet_api.prototype.asc_nativeApplyChanges2 = function(data, isFull) spreadsheet_api.prototype.asc_nativeApplyChanges2 = function(data, isFull)
{ {
// TODO: if(null != this.wbModel)
this.oRedoObjectParamNative = this.wbModel.DeserializeHistoryNative(this.oRedoObjectParamNative, data, isFull);
if(isFull)
this._onUpdateAfterApplyChanges();
}; };
spreadsheet_api.prototype.asc_nativeGetFile = function() spreadsheet_api.prototype.asc_nativeGetFile = function()
......
...@@ -1942,6 +1942,72 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){ ...@@ -1942,6 +1942,72 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
}); });
} }
}; };
Workbook.prototype.DeserializeHistoryNative = function(oRedoObjectParam, data, isFull){
if(null != data)
{
this.bCollaborativeChanges = true;
if(null == oRedoObjectParam)
{
var wsViews = window["Asc"]["editor"].wb.wsViews;
for(var i in wsViews)
{
if(isRealObject(wsViews[i]) && isRealObject(wsViews[i].objectRender) && isRealObject(wsViews[i].objectRender.controller))
{
if ( wsViews[i].isChartAreaEditMode ) {
wsViews[i].isChartAreaEditMode = false;
wsViews[i].arrActiveChartsRanges = [];
}
wsViews[i].objectRender.controller.resetSelection();
}
}
History.Clear();
History.Create_NewPoint();
History.SetSelection(null);
History.SetSelectionRedo(null);
oRedoObjectParam = new Asc.RedoObjectParam();
History.UndoRedoPrepare(oRedoObjectParam, false);
}
var stream = new FT_Stream2(data, data.length);
stream.obj = null;
// Применяем изменения, пока они есть
var _count = stream.GetLong();
var _pos = 4;
for (var i = 0; i < _count; i++)
{
if (window["NATIVE_EDITOR_ENJINE"] === true && window["native"]["CheckNextChange"])
{
if (!window["native"]["CheckNextChange"]())
break;
}
var _len = Loader.Reader.GetLong();
_pos += 4;
stream.size = _pos + _len;
stream.Seek2(_pos);
var item = new UndoRedoItemSerializable();
item.Deserialize(stream);
if ((null != item.oClass || (item.oData && typeof item.oData.sChangedObjectId === "string")) && null != item.nActionType) {
History.RedoAdd(oRedoObjectParam, item.oClass, item.nActionType, item.nSheetId, item.oRange, item.oData);
_pos += _len;
stream.Seek2(_pos);
stream.size = data.length;
}
if(isFull){
History.UndoRedoEnd(null, oRedoObjectParam, false);
History.Clear();
oRedoObjectParam = null;
}
this.bCollaborativeChanges = false;
}
return oRedoObjectParam;
}
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
/** /**
* @constructor * @constructor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment