Commit 3a10f500 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented merge function for changes of classes...

Implemented merge function for changes of classes ParaHyperlink/DocumentContent/Comment/Comments/ParaComment/AbstractNumbering.
parent dcb0cd76
......@@ -371,8 +371,22 @@
window["AscCommon"].CChangesCommonAddWaterMark = CChangesCommonAddWaterMark;
})(window);
AscDFH.changesFactory[AscDFH.historyitem_TableId_Add] = AscCommon.CChangesTableIdAdd;
AscDFH.changesFactory[AscDFH.historyitem_TableId_Reset] = AscCommon.CChangesTableIdReset;
AscDFH.changesFactory[AscDFH.historyitem_TableId_Description] = AscCommon.CChangesTableIdDescription;
AscDFH.changesFactory[AscDFH.historyitem_Common_AddWatermark] = AscCommon.CChangesCommonAddWaterMark;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.tableidRelationMap = {};
AscDFH.tableidRelationMap[AscDFH.historyitem_TableId_Add] = [AscDFH.historyitem_TableId_Add];
AscDFH.tableidRelationMap[AscDFH.historyitem_TableId_Reset] = [AscDFH.historyitem_TableId_Reset];
AscDFH.tableidRelationMap[AscDFH.historyitem_TableId_Description] = [AscDFH.historyitem_TableId_Description];
AscDFH.tableidRelationMap[AscDFH.historyitem_Common_AddWatermark] = [AscDFH.historyitem_Common_AddWatermark];
//----------------------------------------------------------------------------------------------------------------------
......@@ -45,6 +45,26 @@ AscDFH.changesFactory[AscDFH.historyitem_Comments_Remove] = CChangesCommentsRemo
AscDFH.changesFactory[AscDFH.historyitem_ParaComment_CommentId] = CChangesParaCommentCommentId;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.commentRelationMap = {};
AscDFH.commentRelationMap[AscDFH.historyitem_Comment_Change] = [AscDFH.historyitem_Comment_Change];
AscDFH.commentRelationMap[AscDFH.historyitem_Comment_TypeInfo] = [AscDFH.historyitem_Comment_TypeInfo];
AscDFH.commentsRelationMap = {};
AscDFH.commentsRelationMap[AscDFH.historyitem_Comments_Add] = [
AscDFH.historyitem_Comments_Add,
AscDFH.historyitem_Comments_Remove
];
AscDFH.commentsRelationMap[AscDFH.historyitem_Comments_Remove] = [
AscDFH.historyitem_Comments_Add,
AscDFH.historyitem_Comments_Remove
];
AscDFH.paracommentRelationMap = {};
AscDFH.changesFactory[AscDFH.historyitem_ParaComment_CommentId] = [AscDFH.historyitem_ParaComment_CommentId];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
......@@ -168,6 +188,16 @@ CChangesCommentsAdd.prototype.CreateReverseChange = function()
{
return new CChangesCommentsRemove(this.Class, this.Id, this.Comment);
};
CChangesCommentsAdd.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if ((AscDFH.historyitem_Comments_Add === oChange.Type || AscDFH.historyitem_Comments_Remove === oChange.Type) && this.Id === oChange.Id)
return false;
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
......@@ -206,6 +236,16 @@ CChangesCommentsRemove.prototype.CreateReverseChange = function()
{
return new CChangesCommentsAdd(this.Class, this.Id, this.Comment);
};
CChangesCommentsRemove.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if ((AscDFH.historyitem_Comments_Add === oChange.Type || AscDFH.historyitem_Comments_Remove === oChange.Type) && this.Id === oChange.Id)
return false;
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......
......@@ -44,6 +44,24 @@ AscDFH.changesFactory[AscDFH.historyitem_Document_EvenAndOddHeaders] = CChangesD
AscDFH.changesFactory[AscDFH.historyitem_Document_DefaultLanguage] = CChangesDocumentDefaultLanguage;
AscDFH.changesFactory[AscDFH.historyitem_Document_MathSettings] = CChangesDocumentMathSettings;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.documentChangesRelationMap = {};
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_AddItem] = [
AscDFH.historyitem_Document_AddItem,
AscDFH.historyitem_Document_RemoveItem
];
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_RemoveItem] = [
AscDFH.historyitem_Document_AddItem,
AscDFH.historyitem_Document_RemoveItem
];
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_DefaultTab] = [AscDFH.historyitem_Document_DefaultTab];
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_EvenAndOddHeaders] = [AscDFH.historyitem_Document_EvenAndOddHeaders];
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_DefaultLanguage] = [AscDFH.historyitem_Document_DefaultLanguage];
AscDFH.documentChangesRelationMap[AscDFH.historyitem_Document_MathSettings] = [AscDFH.historyitem_Document_MathSettings];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseContentChange}
......
......@@ -40,6 +40,20 @@
AscDFH.changesFactory[AscDFH.historyitem_DocumentContent_AddItem] = CChangesDocumentContentAddItem;
AscDFH.changesFactory[AscDFH.historyitem_DocumentContent_RemoveItem] = CChangesDocumentContentRemoveItem;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.documentcontentChangesRelationMap = {};
AscDFH.documentcontentChangesRelationMap[AscDFH.historyitem_DocumentContent_AddItem] = [
AscDFH.historyitem_DocumentContent_AddItem,
AscDFH.historyitem_DocumentContent_RemoveItem
];
AscDFH.documentcontentChangesRelationMap[AscDFH.historyitem_DocumentContent_RemoveItem] = [
AscDFH.historyitem_DocumentContent_AddItem,
AscDFH.historyitem_DocumentContent_RemoveItem
];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseContentChange}
......
......@@ -42,6 +42,22 @@ AscDFH.changesFactory[AscDFH.historyitem_Hyperlink_ToolTip] = CChangesHyperli
AscDFH.changesFactory[AscDFH.historyitem_Hyperlink_AddItem] = CChangesHyperlinkAddItem;
AscDFH.changesFactory[AscDFH.historyitem_Hyperlink_RemoveItem] = CChangesHyperlinkRemoveItem;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.hyperlinkChangesRelationMap = {};
AscDFH.hyperlinkChangesRelationMap[AscDFH.historyitem_Hyperlink_Value] = [AscDFH.historyitem_Hyperlink_Value];
AscDFH.hyperlinkChangesRelationMap[AscDFH.historyitem_Hyperlink_ToolTip] = [AscDFH.historyitem_Hyperlink_ToolTip];
AscDFH.hyperlinkChangesRelationMap[AscDFH.historyitem_Hyperlink_AddItem] = [
AscDFH.historyitem_Hyperlink_AddItem,
AscDFH.historyitem_Hyperlink_RemoveItem
];
AscDFH.hyperlinkChangesRelationMap[AscDFH.historyitem_Hyperlink_RemoveItem] = [
AscDFH.historyitem_Hyperlink_AddItem,
AscDFH.historyitem_Hyperlink_RemoveItem
];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseStringValue}
......
......@@ -41,6 +41,26 @@ AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_LvlChange] = CChangesAbs
AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_TextPrChange] = CChangesAbstractNumTextPrChange;
AscDFH.changesFactory[AscDFH.historyitem_AbstractNum_ParaPrChange] = CChangesAbstractNumParaPrChange;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.abstractnumRelationMap = {};
AscDFH.abstractnumRelationMap[AscDFH.historyitem_AbstractNum_LvlChange] = [
AscDFH.historyitem_AbstractNum_LvlChange,
AscDFH.historyitem_AbstractNum_TextPrChange,
AscDFH.historyitem_AbstractNum_ParaPrChange
];
AscDFH.abstractnumRelationMap[AscDFH.historyitem_AbstractNum_TextPrChange] = [
AscDFH.historyitem_AbstractNum_LvlChange,
AscDFH.historyitem_AbstractNum_TextPrChange
];
AscDFH.abstractnumRelationMap[AscDFH.historyitem_AbstractNum_ParaPrChange] = [
AscDFH.historyitem_AbstractNum_LvlChange,
AscDFH.historyitem_AbstractNum_ParaPrChange
];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -98,6 +118,25 @@ CChangesAbstractNumLvlChange.prototype.CreateReverseChange = function()
{
return new CChangesAbstractNumLvlChange(this.Class, this.New, this.Old, this.Index);
};
CChangesAbstractNumLvlChange.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
return false;
if (AscDFH.historyitem_AbstractNum_TextPrChange === oChange.Type)
{
this.New.TextPr = oChange.New;
}
else if (AscDFH.historyitem_AbstractNum_ParaPrChange === oChange.Type)
{
this.New.ParaPr = oChange.New;
}
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -151,6 +190,16 @@ CChangesAbstractNumTextPrChange.prototype.CreateReverseChange = function()
{
return new CChangesAbstractNumTextPrChange(this.Class, this.New, this.Old, this.Index);
};
CChangesAbstractNumTextPrChange.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type || oChange.Type === AscDFH.historyitem_AbstractNum_LvlChange)
return false;
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -204,3 +253,13 @@ CChangesAbstractNumParaPrChange.prototype.CreateReverseChange = function()
{
return new CChangesAbstractNumParaPrChange(this.Class, this.New, this.Old, this.Index);
};
CChangesAbstractNumParaPrChange.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type || oChange.Type === AscDFH.historyitem_AbstractNum_LvlChange)
return false;
return true;
};
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