Commit dcb0cd76 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented merge function for changes of classes CTable/CTableRow/CTableCell/ParaDrawing.

parent ef29eb22
......@@ -57,6 +57,31 @@ AscDFH.changesFactory[AscDFH.historyitem_Drawing_LayoutInCell] = CChangesPa
AscDFH.changesFactory[AscDFH.historyitem_Drawing_SetSizeRelH] = CChangesParaDrawingSizeRelH;
AscDFH.changesFactory[AscDFH.historyitem_Drawing_SetSizeRelV] = CChangesParaDrawingSizeRelV;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.paradrawingChangesRelationMap = {};
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_DrawingType] = [AscDFH.historyitem_Drawing_DrawingType];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_WrappingType] = [AscDFH.historyitem_Drawing_WrappingType];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_Distance] = [AscDFH.historyitem_Drawing_Distance];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_AllowOverlap] = [AscDFH.historyitem_Drawing_AllowOverlap];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_PositionH] = [AscDFH.historyitem_Drawing_PositionH];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_PositionV] = [AscDFH.historyitem_Drawing_PositionV];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_BehindDoc] = [AscDFH.historyitem_Drawing_BehindDoc];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetGraphicObject] = [AscDFH.historyitem_Drawing_SetGraphicObject];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetSimplePos] = [AscDFH.historyitem_Drawing_SetSimplePos];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetExtent] = [AscDFH.historyitem_Drawing_SetExtent];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetWrapPolygon] = [AscDFH.historyitem_Drawing_SetWrapPolygon];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetLocked] = [AscDFH.historyitem_Drawing_SetLocked];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetRelativeHeight] = [AscDFH.historyitem_Drawing_SetRelativeHeight];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetEffectExtent] = [AscDFH.historyitem_Drawing_SetEffectExtent];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetParent] = [AscDFH.historyitem_Drawing_SetParent];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetParaMath] = [AscDFH.historyitem_Drawing_SetParaMath];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_LayoutInCell] = [AscDFH.historyitem_Drawing_LayoutInCell];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetSizeRelH] = [AscDFH.historyitem_Drawing_SetSizeRelH];
AscDFH.paradrawingChangesRelationMap[AscDFH.historyitem_Drawing_SetSizeRelV] = [AscDFH.historyitem_Drawing_SetSizeRelV];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongValue}
......
......@@ -51,6 +51,90 @@ AscDFH.changesFactory[AscDFH.historyitem_TableCell_Pr] = CChangesTabl
AscDFH.changesFactory[AscDFH.historyitem_TableCell_TextDirection] = CChangesTableCellTextDirection;
AscDFH.changesFactory[AscDFH.historyitem_TableCell_NoWrap] = CChangesTableCellNoWrap;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.tablecellChangesRelationMap = {};
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_GridSpan] = [
AscDFH.historyitem_TableCell_GridSpan,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Margins] = [
AscDFH.historyitem_TableCell_Margins,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Shd] = [
AscDFH.historyitem_TableCell_Shd,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_VMerge] = [
AscDFH.historyitem_TableCell_VMerge,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Border_Left] = [
AscDFH.historyitem_TableCell_Border_Left,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Border_Right] = [
AscDFH.historyitem_TableCell_Border_Right,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Border_Top] = [
AscDFH.historyitem_TableCell_Border_Top,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Border_Bottom] = [
AscDFH.historyitem_TableCell_Border_Bottom,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_VAlign] = [
AscDFH.historyitem_TableCell_VAlign,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_W] = [
AscDFH.historyitem_TableCell_W,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_Pr] = [
AscDFH.historyitem_TableCell_GridSpan,
AscDFH.historyitem_TableCell_Margins,
AscDFH.historyitem_TableCell_Shd,
AscDFH.historyitem_TableCell_VMerge,
AscDFH.historyitem_TableCell_Border_Left,
AscDFH.historyitem_TableCell_Border_Right,
AscDFH.historyitem_TableCell_Border_Top,
AscDFH.historyitem_TableCell_Border_Bottom,
AscDFH.historyitem_TableCell_VAlign,
AscDFH.historyitem_TableCell_W,
AscDFH.historyitem_TableCell_Pr,
AscDFH.historyitem_TableCell_TextDirection,
AscDFH.historyitem_TableCell_NoWrap
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_TextDirection] = [
AscDFH.historyitem_TableCell_TextDirection,
AscDFH.historyitem_TableCell_Pr
];
AscDFH.tablecellChangesRelationMap[AscDFH.historyitem_TableCell_NoWrap] = [
AscDFH.historyitem_TableCell_NoWrap,
AscDFH.historyitem_TableCell_Pr
];
/**
* Общая функция объединения изменений, которые зависят только от себя и AscDFH.historyitem_TableCell_Pr
* @param oChange
* @returns {boolean}
*/
function private_TableCellChangesOnMergePr(oChange)
{
if (oChange.Class !== this.Class)
return true;
if (oChange.Type === this.Type || oChange.Type === AscDFH.historyitem_TableCell_Pr)
return false;
return true;
}
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -67,6 +151,7 @@ CChangesTableCellGridSpan.prototype.private_SetValue = function(Value)
oCell.Pr.GridSpan = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellGridSpan.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -194,6 +279,7 @@ CChangesTableCellMargins.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellMar = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellMargins.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -214,6 +300,7 @@ CChangesTableCellShd.prototype.private_SetValue = function(Value)
oCell.Pr.Shd = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellShd.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -230,6 +317,7 @@ CChangesTableCellVMerge.prototype.private_SetValue = function(Value)
oCell.Pr.VMerge = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellVMerge.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -347,6 +435,7 @@ CChangesTableCellBorderLeft.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellBorders.Left = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellBorderLeft.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -464,6 +553,7 @@ CChangesTableCellBorderTop.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellBorders.Top = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellBorderTop.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -581,6 +671,7 @@ CChangesTableCellBorderRight.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellBorders.Right = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellBorderRight.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -698,6 +789,7 @@ CChangesTableCellBorderBottom.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellBorders.Bottom = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellBorderBottom.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -714,6 +806,7 @@ CChangesTableCellVAlign.prototype.private_SetValue = function(Value)
oCell.Pr.VAlign = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellVAlign.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
......@@ -734,6 +827,7 @@ CChangesTableCellW.prototype.private_SetValue = function(Value)
oCell.Pr.TableCellW = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellW.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
......@@ -754,6 +848,83 @@ CChangesTableCellPr.prototype.private_SetValue = function(Value)
oCell.Pr = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellPr.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
return false;
if (!this.New)
this.New = new CTableCellPr();
switch(oChange.Type)
{
case AscDFH.historyitem_TableCell_GridSpan:
{
this.New.GridSpan = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Margins:
{
this.New.TableCellMar = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Shd:
{
this.New.Shd = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_VMerge:
{
this.New.VMerge = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Border_Left:
{
this.New.TableCellBorders.Left = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Border_Right:
{
this.New.TableCellBorders.Right = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Border_Top:
{
this.New.TableCellBorders.Top = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_Border_Bottom:
{
this.New.TableCellBorders.Bottom = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_VAlign:
{
this.New.VAlign = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_W:
{
this.New.TableCellW = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_TextDirection:
{
this.New.TextDirection = oChange.New;
break;
}
case AscDFH.historyitem_TableCell_NoWrap:
{
this.New.NoWrap = oChange.New;
break;
}
}
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -770,6 +941,7 @@ CChangesTableCellTextDirection.prototype.private_SetValue = function(Value)
oCell.Pr.TextDirection = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellTextDirection.prototype.Merge = private_TableCellChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseBoolProperty}
......@@ -786,3 +958,4 @@ CChangesTableCellNoWrap.prototype.private_SetValue = function(Value)
oCell.Pr.NoWrap = Value;
oCell.Recalc_CompiledPr();
};
CChangesTableCellNoWrap.prototype.Merge = private_TableCellChangesOnMergePr;
\ No newline at end of file
......@@ -63,6 +63,132 @@ AscDFH.changesFactory[AscDFH.historyitem_Table_Distance] = CChanges
AscDFH.changesFactory[AscDFH.historyitem_Table_Pr] = CChangesTablePr;
AscDFH.changesFactory[AscDFH.historyitem_Table_TableLayout] = CChangesTableTableLayout;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.tableChangesRelationMap = {};
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableW] = [
AscDFH.historyitem_Table_TableW,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableCellMar] = [
AscDFH.historyitem_Table_TableCellMar,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableAlign] = [
AscDFH.historyitem_Table_TableAlign,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableInd] = [
AscDFH.historyitem_Table_TableInd,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_Left] = [
AscDFH.historyitem_Table_TableBorder_Left,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_Top] = [
AscDFH.historyitem_Table_TableBorder_Top,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_Right] = [
AscDFH.historyitem_Table_TableBorder_Right,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_Bottom] = [
AscDFH.historyitem_Table_TableBorder_Bottom,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_InsideH] = [
AscDFH.historyitem_Table_TableBorder_InsideH,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableBorder_InsideV] = [
AscDFH.historyitem_Table_TableBorder_InsideV,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableShd] = [
AscDFH.historyitem_Table_TableShd,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_Inline] = [
AscDFH.historyitem_Table_Inline
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_AddRow] = [
AscDFH.historyitem_Table_AddRow,
AscDFH.historyitem_Table_RemoveRow
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_RemoveRow] = [
AscDFH.historyitem_Table_AddRow,
AscDFH.historyitem_Table_RemoveRow
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableGrid] = [
AscDFH.historyitem_Table_TableGrid
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableLook] = [
AscDFH.historyitem_Table_TableLook
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableStyleRowBandSize] = [
AscDFH.historyitem_Table_TableStyleRowBandSize,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableStyleColBandSize] = [
AscDFH.historyitem_Table_TableStyleColBandSize,
AscDFH.historyitem_Table_Pr
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableStyle] = [
AscDFH.historyitem_Table_TableStyle
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_AllowOverlap] = [
AscDFH.historyitem_Table_AllowOverlap
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_PositionH] = [
AscDFH.historyitem_Table_PositionH
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_PositionV] = [
AscDFH.historyitem_Table_PositionV
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_Distance] = [
AscDFH.historyitem_Table_Distance
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_Pr] = [
AscDFH.historyitem_Table_TableW,
AscDFH.historyitem_Table_TableCellMar,
AscDFH.historyitem_Table_TableAlign,
AscDFH.historyitem_Table_TableInd,
AscDFH.historyitem_Table_TableBorder_Left,
AscDFH.historyitem_Table_TableBorder_Top,
AscDFH.historyitem_Table_TableBorder_Right,
AscDFH.historyitem_Table_TableBorder_Bottom,
AscDFH.historyitem_Table_TableBorder_InsideH,
AscDFH.historyitem_Table_TableBorder_InsideV,
AscDFH.historyitem_Table_TableShd,
AscDFH.historyitem_Table_TableStyleRowBandSize,
AscDFH.historyitem_Table_TableStyleColBandSize,
AscDFH.historyitem_Table_Pr,
AscDFH.historyitem_Table_TableLayout
];
AscDFH.tableChangesRelationMap[AscDFH.historyitem_Table_TableLayout] = [
AscDFH.historyitem_Table_TableLayout,
AscDFH.historyitem_Table_Pr
];
/**
* Общая функция объединения изменений, которые зависят только от себя и AscDFH.historyitem_Table_Pr
* @param oChange
* @returns {boolean}
*/
function private_TableChangesOnMergePr(oChange)
{
if (oChange.Class !== this.Class)
return true;
if (oChange.Type === this.Type || oChange.Type === AscDFH.historyitem_Table_Pr)
return false;
return true;
}
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -83,6 +209,7 @@ CChangesTableTableW.prototype.private_SetValue = function(Value)
oTable.Pr.TableW = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableTableW.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -266,6 +393,7 @@ CChangesTableTableCellMar.prototype.private_SetValue = function(Value)
oTable.Recalc_CompiledPr();
};
CChangesTableTableCellMar.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -282,6 +410,7 @@ CChangesTableTableAlign.prototype.private_SetValue = function(Value)
oTable.Pr.Jc = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableTableAlign.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseDoubleProperty}
......@@ -298,6 +427,7 @@ CChangesTableTableInd.prototype.private_SetValue = function(Value)
oTable.Pr.TableInd = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableTableInd.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -318,6 +448,7 @@ CChangesTableTableBorderLeft.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.Left = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderLeft.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -338,6 +469,7 @@ CChangesTableTableBorderTop.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.Top = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderTop.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -358,6 +490,7 @@ CChangesTableTableBorderRight.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.Right = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderRight.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -378,6 +511,7 @@ CChangesTableTableBorderBottom.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.Bottom = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderBottom.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -398,6 +532,7 @@ CChangesTableTableBorderInsideH.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.InsideH = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderInsideH.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -418,6 +553,7 @@ CChangesTableTableBorderInsideV.prototype.private_SetValue = function(Value)
oTable.Pr.TableBorders.InsideV = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableBorderInsideV.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -438,6 +574,7 @@ CChangesTableTableShd.prototype.private_SetValue = function(Value)
oTable.Pr.Shd = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableShd.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseBoolValue}
......@@ -685,6 +822,7 @@ CChangesTableTableStyleRowBandSize.prototype.private_SetValue = function(Value)
oTable.Pr.TableStyleRowBandSize = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableTableStyleRowBandSize.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -701,6 +839,7 @@ CChangesTableTableStyleColBandSize.prototype.private_SetValue = function(Value)
oTable.Pr.TableStyleColBandSize = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableTableStyleColBandSize.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -1013,6 +1152,96 @@ CChangesTablePr.prototype.private_SetValue = function(Value)
oTable.Pr = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTablePr.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
return false;
if (!this.New)
this.New = new CTablePr();
switch (oChange.Type)
{
case AscDFH.historyitem_Table_TableW:
{
this.New.TableW = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableCellMar:
{
this.New.TableCellMar.Left = oChange.New.Left;
this.New.TableCellMar.Right = oChange.New.Right;
this.New.TableCellMar.Top = oChange.New.Top;
this.New.TableCellMar.Bottom = oChange.New.Bottom;
break;
}
case AscDFH.historyitem_Table_TableAlign:
{
this.New.Jc = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableInd:
{
this.New.TableInd = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_Left:
{
this.New.TableBorders.Left = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_Top:
{
this.New.TableBorders.Top = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_Right:
{
this.New.TableBorders.Right = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_Bottom:
{
this.New.TableBorders.Bottom = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_InsideH:
{
this.New.TableBorders.InsideH = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableBorder_InsideV:
{
this.New.TableBorders.InsideV = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableShd:
{
this.New.Shd = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableStyleRowBandSize:
{
this.New.TableStyleRowBandSize = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableStyleColBandSize:
{
this.New.TableStyleColBandSize = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableLayout:
{
this.New.TableLayout = oChange.New;
break;
}
}
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......@@ -1029,3 +1258,4 @@ CChangesTableTableLayout.prototype.private_SetValue = function(Value)
oTable.Pr.TableLayout = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableLayout.prototype.Merge = private_TableChangesOnMergePr;
\ No newline at end of file
......@@ -46,6 +46,63 @@ AscDFH.changesFactory[AscDFH.historyitem_TableRow_RemoveCell] = CChangesTableRo
AscDFH.changesFactory[AscDFH.historyitem_TableRow_TableHeader] = CChangesTableRowTableHeader;
AscDFH.changesFactory[AscDFH.historyitem_TableRow_Pr] = CChangesTableRowPr;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.tablerowChangesRelationMap = {};
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_Before] = [
AscDFH.historyitem_TableRow_Before,
AscDFH.historyitem_TableRow_Pr
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_After] = [
AscDFH.historyitem_TableRow_After,
AscDFH.historyitem_TableRow_Pr
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_CellSpacing] = [
AscDFH.historyitem_TableRow_CellSpacing,
AscDFH.historyitem_TableRow_Pr
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_Height] = [
AscDFH.historyitem_TableRow_Height,
AscDFH.historyitem_TableRow_Pr
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_AddCell] = [
AscDFH.historyitem_TableRow_AddCell,
AscDFH.historyitem_TableRow_RemoveCell
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_RemoveCell] = [
AscDFH.historyitem_TableRow_AddCell,
AscDFH.historyitem_TableRow_RemoveCell
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_TableHeader] = [
AscDFH.historyitem_TableRow_TableHeader,
AscDFH.historyitem_TableRow_Pr
];
AscDFH.tablerowChangesRelationMap[AscDFH.historyitem_TableRow_Pr] = [
AscDFH.historyitem_TableRow_Before,
AscDFH.historyitem_TableRow_After,
AscDFH.historyitem_TableRow_CellSpacing,
AscDFH.historyitem_TableRow_Height,
AscDFH.historyitem_TableRow_TableHeader,
AscDFH.historyitem_TableRow_Pr
];
/**
* Общая функция объединения изменений, которые зависят только от себя и AscDFH.historyitem_TableRow_Pr
* @param oChange
* @returns {boolean}
*/
function private_TableRowChangesOnMergePr(oChange)
{
if (oChange.Class !== this.Class)
return true;
if (oChange.Type === this.Type || oChange.Type === AscDFH.historyitem_TableRow_Pr)
return false;
return true;
}
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -151,6 +208,7 @@ CChangesTableRowBefore.prototype.private_SetValue = function(Value)
oTableRow.Pr.WBefore = Value.WBefore;
oTableRow.Recalc_CompiledPr();
};
CChangesTableRowBefore.prototype.Merge = private_TableRowChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -256,6 +314,7 @@ CChangesTableRowAfter.prototype.private_SetValue = function(Value)
oTableRow.Pr.WAfter = Value.WBefore;
oTableRow.Recalc_CompiledPr();
};
CChangesTableRowAfter.prototype.Merge = private_TableRowChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -326,6 +385,7 @@ CChangesTableRowCellSpacing.prototype.private_SetValue = function(Value)
oTableRow.Pr.TableCellSpacing = Value;
oTableRow.Recalc_CompiledPr();
};
CChangesTableRowCellSpacing.prototype.Merge = private_TableRowChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectProperty}
......@@ -346,6 +406,7 @@ CChangesTableRowHeight.prototype.private_SetValue = function(Value)
oTable.Pr.Height = Value;
oTable.Recalc_CompiledPr();
};
CChangesTableRowHeight.prototype.Merge = private_TableRowChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseContentChange}
......@@ -494,6 +555,7 @@ CChangesTableRowTableHeader.prototype.private_SetValue = function(Value)
oRow.Pr.TableHeader = Value;
oRow.Recalc_CompiledPr();
};
CChangesTableRowTableHeader.prototype.Merge = private_TableRowChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
......@@ -514,3 +576,47 @@ CChangesTableRowPr.prototype.private_SetValue = function(Value)
oRow.Pr = Value;
oRow.Recalc_CompiledPr();
};
CChangesTableRowPr.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
return false;
if (!this.New)
this.New = new CTableRowPr();
switch (oChange.Type)
{
case AscDFH.historyitem_TableRow_Before:
{
this.New.GridBefore = oChange.New.GridBefore;
this.New.WBefore = oChange.New.WBefore;
break;
}
case AscDFH.historyitem_TableRow_After:
{
this.New.GridAfter = oChange.New.GridAfter;
this.New.WAfter = oChange.New.WAfter;
break;
}
case AscDFH.historyitem_TableRow_CellSpacing:
{
this.New.TableCellSpacing = oChange.New;
break;
}
case AscDFH.historyitem_TableRow_Height:
{
this.New.Height = oChange.New;
break;
}
case AscDFH.historyitem_TableRow_TableHeader:
{
this.New.TableHeader = oChange.New;
break;
}
}
return true;
};
\ 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