Commit 5220aebd authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

* 'develop' of https://github.com/ONLYOFFICE/sdkjs:
  check SectionsInfo
  Changes for classes Footnotes/Sections were added to relation map. Also was implemented merge functions for this changes.
  return scheme color for cell background
parents 5680b894 9504dab6
......@@ -258,7 +258,14 @@ function CBackground (obj)
{
if (obj)
{
this.Color = (undefined != obj.Color && null != obj.Color) ? AscCommon.CreateAscColorCustom(obj.Color.r, obj.Color.g, obj.Color.b) : null;
if (obj.Unifill && obj.Unifill.fill && obj.Unifill.fill.type === window['Asc'].c_oAscFill.FILL_TYPE_SOLID && obj.Unifill.fill.color)
{
this.Color = AscCommon.CreateAscColor(obj.Unifill.fill.color);
}
else
{
this.Color = (undefined != obj.Color && null != obj.Color) ? AscCommon.CreateAscColorCustom(obj.Color.r, obj.Color.g, obj.Color.b) : null;
}
this.Value = (undefined != obj.Value) ? obj.Value : null;
}
else
......@@ -267,10 +274,10 @@ function CBackground (obj)
this.Value = 1;
}
}
CBackground.prototype.get_Color = function (){return this.Color;}
CBackground.prototype.put_Color = function (v){this.Color = (v) ? v: null;}
CBackground.prototype.get_Value = function (){return this.Value;}
CBackground.prototype.put_Value = function (v){this.Value = v;}
CBackground.prototype.get_Color = function (){return this.Color;};
CBackground.prototype.put_Color = function (v){this.Color = (v) ? v: null;};
CBackground.prototype.get_Value = function (){return this.Value;};
CBackground.prototype.put_Value = function (v){this.Value = v;};
function CTablePositionH(obj)
{
......
......@@ -78,7 +78,11 @@ CChangesDocumentAddItem.prototype.Undo = function()
var oDocument = this.Class;
var Elements = oDocument.Content.splice(Pos, 1);
oDocument.private_RecalculateNumbering(Elements);
oDocument.SectionsInfo.Update_OnRemove(Pos, 1);
if(oDocument.SectionsInfo)
{
oDocument.SectionsInfo.Update_OnRemove(Pos, 1);
}
if (Pos > 0)
{
......@@ -108,7 +112,10 @@ CChangesDocumentAddItem.prototype.Redo = function()
var oDocument = this.Class;
oDocument.Content.splice(Pos, 0, Element);
oDocument.private_RecalculateNumbering([Element]);
oDocument.SectionsInfo.Update_OnAdd(Pos, [Element]);
if(oDocument.SectionsInfo)
{
oDocument.SectionsInfo.Update_OnAdd(Pos, [Element]);
}
if (Pos > 0)
{
......@@ -178,7 +185,10 @@ CChangesDocumentAddItem.prototype.Load = function(Color)
oDocument.Content.splice(Pos, 0, Element);
oDocument.private_RecalculateNumbering([Element]);
oDocument.SectionsInfo.Update_OnAdd(Pos, [Element]);
if(oDocument.SectionsInfo)
{
oDocument.SectionsInfo.Update_OnAdd(Pos, [Element]);
}
oDocument.private_ReindexContent(Pos);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(oDocument, Pos);
......@@ -215,7 +225,11 @@ CChangesDocumentRemoveItem.prototype.Undo = function()
oDocument.private_RecalculateNumbering(this.Items);
oDocument.Content = Array_start.concat(this.Items, Array_end);
oDocument.SectionsInfo.Update_OnAdd(this.Pos, this.Items);
if(oDocument.SectionsInfo)
{
oDocument.SectionsInfo.Update_OnAdd(this.Pos, this.Items);
}
var nStartIndex = Math.max(this.Pos - 1, 0);
var nEndIndex = Math.min(oDocument.Content.length - 1, this.Pos + this.Items.length + 1);
......@@ -240,7 +254,11 @@ CChangesDocumentRemoveItem.prototype.Redo = function()
var oDocument = this.Class;
var Elements = oDocument.Content.splice(this.Pos, this.Items.length);
oDocument.private_RecalculateNumbering(Elements);
oDocument.SectionsInfo.Update_OnRemove(this.Pos, this.Items.length);
if(oDocument.SectionsInfo)
{
oDocument.SectionsInfo.Update_OnRemove(this.Pos, this.Items.length);
}
var Pos = this.Pos;
if (Pos > 0)
......
......@@ -46,6 +46,19 @@ AscDFH.changesFactory[AscDFH.historyitem_Footnotes_SetFootnotePrNumStart] = C
AscDFH.changesFactory[AscDFH.historyitem_Footnotes_SetFootnotePrNumRestart] = CChangesFootnotesSetFootnotePrNumRestart;
AscDFH.changesFactory[AscDFH.historyitem_Footnotes_SetFootnotePrNumFormat] = CChangesFootnotesSetFootnotePrNumFormat;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_AddFootnote] = [AscDFH.historyitem_Footnotes_AddFootnote];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetSeparator] = [AscDFH.historyitem_Footnotes_SetSeparator];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetContinuationSeparator] = [AscDFH.historyitem_Footnotes_SetContinuationSeparator];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetContinuationNotice] = [AscDFH.historyitem_Footnotes_SetContinuationNotice];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetFootnotePrPos] = [AscDFH.historyitem_Footnotes_SetFootnotePrPos];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetFootnotePrNumStart] = [AscDFH.historyitem_Footnotes_SetFootnotePrNumStart];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetFootnotePrNumRestart] = [AscDFH.historyitem_Footnotes_SetFootnotePrNumRestart];
AscDFH.changesRelationMap[AscDFH.historyitem_Footnotes_SetFootnotePrNumFormat] = [AscDFH.historyitem_Footnotes_SetFootnotePrNumFormat];
//----------------------------------------------------------------------------------------------------------------------
/**
* @constructor
* @extends {AscDFH.CChangesBase}
......@@ -80,6 +93,16 @@ CChangesParaFieldAddItem.prototype.CreateReverseChange = function()
{
return null;
};
CChangesParaFieldAddItem.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type && this.Id === oChange.Id)
return false;
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......
......@@ -70,6 +70,43 @@ AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumStart] = CChanges
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumRestart] = CChangesSectionFootnoteNumRestart;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumFormat] = CChangesSectionFootnoteNumFormat;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageSize_Orient] = [AscDFH.historyitem_Section_PageSize_Orient];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageSize_Size] = [AscDFH.historyitem_Section_PageSize_Size];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins] = [AscDFH.historyitem_Section_PageMargins];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Type] = [AscDFH.historyitem_Section_Type];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Left] = [AscDFH.historyitem_Section_Borders_Left];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Top] = [AscDFH.historyitem_Section_Borders_Top];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Right] = [AscDFH.historyitem_Section_Borders_Right];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Bottom] = [AscDFH.historyitem_Section_Borders_Bottom];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Display] = [AscDFH.historyitem_Section_Borders_Display];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_OffsetFrom] = [AscDFH.historyitem_Section_Borders_OffsetFrom];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_ZOrder] = [AscDFH.historyitem_Section_Borders_ZOrder];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_First] = [AscDFH.historyitem_Section_Header_First];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_Even] = [AscDFH.historyitem_Section_Header_Even];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_Default] = [AscDFH.historyitem_Section_Header_Default];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_First] = [AscDFH.historyitem_Section_Footer_First];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_Even] = [AscDFH.historyitem_Section_Footer_Even];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_Default] = [AscDFH.historyitem_Section_Footer_Default];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_TitlePage] = [AscDFH.historyitem_Section_TitlePage];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins_Header] = [AscDFH.historyitem_Section_PageMargins_Header];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins_Footer] = [AscDFH.historyitem_Section_PageMargins_Footer];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageNumType_Start] = [AscDFH.historyitem_Section_PageNumType_Start];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_EqualWidth] = [AscDFH.historyitem_Section_Columns_EqualWidth];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Space] = [AscDFH.historyitem_Section_Columns_Space];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Num] = [AscDFH.historyitem_Section_Columns_Num];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Sep] = [AscDFH.historyitem_Section_Columns_Sep];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Col] = [AscDFH.historyitem_Section_Columns_Col, AscDFH.historyitem_Section_Columns_SetCols];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_SetCols] = [AscDFH.historyitem_Section_Columns_Col, AscDFH.historyitem_Section_Columns_SetCols];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_Pos] = [AscDFH.historyitem_Section_Footnote_Pos];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumStart] = [AscDFH.historyitem_Section_Footnote_NumStart];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumRestart] = [AscDFH.historyitem_Section_Footnote_NumRestart];
AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumFormat] = [AscDFH.historyitem_Section_Footnote_NumFormat];
//----------------------------------------------------------------------------------------------------------------------
/**
* Базовый класс для изменения колонтитулов
......@@ -646,6 +683,25 @@ CChangesSectionColumnsCol.prototype.CreateReverseChange = function()
{
return new CChangesSectionColumnsCol(this.Class, this.New, this.Old, this.Index);
};
CChangesSectionColumnsCol.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
{
if (this.Index !== oChange.Index)
return true;
else
return false;
}
else if (AscDFH.historyitem_Section_Columns_SetCols === oChange.Type)
{
return false
}
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
......@@ -705,6 +761,24 @@ CChangesSectionColumnsSetCols.prototype.ReadFromBinary = function(Reader)
this.Old[nIndex].Read_FromBinary(Reader);
}
};
CChangesSectionColumnsSetCols.prototype.Merge = function(oChange)
{
if (this.Class !== oChange.Class)
return true;
if (this.Type === oChange.Type)
return false;
if (AscDFH.historyitem_Section_Columns_Col === oChange.Type)
{
if (!this.New)
this.New = [];
this.New[oChange.Index] = oChange.New;
}
return true;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
......
......@@ -4140,7 +4140,14 @@ background-repeat: no-repeat;\
{
if (obj)
{
this.Color = (undefined != obj.Color && null != obj.Color) ? AscCommon.CreateAscColorCustom(obj.Color.r, obj.Color.g, obj.Color.b) : null;
if (obj.Unifill && obj.Unifill.fill && obj.Unifill.fill.type === window['Asc'].c_oAscFill.FILL_TYPE_SOLID && obj.Unifill.fill.color)
{
this.Color = AscCommon.CreateAscColor(obj.Unifill.fill.color);
}
else
{
this.Color = (undefined != obj.Color && null != obj.Color) ? AscCommon.CreateAscColorCustom(obj.Color.r, obj.Color.g, obj.Color.b) : null;
}
this.Value = (undefined != obj.Value) ? obj.Value : null;
}
else
......
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