Commit dfa158b5 authored by Ilya Kirillov's avatar Ilya Kirillov

Changes for classes Numbering, Comments and DocumentContent were replaced with a new classes.

parent 02502cb3
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
"../word/Editor/CollaborativeEditing.js", "../word/Editor/CollaborativeEditing.js",
"../word/Editor/Comments.js", "../word/Editor/Comments.js",
"../word/Editor/CommentsChanges.js",
"../word/Editor/History.js", "../word/Editor/History.js",
"../word/Editor/Styles.js", "../word/Editor/Styles.js",
"../word/Editor/FlowObjects.js", "../word/Editor/FlowObjects.js",
...@@ -98,11 +99,13 @@ ...@@ -98,11 +99,13 @@
"../word/Editor/Paragraph_Recalculate.js", "../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js", "../word/Editor/Sections.js",
"../word/Editor/Numbering.js", "../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js", "../word/Editor/HeaderFooter.js",
"../word/Editor/DocumentContentBase.js", "../word/Editor/DocumentContentBase.js",
"../word/Editor/Document.js", "../word/Editor/Document.js",
"../word/Editor/DocumentChanges.js", "../word/Editor/DocumentChanges.js",
"../word/Editor/DocumentContent.js", "../word/Editor/DocumentContent.js",
"../word/Editor/DocumentContentChanges.js",
"../word/Editor/DocumentControllerBase.js", "../word/Editor/DocumentControllerBase.js",
"../word/Editor/LogicDocumentController.js", "../word/Editor/LogicDocumentController.js",
"../word/Editor/DrawingsController.js", "../word/Editor/DrawingsController.js",
......
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
"../cell/model/DrawingObjects/Format/ChartSpacePrototype.js", "../cell/model/DrawingObjects/Format/ChartSpacePrototype.js",
"../word/Editor/Comments.js", "../word/Editor/Comments.js",
"../word/Editor/CommentsChanges.js",
"../word/Editor/Styles.js", "../word/Editor/Styles.js",
"../word/Editor/FlowObjects.js", "../word/Editor/FlowObjects.js",
"../word/Editor/ParagraphContent.js", "../word/Editor/ParagraphContent.js",
...@@ -147,11 +148,13 @@ ...@@ -147,11 +148,13 @@
"../word/Editor/Paragraph_Recalculate.js", "../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js", "../word/Editor/Sections.js",
"../word/Editor/Numbering.js", "../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js", "../word/Editor/HeaderFooter.js",
"../word/Editor/DocumentContentBase.js", "../word/Editor/DocumentContentBase.js",
"../word/Editor/Document.js", "../word/Editor/Document.js",
"../word/Editor/DocumentChanges.js", "../word/Editor/DocumentChanges.js",
"../word/Editor/DocumentContent.js", "../word/Editor/DocumentContent.js",
"../word/Editor/DocumentContentChanges.js",
"../word/Editor/DocumentControllerBase.js", "../word/Editor/DocumentControllerBase.js",
"../word/Editor/LogicDocumentController.js", "../word/Editor/LogicDocumentController.js",
"../word/Editor/DrawingsController.js", "../word/Editor/DrawingsController.js",
......
...@@ -126,6 +126,7 @@ ...@@ -126,6 +126,7 @@
"../slide/Editor/Format/Comments.js", "../slide/Editor/Format/Comments.js",
"../word/Editor/Styles.js", "../word/Editor/Styles.js",
"../word/Editor/Numbering.js", "../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/ParagraphContent.js", "../word/Editor/ParagraphContent.js",
"../word/Editor/ParagraphContentBase.js", "../word/Editor/ParagraphContentBase.js",
"../word/Editor/Paragraph/ParaTextPr.js", "../word/Editor/Paragraph/ParaTextPr.js",
...@@ -157,6 +158,7 @@ ...@@ -157,6 +158,7 @@
"../word/Editor/Document.js", "../word/Editor/Document.js",
"../word/Editor/DocumentChanges.js", "../word/Editor/DocumentChanges.js",
"../word/Editor/DocumentContent.js", "../word/Editor/DocumentContent.js",
"../word/Editor/DocumentContentChanges.js",
"../word/Editor/DocumentControllerBase.js", "../word/Editor/DocumentControllerBase.js",
"../word/Editor/LogicDocumentController.js", "../word/Editor/LogicDocumentController.js",
"../word/Editor/DrawingsController.js", "../word/Editor/DrawingsController.js",
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
"../word/Editor/GraphicObjects/GraphicPage.js", "../word/Editor/GraphicObjects/GraphicPage.js",
"../word/Editor/GraphicObjects/WrapManager.js", "../word/Editor/GraphicObjects/WrapManager.js",
"../word/Editor/Comments.js", "../word/Editor/Comments.js",
"../word/Editor/CommentsChanges.js",
"../word/Editor/Styles.js", "../word/Editor/Styles.js",
"../word/Editor/FlowObjects.js", "../word/Editor/FlowObjects.js",
"../word/Editor/ParagraphContent.js", "../word/Editor/ParagraphContent.js",
...@@ -120,11 +121,13 @@ ...@@ -120,11 +121,13 @@
"../word/Editor/Paragraph_Recalculate.js", "../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js", "../word/Editor/Sections.js",
"../word/Editor/Numbering.js", "../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js", "../word/Editor/HeaderFooter.js",
"../word/Editor/DocumentContentBase.js", "../word/Editor/DocumentContentBase.js",
"../word/Editor/Document.js", "../word/Editor/Document.js",
"../word/Editor/DocumentChanges.js", "../word/Editor/DocumentChanges.js",
"../word/Editor/DocumentContent.js", "../word/Editor/DocumentContent.js",
"../word/Editor/DocumentContentChanges.js",
"../word/Editor/DocumentControllerBase.js", "../word/Editor/DocumentControllerBase.js",
"../word/Editor/LogicDocumentController.js", "../word/Editor/LogicDocumentController.js",
"../word/Editor/DrawingsController.js", "../word/Editor/DrawingsController.js",
......
...@@ -1420,10 +1420,6 @@ ...@@ -1420,10 +1420,6 @@
window['AscDFH'].historyitem_Comments_Add = window['AscDFH'].historyitem_type_Comments | 1; window['AscDFH'].historyitem_Comments_Add = window['AscDFH'].historyitem_type_Comments | 1;
window['AscDFH'].historyitem_Comments_Remove = window['AscDFH'].historyitem_type_Comments | 2; window['AscDFH'].historyitem_Comments_Remove = window['AscDFH'].historyitem_type_Comments | 2;
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CGraphicObjects
//------------------------------------------------------------------------------------------------------------------
window['AscDFH'].historyitem_ChangeColorScheme = window['AscDFH'].historyitem_type_GrObjects | 1;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе ParaHyperlink // Типы изменений в классе ParaHyperlink
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
window['AscDFH'].historyitem_Hyperlink_Value = window['AscDFH'].historyitem_type_Hyperlink | 1; window['AscDFH'].historyitem_Hyperlink_Value = window['AscDFH'].historyitem_type_Hyperlink | 1;
...@@ -1629,6 +1625,10 @@ ...@@ -1629,6 +1625,10 @@
window['AscDFH'].historyitem_Footnotes_SetFootnotePrNumRestart = window['AscDFH'].historyitem_type_Footnotes | 7; window['AscDFH'].historyitem_Footnotes_SetFootnotePrNumRestart = window['AscDFH'].historyitem_type_Footnotes | 7;
window['AscDFH'].historyitem_Footnotes_SetFootnotePrNumFormat = window['AscDFH'].historyitem_type_Footnotes | 8; window['AscDFH'].historyitem_Footnotes_SetFootnotePrNumFormat = window['AscDFH'].historyitem_type_Footnotes | 8;
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CGraphicObjects
//------------------------------------------------------------------------------------------------------------------
window['AscDFH'].historyitem_ChangeColorScheme = window['AscDFH'].historyitem_type_GrObjects | 1;
//------------------------------------------------------------------------------------------------------------------
// Графические классы общего назначение (без привязки к конкретному классу) // Графические классы общего назначение (без привязки к конкретному классу)
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
window['AscDFH'].historyitem_AutoShapes_SetDrawingBaseCoors = window['AscDFH'].historyitem_type_CommonShape | 101; window['AscDFH'].historyitem_AutoShapes_SetDrawingBaseCoors = window['AscDFH'].historyitem_type_CommonShape | 101;
......
...@@ -280,7 +280,7 @@ function CComment(Parent, Data) ...@@ -280,7 +280,7 @@ function CComment(Parent, Data)
this.Set_Data = function(Data) this.Set_Data = function(Data)
{ {
History.Add( this, { Type : AscDFH.historyitem_Comment_Change, New : Data, Old : this.Data } ); History.Add(new CChangesCommentChange(this, this.Data, Data));
this.Data = Data; this.Data = Data;
}; };
...@@ -331,48 +331,6 @@ function CComment(Parent, Data) ...@@ -331,48 +331,6 @@ function CComment(Parent, Data)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Undo/Redo функции // Undo/Redo функции
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
this.Undo = function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_Comment_Change:
{
this.Data = Data.Old;
editor.sync_ChangeCommentData( this.Id, this.Data );
break;
}
case AscDFH.historyitem_Comment_TypeInfo:
{
this.m_oTypeInfo = Data.Old;
break;
}
}
};
this.Redo = function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_Comment_Change:
{
this.Data = Data.New;
editor.sync_ChangeCommentData( this.Id, this.Data );
break;
}
case AscDFH.historyitem_Comment_TypeInfo:
{
this.m_oTypeInfo = Data.New;
break;
}
}
};
this.Refresh_RecalcData = function(Data) this.Refresh_RecalcData = function(Data)
{ {
// Ничего не делаем (если что просто будет перерисовка) // Ничего не делаем (если что просто будет перерисовка)
...@@ -380,94 +338,6 @@ function CComment(Parent, Data) ...@@ -380,94 +338,6 @@ function CComment(Parent, Data)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Функции для работы с совместным редактированием // Функции для работы с совместным редактированием
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
this.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_Comment );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_Comment_Change:
{
// Variable : Data
Data.New.Write_ToBinary2( Writer );
break;
}
case AscDFH.historyitem_Comment_TypeInfo:
{
// Long : тип
// Если comment_type_HdrFtr
// String : Id колонтитула
var Type = Data.New.Type;
Writer.WriteLong( Type );
if ( comment_type_HdrFtr === Type )
{
var HdrFtr = Data.New.Data;
Writer.WriteString2( HdrFtr.Get_Id() );
}
break;
}
}
return Writer;
};
this.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_Comment != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case AscDFH.historyitem_Comment_Change:
{
// Variable : Data
this.Data.Read_FromBinary2( Reader );
editor.sync_ChangeCommentData( this.Id, this.Data );
break;
}
case AscDFH.historyitem_Comment_TypeInfo:
{
// Long : тип
// Если comment_type_HdrFtr
// String : Id колонтитула
this.m_oTypeInfo.Type = Reader.GetLong()
if ( comment_type_HdrFtr === this.m_oTypeInfo.Type )
{
var HdrFtrId = Reader.GetString2();
this.m_oTypeInfo.Data = g_oTableId.Get_ById( HdrFtrId );
}
break;
}
}
return true;
};
this.Get_Id = function() this.Get_Id = function()
{ {
return this.Id; return this.Id;
...@@ -587,7 +457,7 @@ function CComments() ...@@ -587,7 +457,7 @@ function CComments()
{ {
var Id = Comment.Get_Id(); var Id = Comment.Get_Id();
History.Add( this, { Type : AscDFH.historyitem_Comments_Add, Id : Id, Comment : Comment } ); History.Add(new CChangesCommentsAdd(this, Id, Comment));
this.m_aComments[Id] = Comment; this.m_aComments[Id] = Comment;
}; };
...@@ -603,7 +473,7 @@ function CComments() ...@@ -603,7 +473,7 @@ function CComments()
{ {
if ( "undefined" != typeof(this.m_aComments[Id]) ) if ( "undefined" != typeof(this.m_aComments[Id]) )
{ {
History.Add( this, { Type : AscDFH.historyitem_Comments_Remove, Id : Id, Comment : this.m_aComments[Id] } ); History.Add(new CChangesCommentsRemove(this, Id, this.m_aComments[Id]));
// Сначала удаляем комментарий из списка комментариев, чтобы данная функция не зацикливалась на вызове Remove_Marks // Сначала удаляем комментарий из списка комментариев, чтобы данная функция не зацикливалась на вызове Remove_Marks
var Comment = this.m_aComments[Id]; var Comment = this.m_aComments[Id];
...@@ -695,135 +565,10 @@ function CComments() ...@@ -695,135 +565,10 @@ function CComments()
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Undo/Redo функции // Undo/Redo функции
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
this.Undo = function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_Comments_Add:
{
delete this.m_aComments[Data.Id];
editor.sync_RemoveComment( Data.Id );
break;
}
case AscDFH.historyitem_Comments_Remove:
{
this.m_aComments[Data.Id] = Data.Comment;
editor.sync_AddComment( Data.Id, Data.Comment.Data );
break;
}
}
};
this.Redo = function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_Comments_Add:
{
this.m_aComments[Data.Id] = Data.Comment;
editor.sync_AddComment( Data.Id, Data.Comment.Data );
break;
}
case AscDFH.historyitem_Comments_Remove:
{
delete this.m_aComments[Data.Id];
editor.sync_RemoveComment( Data.Id );
break;
}
}
};
this.Refresh_RecalcData = function(Data) this.Refresh_RecalcData = function(Data)
{ {
// Ничего не делаем, т.к. изменение комментариев не влияет на пересчет // Ничего не делаем, т.к. изменение комментариев не влияет на пересчет
}; };
//-----------------------------------------------------------------------------------
// Функции для работы с совместным редактированием
//-----------------------------------------------------------------------------------
this.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_Comments );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_Comments_Add:
{
// String : Id комментария
Writer.WriteString2( Data.Id );
break;
}
case AscDFH.historyitem_Comments_Remove:
{
// String : Id комментария
Writer.WriteString2( Data.Id );
break;
}
}
return Writer;
};
this.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_Comments != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case AscDFH.historyitem_Comments_Add:
{
// String : Id комментария
var CommentId = Reader.GetString2();
var Comment = g_oTableId.Get_ById( CommentId );
this.m_aComments[CommentId] = Comment;
editor.sync_AddComment( CommentId, Comment.Data );
break;
}
case AscDFH.historyitem_Comments_Remove:
{
// String : Id комментария
var CommentId = Reader.GetString2();
delete this.m_aComments[CommentId];
editor.sync_RemoveComment( CommentId );
break;
}
}
return true;
};
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора) // Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
...@@ -865,7 +610,7 @@ ParaComment.prototype = ...@@ -865,7 +610,7 @@ ParaComment.prototype =
{ {
if (this.CommentId !== NewCommentId) if (this.CommentId !== NewCommentId)
{ {
History.Add(this, { Type : AscDFH.historyitem_ParaComment_CommentId, Old : this.CommentId, New : NewCommentId }); History.Add(new CChangesParaCommentCommentId(this, this.CommentId, NewCommentId));
this.CommentId = NewCommentId; this.CommentId = NewCommentId;
} }
}, },
...@@ -1315,90 +1060,6 @@ ParaComment.prototype = ...@@ -1315,90 +1060,6 @@ ParaComment.prototype =
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования // Функции совместного редактирования
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Undo : function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_ParaComment_CommentId:
{
this.CommentId = Data.Old;
break;
}
}
},
Redo : function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_ParaComment_CommentId:
{
this.CommentId = Data.New;
break;
}
}
},
Save_Changes : function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_ParaComment );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_ParaComment_CommentId:
{
// String : CommentId
Writer.WriteString2(Data.New);
break;
}
}
},
Load_Changes : function(Reader)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_ParaComment != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case AscDFH.historyitem_ParaComment_CommentId:
{
// String : CommentId
this.CommentId = Reader.GetString2();
var Comment = g_oTableId.Get_ById(this.CommentId);
if (null !== this.Paragraph && null !== Comment && Comment instanceof CComment)
{
if (true === this.Start)
Comment.Set_StartId(this.Paragraph.Get_Id());
else
Comment.Set_EndId(this.Paragraph.Get_Id());
}
break;
}
}
},
Refresh_RecalcData : function() Refresh_RecalcData : function()
{ {
}, },
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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";
/**
* User: Ilja.Kirillov
* Date: 08.11.2016
* Time: 15:59
*/
AscDFH.changesFactory[AscDFH.historyitem_Comment_Change] = CChangesCommentChange;
AscDFH.changesFactory[AscDFH.historyitem_Comment_TypeInfo] = CChangesCommentTypeInfo;
AscDFH.changesFactory[AscDFH.historyitem_Comments_Add] = CChangesCommentsAdd;
AscDFH.changesFactory[AscDFH.historyitem_Comments_Remove] = CChangesCommentsRemove;
AscDFH.changesFactory[AscDFH.historyitem_ParaComment_CommentId] = CChangesParaCommentCommentId;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesCommentChange(Class, Old, New)
{
CChangesCommentChange.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesCommentChange, AscDFH.CChangesBaseProperty);
CChangesCommentChange.prototype.Type = AscDFH.historyitem_Comment_Change;
CChangesCommentChange.prototype.WriteToBinary = function(Writer)
{
// Variable : New data
// Variable : Old data
this.New.Write_ToBinary2(Writer);
this.Old.Write_ToBinary2(Writer);
};
CChangesCommentChange.prototype.ReadFromBinary = function(Reader)
{
// Variable : New data
// Variable : Old data
this.New = new AscCommon.CCommentData();
this.Old = new AscCommon.CCommentData();
this.New.Read_FromBinary2(Reader);
this.Old.Read_FromBinary2(Reader);
};
CChangesCommentChange.prototype.private_SetValue = function(Value)
{
this.Class.Data = Value;
editor.sync_ChangeCommentData(this.Class.Id, Value);
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesCommentTypeInfo(Class, Old, New)
{
CChangesCommentTypeInfo.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesCommentTypeInfo, AscDFH.CChangesBaseProperty);
CChangesCommentTypeInfo.prototype.Type = AscDFH.historyitem_Comment_TypeInfo;
CChangesCommentTypeInfo.prototype.WriteToBinary = function(Writer)
{
// Variable : New data
// Variable : Old data
Writer.WriteLong(this.New.Type);
if (comment_type_HdrFtr === this.New.Type)
Writer.WriteString2(this.New.Data.Get_Id());
Writer.WriteLong(this.Old.Type);
if (comment_type_HdrFtr === this.Old.Type)
Writer.WriteString2(this.Old.Data.Get_Id());
};
CChangesCommentTypeInfo.prototype.ReadFromBinary = function(Reader)
{
// Variable : New data
// Variable : Old data
this.New = {
Type : 0,
Data : null
};
this.Old = {
Type : 0,
Data : null
};
this.New.Type = Reader.GetLong();
if (comment_type_HdrFtr === this.New.Type)
this.New.Data = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
this.Old.Type = Reader.GetLong();
if (comment_type_HdrFtr === this.Old.Type)
this.Old.Data = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesCommentTypeInfo.prototype.private_SetValue = function(Value)
{
this.Class.m_oTypeInfo = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesCommentsAdd(Class, Id, Comment)
{
CChangesCommentsAdd.superclass.constructor.call(this, Class);
this.Id = Id;
this.Comment = Comment;
}
AscCommon.extendClass(CChangesCommentsAdd, AscDFH.CChangesBase);
CChangesCommentsAdd.prototype.Type = AscDFH.historyitem_Comments_Add;
CChangesCommentsAdd.prototype.Undo = function()
{
var oComments = this.Class;
delete oComments.m_aComments[this.Id];
editor.sync_RemoveComment(this.Id);
};
CChangesCommentsAdd.prototype.Redo = function()
{
this.Class.m_aComments[this.Id] = this.Comment;
editor.sync_AddComment(this.Id, this.Comment.Data);
};
CChangesCommentsAdd.prototype.WriteToBinary = function(Writer)
{
// String : Id комментария
Writer.WriteString2(this.Id);
};
CChangesCommentsAdd.prototype.ReadFromBinary = function(Reader)
{
// String : Id комментария
this.Id = Reader.GetString2();
this.Comment = AscCommon.g_oTableId.Get_ById(this.Id);
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesCommentsRemove(Class, Id, Comment)
{
CChangesCommentsRemove.superclass.constructor.call(this, Class);
this.Id = Id;
this.Comment = Comment;
}
AscCommon.extendClass(CChangesCommentsRemove, AscDFH.CChangesBase);
CChangesCommentsRemove.prototype.Type = AscDFH.historyitem_Comments_Remove;
CChangesCommentsRemove.prototype.Undo = function()
{
this.Class.m_aComments[this.Id] = this.Comment;
editor.sync_AddComment(this.Id, this.Comment.Data);
};
CChangesCommentsRemove.prototype.Redo = function()
{
delete this.Class.m_aComments[this.Id];
editor.sync_RemoveComment(this.Id);
};
CChangesCommentsRemove.prototype.WriteToBinary = function(Writer)
{
// String : Id комментария
Writer.WriteString2(this.Id);
};
CChangesCommentsRemove.prototype.ReadFromBinary = function(Reader)
{
// String : Id комментария
this.Id = Reader.GetString2();
this.Comment = AscCommon.g_oTableId.Get_ById(this.Id);
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesParaCommentCommentId(Class, Old, New)
{
CChangesParaCommentCommentId.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesParaCommentCommentId, AscDFH.CChangesBaseProperty);
CChangesParaCommentCommentId.prototype.Type = AscDFH.historyitem_ParaComment_CommentId;
CChangesParaCommentCommentId.prototype.WriteToBinary = function(Writer)
{
// String : New Id
// String : Old Id
Writer.WriteString2(this.New);
Writer.WriteString2(this.Old);
};
CChangesParaCommentCommentId.prototype.ReadFromBinary = function(Reader)
{
// String : New Id
// String : Old Id
this.New = Reader.GetString2();
this.Old = Reader.GetString2();
};
CChangesParaCommentCommentId.prototype.private_SetValue = function(Value)
{
this.Class.CommentId = Value;
};
CChangesParaCommentCommentId.prototype.Load = function()
{
this.Redo();
var Comment = AscCommon.g_oTableId.Get_ById(this.New);
if (null !== this.Class.Paragraph && null !== Comment && Comment instanceof CComment)
{
if (true === this.Class.Start)
Comment.Set_StartId(this.Class.Paragraph.Get_Id());
else
Comment.Set_EndId(this.Class.Paragraph.Get_Id());
}
};
\ No newline at end of file
...@@ -135,7 +135,7 @@ CChangesDocumentAddItem.prototype.ReadFromBinary = function(Reader) ...@@ -135,7 +135,7 @@ CChangesDocumentAddItem.prototype.ReadFromBinary = function(Reader)
this.UseArray = false; this.UseArray = false;
this.Pos = Reader.GetLong(); this.Pos = Reader.GetLong();
this.PosArray = [this.Pos]; this.PosArray = [this.Pos];
this.Item = g_oTableId.Get_ById(Reader.GetString2()); this.Item = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}; };
CChangesDocumentAddItem.prototype.Load = function(Color) CChangesDocumentAddItem.prototype.Load = function(Color)
{ {
...@@ -308,7 +308,7 @@ CChangesDocumentRemoveItem.prototype.ReadFromBinary = function(Reader) ...@@ -308,7 +308,7 @@ CChangesDocumentRemoveItem.prototype.ReadFromBinary = function(Reader)
for (var nIndex = 0; nIndex < nCount; ++nIndex) for (var nIndex = 0; nIndex < nCount; ++nIndex)
{ {
this.PosArray[nIndex] = Reader.GetLong(); this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = g_oTableId.Get_ById(Reader.GetString2()); this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
} }
}; };
CChangesDocumentRemoveItem.prototype.Load = function(Color) CChangesDocumentRemoveItem.prototype.Load = function(Color)
......
...@@ -8330,7 +8330,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb ...@@ -8330,7 +8330,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb
NextObj = null; NextObj = null;
this.private_RecalculateNumbering([NewObject]); this.private_RecalculateNumbering([NewObject]);
History.Add(this, {Type : AscDFH.historyitem_DocumentContent_AddItem, Pos : Position, Item : NewObject}); History.Add(new CChangesDocumentContentAddItem(this, Position, NewObject));
this.Content.splice(Position, 0, NewObject); this.Content.splice(Position, 0, NewObject);
NewObject.Set_Parent(this); NewObject.Set_Parent(this);
NewObject.Set_DocumentNext(NextObj); NewObject.Set_DocumentNext(NextObj);
...@@ -8368,11 +8368,7 @@ CDocumentContent.prototype.Internal_Content_Remove = function(Position, Count ...@@ -8368,11 +8368,7 @@ CDocumentContent.prototype.Internal_Content_Remove = function(Position, Count
for (var Index = 0; Index < Count; Index++) for (var Index = 0; Index < Count; Index++)
this.Content[Position + Index].PreDelete(); this.Content[Position + Index].PreDelete();
History.Add(this, { History.Add(new CChangesDocumentContentRemoveItem(this, Position, this.Content.slice(Position, Position + Count)));
Type : AscDFH.historyitem_DocumentContent_RemoveItem,
Pos : Position,
Items : this.Content.slice(Position, Position + Count)
});
var Elements = this.Content.splice(Position, Count); var Elements = this.Content.splice(Position, Count);
this.private_RecalculateNumbering(Elements); this.private_RecalculateNumbering(Elements);
...@@ -8406,11 +8402,7 @@ CDocumentContent.prototype.Internal_Content_RemoveAll = function() ...@@ -8406,11 +8402,7 @@ CDocumentContent.prototype.Internal_Content_RemoveAll = function()
for (var Index = 0; Index < Count; Index++) for (var Index = 0; Index < Count; Index++)
this.Content[Index].PreDelete(); this.Content[Index].PreDelete();
History.Add(this, { History.Add(new CChangesDocumentRemoveItem(this, 0, this.Content.slice(0, this.Content.length)));
Type : AscDFH.historyitem_DocumentContent_RemoveItem,
Pos : 0,
Items : this.Content.slice(0, this.Content.length)
});
this.Content = []; this.Content = [];
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -8473,58 +8465,6 @@ CDocumentContent.prototype.private_GetColumnIndex = function(CurPage) ...@@ -8473,58 +8465,6 @@ CDocumentContent.prototype.private_GetColumnIndex = function(CurPage)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Undo/Redo функции // Undo/Redo функции
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
CDocumentContent.prototype.Undo = function(Data)
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_DocumentContent_AddItem:
{
var Elements = this.Content.splice(Data.Pos, 1);
this.private_RecalculateNumbering(Elements);
break;
}
case AscDFH.historyitem_DocumentContent_RemoveItem:
{
var Pos = Data.Pos;
var Array_start = this.Content.slice(0, Pos);
var Array_end = this.Content.slice(Pos);
this.Content = Array_start.concat(Data.Items, Array_end);
this.private_RecalculateNumbering(Data.Items);
break;
}
}
};
CDocumentContent.prototype.Redo = function(Data)
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_DocumentContent_AddItem:
{
var Pos = Data.Pos;
this.Content.splice(Pos, 0, Data.Item);
this.private_RecalculateNumbering([Data.Item]);
break;
}
case AscDFH.historyitem_DocumentContent_RemoveItem:
{
var Elements = this.Content.splice(Data.Pos, Data.Items.length);
this.private_RecalculateNumbering(Elements);
break;
}
}
};
CDocumentContent.prototype.Get_SelectionState = function() CDocumentContent.prototype.Get_SelectionState = function()
{ {
var DocState = {}; var DocState = {};
...@@ -8825,184 +8765,6 @@ CDocumentContent.prototype.Hyperlink_Check = function(bCheckEnd) ...@@ -8825,184 +8765,6 @@ CDocumentContent.prototype.Hyperlink_Check = function(bCheckEnd)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования // Функции для работы с совместным редактирования
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
CDocumentContent.prototype.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong(AscDFH.historyitem_type_DocumentContent);
var Type = Data.Type;
// Пишем тип
Writer.WriteLong(Type);
switch (Type)
{
case AscDFH.historyitem_DocumentContent_AddItem:
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// String : Id элемента
// }
var bArray = Data.UseArray;
var Count = 1;
Writer.WriteLong(Count);
for (var Index = 0; Index < Count; Index++)
{
if (true === bArray)
Writer.WriteLong(Data.PosArray[Index]);
else
Writer.WriteLong(Data.Pos + Index);
Writer.WriteString2(Data.Item.Get_Id());
}
break;
}
case AscDFH.historyitem_DocumentContent_RemoveItem:
{
// Long : Количество удаляемых элементов
// Array of Long : позиции удаляемых элементов
var bArray = Data.UseArray;
var Count = Data.Items.length;
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var RealCount = Count;
for (var Index = 0; Index < Count; Index++)
{
if (true === bArray)
{
if (false === Data.PosArray[Index])
RealCount--;
else
Writer.WriteLong(Data.PosArray[Index]);
}
else
Writer.WriteLong(Data.Pos);
}
var EndPos = Writer.GetCurPosition();
Writer.Seek(StartPos);
Writer.WriteLong(RealCount);
Writer.Seek(EndPos);
break;
}
}
return Writer;
};
CDocumentContent.prototype.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if (AscDFH.historyitem_type_DocumentContent != ClassType)
return;
var Type = Reader.GetLong();
switch (Type)
{
case AscDFH.historyitem_DocumentContent_AddItem:
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// String : Id элемента
// }
var Count = Reader.GetLong();
for (var Index = 0; Index < Count; Index++)
{
var Pos = this.m_oContentChanges.Check(AscCommon.contentchanges_Add, Reader.GetLong());
var Element = g_oTableId.Get_ById(Reader.GetString2());
if (null != Element)
{
if (Pos > 0)
{
this.Content[Pos - 1].Next = Element;
Element.Prev = this.Content[Pos - 1];
}
if (Pos <= this.Content.length - 1)
{
this.Content[Pos].Prev = Element;
Element.Next = this.Content[Pos];
}
Element.Parent = this;
this.Content.splice(Pos, 0, Element);
this.private_RecalculateNumbering([Element]);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(this, Pos);
this.private_ReindexContent(Pos);
}
}
break;
}
case AscDFH.historyitem_DocumentContent_RemoveItem:
{
// Long : Количество удаляемых элементов
// Array of Long : позиции удаляемых элементов
var Count = Reader.GetLong();
for (var Index = 0; Index < Count; Index++)
{
var Pos = this.m_oContentChanges.Check(AscCommon.contentchanges_Remove, Reader.GetLong());
// действие совпало, не делаем его
if (false === Pos)
continue;
var Elements = this.Content.splice(Pos, 1);
this.private_RecalculateNumbering(Elements);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnRemove(this, Pos, 1);
this.private_ReindexContent(Pos);
if (Pos > 0)
{
if (Pos <= this.Content.length - 1)
{
this.Content[Pos - 1].Next = this.Content[Pos];
this.Content[Pos].Prev = this.Content[Pos - 1];
}
else
{
this.Content[Pos - 1].Next = null;
}
}
else if (Pos <= this.Content.length - 1)
{
this.Content[Pos].Prev = null;
}
}
break;
}
}
return true;
};
CDocumentContent.prototype.Write_ToBinary2 = function(Writer) CDocumentContent.prototype.Write_ToBinary2 = function(Writer)
{ {
Writer.WriteLong(AscDFH.historyitem_type_DocumentContent); Writer.WriteLong(AscDFH.historyitem_type_DocumentContent);
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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";
/**
* User: Ilja.Kirillov
* Date: 08.11.2016
* Time: 14:03
*/
AscDFH.changesFactory[AscDFH.historyitem_DocumentContent_AddItem] = CChangesDocumentContentAddItem;
AscDFH.changesFactory[AscDFH.historyitem_DocumentContent_RemoveItem] = CChangesDocumentContentRemoveItem;
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesDocumentContentAddItem(Class, Pos, Item)
{
CChangesDocumentContentAddItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Item = Item;
this.UseArray = false;
this.PosArray = [];
}
AscCommon.extendClass(CChangesDocumentContentAddItem, AscDFH.CChangesBase);
CChangesDocumentContentAddItem.prototype.Type = AscDFH.historyitem_DocumentContent_AddItem;
CChangesDocumentContentAddItem.prototype.Undo = function()
{
var oDocument = this.Class;
var Elements = oDocument.Content.splice(this.Pos, 1);
oDocument.private_RecalculateNumbering(Elements);
var Pos = this.Pos;
if (Pos > 0)
{
if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos - 1].Next = oDocument.Content[Pos];
oDocument.Content[Pos].Prev = oDocument.Content[Pos - 1];
}
else
{
oDocument.Content[Pos - 1].Next = null;
}
}
else if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos].Prev = null;
}
};
CChangesDocumentContentAddItem.prototype.Redo = function()
{
var oDocument = this.Class;
oDocument.Content.splice(this.Pos, 0, this.Item);
oDocument.private_RecalculateNumbering([this.Item]);
var Element = this.Item;
var Pos = this.Pos;
if (Pos > 0)
{
oDocument.Content[Pos - 1].Next = Element;
Element.Prev = oDocument.Content[Pos - 1];
}
else
{
Element.Prev = null;
}
if (Pos < oDocument.Content.length - 1)
{
oDocument.Content[Pos + 1].Prev = Element;
Element.Next = oDocument.Content[Pos + 1];
}
else
{
Element.Next = null;
}
Element.Parent = oDocument;
};
CChangesDocumentContentAddItem.prototype.WriteToBinary = function(Writer)
{
// Long : Pos
// String : Id элемента
if (true === this.UseArray)
Writer.WriteLong(this.PosArray[0]);
else
Writer.WriteLong(this.Pos);
Writer.WriteString2(this.Item.Get_Id());
};
CChangesDocumentContentAddItem.prototype.ReadFromBinary = function(Reader)
{
// Long : Pos
// String : Id элемента
this.UseArray = false;
this.Pos = Reader.GetLong();
this.PosArray = [this.Pos];
this.Item = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesDocumentContentAddItem.prototype.Load = function(Color)
{
var oDocument = this.Class;
var Pos = oDocument.m_oContentChanges.Check(AscCommon.contentchanges_Add, this.Pos);
var Element = this.Item;
Pos = Math.min(Pos, oDocument.Content.length);
if (null != Element)
{
if (Pos > 0)
{
oDocument.Content[Pos - 1].Next = Element;
Element.Prev = oDocument.Content[Pos - 1];
}
else
{
Element.Prev = null;
}
if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos].Prev = Element;
Element.Next = oDocument.Content[Pos];
}
else
{
Element.Next = null;
}
Element.Parent = oDocument;
oDocument.Content.splice(Pos, 0, Element);
oDocument.private_RecalculateNumbering([Element]);
oDocument.private_ReindexContent(Pos);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(oDocument, Pos);
}
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesDocumentContentRemoveItem(Class, Pos, Items)
{
CChangesDocumentContentRemoveItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
}
AscCommon.extendClass(CChangesDocumentContentRemoveItem, AscDFH.CChangesBase);
CChangesDocumentContentRemoveItem.prototype.Type = AscDFH.historyitem_DocumentContent_RemoveItem;
CChangesDocumentContentRemoveItem.prototype.Undo = function()
{
if (!this.Items || this.Items.length <= 0)
return;
var oDocument = this.Class;
var Array_start = oDocument.Content.slice(0, this.Pos);
var Array_end = oDocument.Content.slice(this.Pos);
oDocument.private_RecalculateNumbering(this.Items);
oDocument.Content = Array_start.concat(this.Items, Array_end);
var nStartIndex = Math.max(this.Pos - 1, 0);
var nEndIndex = Math.min(oDocument.Content.length - 1, this.Pos + this.Items.length + 1);
for (var nIndex = nStartIndex; nIndex <= nEndIndex; ++nIndex)
{
var oElement = oDocument.Content[nIndex];
if (nIndex > 0)
oElement.Prev = oDocument.Content[nIndex - 1];
else
oElement.Prev = null;
if (nIndex < oDocument.Content.length - 1)
oElement.Next = oDocument.Content[nIndex + 1];
else
oElement.Next = null;
oElement.Parent = oDocument;
}
};
CChangesDocumentContentRemoveItem.prototype.Redo = function()
{
if (!this.Items || this.Items.length <= 0)
return;
var oDocument = this.Class;
var Elements = oDocument.Content.splice(this.Pos, this.Items.length);
oDocument.private_RecalculateNumbering(Elements);
var Pos = this.Pos;
if (Pos > 0)
{
if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos - 1].Next = oDocument.Content[Pos];
oDocument.Content[Pos].Prev = oDocument.Content[Pos - 1];
}
else
{
oDocument.Content[Pos - 1].Next = null;
}
}
else if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos].Prev = null;
}
};
CChangesDocumentContentRemoveItem.prototype.WriteToBinary = function(Writer)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемого элемента
// }
var bArray = this.UseArray;
var Count = this.Items.length;
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var RealCount = Count;
for (var Index = 0; Index < Count; Index++)
{
if (true === bArray)
{
if (false === this.PosArray[Index])
{
RealCount--;
}
else
{
Writer.WriteLong(this.PosArray[Index]);
Writer.WriteString2(this.Items[Index]);
}
}
else
{
Writer.WriteLong(this.Pos);
Writer.WriteString2(this.Items[Index]);
}
}
var EndPos = Writer.GetCurPosition();
Writer.Seek(StartPos);
Writer.WriteLong(RealCount);
Writer.Seek(EndPos);
};
CChangesDocumentContentRemoveItem.prototype.ReadFromBinary = function(Reader)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемого элемента
// }
this.UseArray = true;
this.PosArray = [];
this.Items = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
};
CChangesDocumentContentRemoveItem.prototype.Load = function(Color)
{
var oDocument = this.Class;
for (var nIndex = 0, nCount = this.Items.length; nIndex < nCount; ++nIndex)
{
var Pos = oDocument.m_oContentChanges.Check(AscCommon.contentchanges_Remove, this.PosArray[nIndex]);
// действие совпало, не делаем его
if (false === Pos)
continue;
var Elements = oDocument.Content.splice(Pos, 1);
oDocument.private_RecalculateNumbering(Elements);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnRemove(oDocument, Pos, 1);
if (Pos > 0)
{
if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos - 1].Next = oDocument.Content[Pos];
oDocument.Content[Pos].Prev = oDocument.Content[Pos - 1];
}
else
{
oDocument.Content[Pos - 1].Next = null;
}
}
else if (Pos <= oDocument.Content.length - 1)
{
oDocument.Content[Pos].Prev = null;
}
oDocument.private_ReindexContent(Pos);
}
};
\ No newline at end of file
...@@ -306,8 +306,7 @@ CAbstractNum.prototype = ...@@ -306,8 +306,7 @@ CAbstractNum.prototype =
{ {
var Lvl_new = this.Internal_CopyLvl(AbstractNum.Lvl[Index]); var Lvl_new = this.Internal_CopyLvl(AbstractNum.Lvl[Index]);
var Lvl_old = this.Lvl[Index]; var Lvl_old = this.Lvl[Index];
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
this.Lvl[Index] = Lvl_new; this.Lvl[Index] = Lvl_new;
} }
}, },
...@@ -324,7 +323,7 @@ CAbstractNum.prototype = ...@@ -324,7 +323,7 @@ CAbstractNum.prototype =
this.Internal_SetLvl(Index, Lvl_new); this.Internal_SetLvl(Index, Lvl_new);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
var LogicDocument = editor.WordControl.m_oLogicDocument; var LogicDocument = editor.WordControl.m_oLogicDocument;
...@@ -366,7 +365,7 @@ CAbstractNum.prototype = ...@@ -366,7 +365,7 @@ CAbstractNum.prototype =
var Lvl_old = this.Lvl[iLvl]; var Lvl_old = this.Lvl[iLvl];
this.Lvl[iLvl] = Lvl_new; this.Lvl[iLvl] = Lvl_new;
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// Определяем многоуровненый список по умолчанию // Определяем многоуровненый список по умолчанию
...@@ -414,7 +413,7 @@ CAbstractNum.prototype = ...@@ -414,7 +413,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
}, },
...@@ -461,7 +460,7 @@ CAbstractNum.prototype = ...@@ -461,7 +460,7 @@ CAbstractNum.prototype =
Lvl.TextPr = TextPr; Lvl.TextPr = TextPr;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
}, },
...@@ -539,7 +538,7 @@ CAbstractNum.prototype = ...@@ -539,7 +538,7 @@ CAbstractNum.prototype =
Lvl.TextPr = TextPr; Lvl.TextPr = TextPr;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
}, },
...@@ -606,7 +605,7 @@ CAbstractNum.prototype = ...@@ -606,7 +605,7 @@ CAbstractNum.prototype =
Lvl.TextPr = TextPr; Lvl.TextPr = TextPr;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
}, },
...@@ -655,7 +654,7 @@ CAbstractNum.prototype = ...@@ -655,7 +654,7 @@ CAbstractNum.prototype =
Lvl.TextPr = TextPr; Lvl.TextPr = TextPr;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, Index));
} }
}, },
...@@ -671,7 +670,7 @@ CAbstractNum.prototype = ...@@ -671,7 +670,7 @@ CAbstractNum.prototype =
Lvl.LvlText = []; Lvl.LvlText = [];
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
Set_Lvl_Bullet : function(iLvl, LvlText, TextPr) Set_Lvl_Bullet : function(iLvl, LvlText, TextPr)
...@@ -689,7 +688,7 @@ CAbstractNum.prototype = ...@@ -689,7 +688,7 @@ CAbstractNum.prototype =
Lvl.TextPr = TextPr; Lvl.TextPr = TextPr;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// 1) right // 1) right
...@@ -710,7 +709,7 @@ CAbstractNum.prototype = ...@@ -710,7 +709,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// 1. right // 1. right
...@@ -731,7 +730,7 @@ CAbstractNum.prototype = ...@@ -731,7 +730,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// 1. left // 1. left
...@@ -752,7 +751,7 @@ CAbstractNum.prototype = ...@@ -752,7 +751,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// 1) left // 1) left
...@@ -773,7 +772,7 @@ CAbstractNum.prototype = ...@@ -773,7 +772,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// I. right // I. right
...@@ -794,7 +793,7 @@ CAbstractNum.prototype = ...@@ -794,7 +793,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// A. left // A. left
...@@ -815,7 +814,7 @@ CAbstractNum.prototype = ...@@ -815,7 +814,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// a) left // a) left
...@@ -836,7 +835,7 @@ CAbstractNum.prototype = ...@@ -836,7 +835,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// a. left // a. left
...@@ -857,7 +856,7 @@ CAbstractNum.prototype = ...@@ -857,7 +856,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// i. left // i. left
...@@ -878,7 +877,7 @@ CAbstractNum.prototype = ...@@ -878,7 +877,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
Set_Lvl_ByFormat : function(iLvl, nType, sFormatText, nAlign) Set_Lvl_ByFormat : function(iLvl, nType, sFormatText, nAlign)
...@@ -926,7 +925,7 @@ CAbstractNum.prototype = ...@@ -926,7 +925,7 @@ CAbstractNum.prototype =
Lvl.TextPr = new CTextPr(); Lvl.TextPr = new CTextPr();
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
Set_Lvl_Restart : function(iLvl, isRestart) Set_Lvl_Restart : function(iLvl, isRestart)
...@@ -938,7 +937,7 @@ CAbstractNum.prototype = ...@@ -938,7 +937,7 @@ CAbstractNum.prototype =
var Lvl_old = this.Internal_CopyLvl(Lvl); var Lvl_old = this.Internal_CopyLvl(Lvl);
Lvl.Restart = (isRestart ? -1 : 0); Lvl.Restart = (isRestart ? -1 : 0);
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
Set_Lvl_Start : function(iLvl, nStart) Set_Lvl_Start : function(iLvl, nStart)
...@@ -950,7 +949,7 @@ CAbstractNum.prototype = ...@@ -950,7 +949,7 @@ CAbstractNum.prototype =
var Lvl_old = this.Internal_CopyLvl(Lvl); var Lvl_old = this.Internal_CopyLvl(Lvl);
Lvl.Start = nStart; Lvl.Start = nStart;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
Set_Lvl_Suff : function(iLvl, nSuff) Set_Lvl_Suff : function(iLvl, nSuff)
...@@ -962,7 +961,7 @@ CAbstractNum.prototype = ...@@ -962,7 +961,7 @@ CAbstractNum.prototype =
var Lvl_old = this.Internal_CopyLvl(Lvl); var Lvl_old = this.Internal_CopyLvl(Lvl);
Lvl.Suff = nSuff; Lvl.Suff = nSuff;
var Lvl_new = this.Internal_CopyLvl(Lvl); var Lvl_new = this.Internal_CopyLvl(Lvl);
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new}); History.Add(new CChangesAbstractNumLvlChange(this, Lvl_old, Lvl_new, iLvl));
}, },
// X, Y, Context - параметры для рисование // X, Y, Context - параметры для рисование
...@@ -1498,18 +1497,18 @@ CAbstractNum.prototype = ...@@ -1498,18 +1497,18 @@ CAbstractNum.prototype =
CurTextPr.Merge(TextPr); CurTextPr.Merge(TextPr);
var TextPr_new = CurTextPr.Copy(); var TextPr_new = CurTextPr.Copy();
History.Add( this, { Type : AscDFH.historyitem_AbstractNum_TextPrChange, Index : Lvl, Old : TextPr_old, New : TextPr_new } ); History.Add(new CChangesAbstractNumTextPrChange(this, TextPr_old, TextPr_new, Lvl));
}, },
Set_TextPr : function(Lvl, TextPr) Set_TextPr : function(Lvl, TextPr)
{ {
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_TextPrChange, Index : Lvl, Old : this.Lvl[Lvl].TextPr, New : TextPr}); History.Add(new CChangesAbstractNumTextPrChange(this, this.Lvl[Lvl].TextPr, TextPr, Lvl));
this.Lvl[Lvl].TextPr = TextPr; this.Lvl[Lvl].TextPr = TextPr;
}, },
Set_ParaPr : function(Lvl, ParaPr) Set_ParaPr : function(Lvl, ParaPr)
{ {
History.Add(this, {Type : AscDFH.historyitem_AbstractNum_ParaPrChange, Index : Lvl, Old : this.Lvl[Lvl].ParaPr, New : ParaPr}); History.Add(new CChangesAbstractNumParaPrChange(this, this.Lvl[Lvl].ParaPr, ParaPr, Lvl));
this.Lvl[Lvl].ParaPr = ParaPr; this.Lvl[Lvl].ParaPr = ParaPr;
}, },
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -1610,77 +1609,6 @@ CAbstractNum.prototype = ...@@ -1610,77 +1609,6 @@ CAbstractNum.prototype =
} }
}, },
Undo : function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_AbstractNum_LvlChange:
{
this.Internal_SetLvl( Data.Index, Data.Old );
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
case AscDFH.historyitem_AbstractNum_TextPrChange:
{
this.Lvl[Data.Index].TextPr = Data.Old;
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
case AscDFH.historyitem_AbstractNum_ParaPrChange:
{
this.Lvl[Data.Index].ParaPr = Data.Old;
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
}
},
Redo : function(Data)
{
var Type = Data.Type;
switch ( Type )
{
case AscDFH.historyitem_AbstractNum_LvlChange:
{
this.Internal_SetLvl( Data.Index, Data.New );
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
case AscDFH.historyitem_AbstractNum_TextPrChange:
{
this.Lvl[Data.Index].TextPr = Data.New;
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
case AscDFH.historyitem_AbstractNum_ParaPrChange:
{
this.Lvl[Data.Index].ParaPr = Data.New;
// Пересчитываем стили у все параграфов с данной нумерацией
this.Recalc_CompiledPr(Data.Index);
break;
}
}
},
Refresh_RecalcData : function(Data) Refresh_RecalcData : function(Data)
{ {
var NumPr = new CNumPr(); var NumPr = new CNumPr();
...@@ -1700,115 +1628,6 @@ CAbstractNum.prototype = ...@@ -1700,115 +1628,6 @@ CAbstractNum.prototype =
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования // Функции для работы с совместным редактирования
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
Save_Changes : function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_AbstractNum );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_AbstractNum_LvlChange:
{
// Long : iLvl
// Variable : Lvl
Writer.WriteLong(Data.Index);
this.Write_Lvl_ToBinary( Data.New, Writer );
break;
}
case AscDFH.historyitem_AbstractNum_TextPrChange:
{
// Long : iLvl
// Vairable : TextPr
Writer.WriteLong(Data.Index);
Data.New.Write_ToBinary(Writer);
break;
}
case AscDFH.historyitem_AbstractNum_ParaPrChange:
{
// Long : iLvl
// Vairable : ParaPr
Writer.WriteLong(Data.Index);
Data.New.Write_ToBinary(Writer);
break;
}
}
return Writer;
},
Load_Changes : function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_AbstractNum != ClassType )
return;
var Type = Reader.GetLong();
var iLvl = 0;
switch ( Type )
{
case AscDFH.historyitem_AbstractNum_LvlChange:
{
// Long : iLvl
// Variable : Lvl
iLvl = Reader.GetLong();
this.Read_Lvl_FromBinary( this.Lvl[iLvl], Reader );
break;
}
case AscDFH.historyitem_AbstractNum_TextPrChange:
{
// Long : iLvl
// Vairable : TextPr
iLvl = Reader.GetLong();
this.Lvl[iLvl].TextPr = new CTextPr();
this.Lvl[iLvl].TextPr.Read_FromBinary(Reader);
break;
}
case AscDFH.historyitem_AbstractNum_ParaPrChange:
{
// Long : iLvl
// Vairable : ParaPr
iLvl = Reader.GetLong();
this.Lvl[iLvl].ParaPr = new CParaPr();
this.Lvl[iLvl].ParaPr.Read_FromBinary(Reader);
break;
}
}
// Сразу нельзя запускать пересчет, т.к. возможно еще не все ссылки проставлены
AscCommon.CollaborativeEditing.Add_EndActions(this, {iLvl : iLvl});
},
Write_ToBinary2 : function(Writer) Write_ToBinary2 : function(Writer)
{ {
Writer.WriteLong( AscDFH.historyitem_type_AbstractNum ); Writer.WriteLong( AscDFH.historyitem_type_AbstractNum );
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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";
/**
* User: Ilja.Kirillov
* Date: 08.11.2016
* Time: 14:37
*/
AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_LvlChange] = CChangesAbstractNumLvlChange;
AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_TextPrChange] = CChangesAbstractNumTextPrChange;
AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_ParaPrChange] = CChangesAbstractNumParaPrChange;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesAbstractNumLvlChange(Class, Old, New, Index)
{
CChangesAbstractNumLvlChange.superclass.constructor.call(this, Class, Old, New);
this.Index = Index;
}
AscCommon.extendClass(CChangesAbstractNumLvlChange, AscDFH.CChangesBaseProperty);
CChangesAbstractNumLvlChange.prototype.Type = AscDFH.historyitem_AbstractNum_LvlChange;
CChangesAbstractNumLvlChange.prototype.WriteToBinary = function(Writer)
{
var oAbstractNum = this.Class;
// Long : Lvl index
// Variable : New Lvl
// Variable : Old Lvl
Writer.WriteLong(this.Index);
oAbstractNum.Write_Lvl_ToBinary(this.New, Writer);
oAbstractNum.Write_Lvl_ToBinary(this.Old, Writer);
};
CChangesAbstractNumLvlChange.prototype.ReadFromBinary = function(Reader)
{
var oAbstractNum = this.Class;
// Long : Lvl index
// Variable : New Lvl
// Variable : Old Lvl
this.New = {};
this.Old = {};
this.Index = Reader.GetLong();
oAbstractNum.Read_Lvl_FromBinary(this.New, Reader);
oAbstractNum.Read_Lvl_FromBinary(this.Old, Reader);
};
CChangesAbstractNumLvlChange.prototype.private_SetValue = function(Value)
{
var oAbstractNum = this.Class;
oAbstractNum.Internal_SetLvl(this.Index, Value);
oAbstractNum.Recalc_CompiledPr(this.Index);
};
CChangesAbstractNumLvlChange.prototype.Load = function(Color)
{
var oAbstractNum = this.Class;
oAbstractNum.Internal_SetLvl(this.Index, this.New);
// Сразу нельзя запускать пересчет, т.к. возможно еще не все ссылки проставлены
AscCommon.CollaborativeEditing.Add_EndActions(this.Class, {iLvl : this.Index});
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesAbstractNumTextPrChange(Class, Old, New, Index)
{
CChangesAbstractNumTextPrChange.superclass.constructor.call(this, Class, Old, New);
this.Index = Index;
}
AscCommon.extendClass(CChangesAbstractNumTextPrChange, AscDFH.CChangesBaseProperty);
CChangesAbstractNumTextPrChange.prototype.Type = AscDFH.historyitem_AbstractNum_TextPrChange;
CChangesAbstractNumTextPrChange.prototype.WriteToBinary = function(Writer)
{
// Long : Lvl index
// TextPr : New TextPr
// TextPr : Old TextPr
Writer.WriteLong(this.Index);
this.New.Write_ToBinary(Writer);
this.Old.Write_ToBinary(Writer);
};
CChangesAbstractNumTextPrChange.prototype.ReadFromBinary = function(Reader)
{
// Long : Lvl index
// TextPr : New TextPr
// TextPr : Old TextPr
this.New = new CTextPr();
this.Old = new CTextPr();
this.Index = Reader.GetLong();
this.New.Read_FromBinary(Reader);
this.Old.Read_FromBinary(Reader);
};
CChangesAbstractNumTextPrChange.prototype.private_SetValue = function(Value)
{
var oAbstractNum = this.Class;
oAbstractNum.Lvl[this.Index].TextPr = Value;
oAbstractNum.Recalc_CompiledPr(this.Index);
};
CChangesAbstractNumTextPrChange.prototype.Load = function(Color)
{
var oAbstractNum = this.Class;
oAbstractNum.Lvl[this.Index].TextPr = this.New;
// Сразу нельзя запускать пересчет, т.к. возможно еще не все ссылки проставлены
AscCommon.CollaborativeEditing.Add_EndActions(this.Class, {iLvl : this.Index});
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesAbstractNumParaPrChange(Class, Old, New, Index)
{
CChangesAbstractNumParaPrChange.superclass.constructor.call(this, Class, Old, New);
this.Index = Index;
}
AscCommon.extendClass(CChangesAbstractNumParaPrChange, AscDFH.CChangesBaseProperty);
CChangesAbstractNumParaPrChange.prototype.Type = AscDFH.historyitem_AbstractNum_ParaPrChange;
CChangesAbstractNumParaPrChange.prototype.WriteToBinary = function(Writer)
{
// Long : Lvl index
// ParaPr : New ParaPr
// ParaPr : Old ParaPr
Writer.WriteLong(this.Index);
this.New.Write_ToBinary(Writer);
this.Old.Write_ToBinary(Writer);
};
CChangesAbstractNumParaPrChange.prototype.ReadFromBinary = function(Reader)
{
// Long : Lvl index
// ParaPr : New ParaPr
// ParaPr : Old ParaPr
this.New = new CParaPr();
this.Old = new CParaPr();
this.Index = Reader.GetLong();
this.New.Read_FromBinary(Reader);
this.Old.Read_FromBinary(Reader);
};
CChangesAbstractNumParaPrChange.prototype.private_SetValue = function(Value)
{
var oAbstractNum = this.Class;
oAbstractNum.Lvl[this.Index].ParaPr = Value;
oAbstractNum.Recalc_CompiledPr(this.Index);
};
CChangesAbstractNumParaPrChange.prototype.Load = function(Color)
{
var oAbstractNum = this.Class;
oAbstractNum.Lvl[this.Index].ParaPr = this.New;
// Сразу нельзя запускать пересчет, т.к. возможно еще не все ссылки проставлены
AscCommon.CollaborativeEditing.Add_EndActions(this.Class, {iLvl : this.Index});
};
\ No newline at end of file
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