Commit 1c64568d authored by Ilya Kirillov's avatar Ilya Kirillov

Changes for class CSection were replaces with a new classes.

parent 906a46a0
......@@ -101,6 +101,7 @@
"../word/Editor/ParagraphChanges.js",
"../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js",
"../word/Editor/SectionsChanges.js",
"../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js",
......
......@@ -150,6 +150,7 @@
"../word/Editor/ParagraphChanges.js",
"../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js",
"../word/Editor/SectionsChanges.js",
"../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js",
......
......@@ -111,6 +111,7 @@
"../word/Editor/Table/TableCellChanges.js",
"../word/Editor/Common.js",
"../word/Editor/Sections.js",
"../word/Editor/SectionsChanges.js",
"../word/Drawing/Graphics.js",
"../word/Drawing/ShapeDrawer.js",
......
......@@ -123,6 +123,7 @@
"../word/Editor/ParagraphChanges.js",
"../word/Editor/Paragraph_Recalculate.js",
"../word/Editor/Sections.js",
"../word/Editor/SectionsChanges.js",
"../word/Editor/Numbering.js",
"../word/Editor/NumberingChanges.js",
"../word/Editor/HeaderFooter.js",
......
......@@ -3349,7 +3349,7 @@
};
window['AscDFH'].CChangesBaseLongValue = CChangesBaseLongValue;
/**
* Базовый класс для изменения числовых(long) значений.
* Базовый класс для изменения булевых значений.
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
......@@ -3413,8 +3413,62 @@
// String : New
// String : Old
this.New = Reader.WriteString2();
this.Old = Reader.WriteString2();
this.New = Reader.GetString2();
this.Old = Reader.GetString2();
};
window['AscDFH'].CChangesBaseStringValue = CChangesBaseStringValue;
/**
* Базовый класс для изменения числовых(byte) значений.
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesBaseByteValue(Class, Old, New, Color)
{
CChangesBaseByteValue.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseByteValue, CChangesBaseProperty);
CChangesBaseByteValue.prototype.WriteToBinary = function(Writer)
{
// Byte : New
// Byte : Old
Writer.WriteByte(this.New);
Writer.WriteByte(this.Old);
};
CChangesBaseByteValue.prototype.ReadFromBinary = function(Reader)
{
// Byte : New
// Byte : Old
this.New = Reader.GetByte();
this.Old = Reader.GetByte();
};
window['AscDFH'].CChangesBaseByteValue = CChangesBaseByteValue;
/**
* Базовый класс для изменения числовых(double) значений.
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesBaseDoubleValue(Class, Old, New, Color)
{
CChangesBaseDoubleValue.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseDoubleValue, CChangesBaseProperty);
CChangesBaseDoubleValue.prototype.WriteToBinary = function(Writer)
{
// Double : New
// Double : Old
Writer.WriteDouble(this.New);
Writer.WriteDouble(this.Old);
};
CChangesBaseDoubleValue.prototype.ReadFromBinary = function(Reader)
{
// Double : New
// Double : Old
this.New = Reader.GetDouble();
this.Old = Reader.GetDouble();
};
window['AscDFH'].CChangesBaseDoubleValue = CChangesBaseDoubleValue;
})(window);
......@@ -236,9 +236,9 @@ CSectionPr.prototype =
Set_Type : function(Type)
{
if ( this.Type !== Type )
if (this.Type !== Type)
{
History.Add(this, { Type: AscDFH.historyitem_Section_Type, Old: this.Type, New: Type });
History.Add(new CChangesSectionType(this, this.Type, Type));
this.Type = Type;
}
},
......@@ -250,13 +250,13 @@ CSectionPr.prototype =
Set_PageSize : function(W, H)
{
if ( Math.abs( W - this.PageSize.W ) > 0.001 || Math.abs( H - this.PageSize.H ) > 0.001 )
if (Math.abs(W - this.PageSize.W) > 0.001 || Math.abs(H - this.PageSize.H) > 0.001)
{
History.Add(this, { Type: AscDFH.historyitem_Section_PageSize_Size, Old: { W : this.PageSize.W, H : this.PageSize.H }, New: { W : W, H : H } });
H = Math.max(2.6, H);
W = Math.max(12.7, W);
History.Add(new CChangesSectionPageSize(this, {W : this.PageSize.W, H : this.PageSize.H}, {W : W, H : H}));
this.PageSize.W = W;
this.PageSize.H = H;
}
......@@ -280,9 +280,14 @@ CSectionPr.prototype =
var R = ( undefined !== _R ? _R : this.PageMargins.Right );
var B = ( undefined !== _B ? _B : this.PageMargins.Bottom );
if ( Math.abs( L - this.PageMargins.Left ) > 0.001 || Math.abs( T - this.PageMargins.Top ) > 0.001 || Math.abs( R - this.PageMargins.Right ) > 0.001 || Math.abs( B - this.PageMargins.Bottom ) > 0.001 )
if (Math.abs(L - this.PageMargins.Left) > 0.001 || Math.abs(T - this.PageMargins.Top) > 0.001 || Math.abs(R - this.PageMargins.Right) > 0.001 || Math.abs(B - this.PageMargins.Bottom) > 0.001)
{
History.Add( this, { Type : AscDFH.historyitem_Section_PageMargins, Old : { L : this.PageMargins.Left, T : this.PageMargins.Top, R : this.PageMargins.Right, B : this.PageMargins.Bottom }, New : { L : L, T : T, R : R, B : B } } );
History.Add(new CChangesSectionPageMargins(this, {
L : this.PageMargins.Left,
T : this.PageMargins.Top,
R : this.PageMargins.Right,
B : this.PageMargins.Bottom
}, {L : L, T : T, R : R, B : B}));
this.PageMargins.Left = L;
this.PageMargins.Top = T;
......@@ -313,12 +318,12 @@ CSectionPr.prototype =
Set_Orientation : function(Orient, ApplySize)
{
if ( this.PageSize.Orient !== Orient )
if (this.PageSize.Orient !== Orient)
{
History.Add(this, { Type: AscDFH.historyitem_Section_PageSize_Orient, Old: this.PageSize.Orient, New: Orient });
History.Add(new CChangesSectionPageOrient(this, this.PageSize.Orient, Orient));
this.PageSize.Orient = Orient;
if ( true === ApplySize )
if (true === ApplySize)
{
// При смене ориентации меняем местами высоту и ширину страницы и изменяем отступы
......@@ -332,10 +337,10 @@ CSectionPr.prototype =
this.Set_PageSize(H, W);
if ( Asc.c_oAscPageOrientation.PagePortrait === Orient )
this.Set_PageMargins( T, R, B, L );
if (Asc.c_oAscPageOrientation.PagePortrait === Orient)
this.Set_PageMargins(T, R, B, L);
else
this.Set_PageMargins( B, L, T, R );
this.Set_PageMargins(B, L, T, R);
}
}
},
......@@ -347,9 +352,9 @@ CSectionPr.prototype =
Set_Borders_Left : function(Border)
{
if ( true !== this.Borders.Left.Compare( Border ) )
if (true !== this.Borders.Left.Compare(Border))
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_Left, Old : this.Borders.Left, New : Border } );
History.Add(new CChangesSectionBordersLeft(this, this.Borders.Left, Border));
this.Borders.Left = Border;
}
},
......@@ -361,9 +366,9 @@ CSectionPr.prototype =
Set_Borders_Top : function(Border)
{
if ( true !== this.Borders.Top.Compare( Border ) )
if (true !== this.Borders.Top.Compare(Border))
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_Top, Old : this.Borders.Top, New : Border } );
History.Add(new CChangesSectionBordersTop(this, this.Borders.Top, Border));
this.Borders.Top = Border;
}
},
......@@ -375,9 +380,9 @@ CSectionPr.prototype =
Set_Borders_Right : function(Border)
{
if ( true !== this.Borders.Right.Compare( Border ) )
if (true !== this.Borders.Right.Compare(Border))
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_Right, Old : this.Borders.Right, New : Border } );
History.Add(new CChangesSectionBordersRight(this, this.Borders.Right, Border));
this.Borders.Right = Border;
}
},
......@@ -389,9 +394,9 @@ CSectionPr.prototype =
Set_Borders_Bottom : function(Border)
{
if ( true !== this.Borders.Bottom.Compare( Border ) )
if (true !== this.Borders.Bottom.Compare(Border))
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_Bottom, Old : this.Borders.Bottom, New : Border } );
History.Add(new CChangesSectionBordersBottom(this, this.Borders.Bottom, Border));
this.Borders.Bottom = Border;
}
},
......@@ -403,9 +408,9 @@ CSectionPr.prototype =
Set_Borders_Display : function(Display)
{
if ( Display !== this.Borders.Display )
if (Display !== this.Borders.Display)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_Display, Old : this.Borders.Display, New : Display } );
History.Add(new CChangesSectionBordersDisplay(this, this.Borders.Display, Display));
this.Borders.Display = Display;
}
},
......@@ -417,9 +422,9 @@ CSectionPr.prototype =
Set_Borders_OffsetFrom : function(OffsetFrom)
{
if ( OffsetFrom !== this.Borders.OffsetFrom )
if (OffsetFrom !== this.Borders.OffsetFrom)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_OffsetFrom, Old : this.Borders.OffsetFrom, New : OffsetFrom } );
History.Add(new CChangesSectionBordersOffsetFrom(this, this.Borders.OffsetFrom, OffsetFrom));
this.Borders.OffsetFrom = OffsetFrom;
}
},
......@@ -431,9 +436,9 @@ CSectionPr.prototype =
Set_Borders_ZOrder : function(ZOrder)
{
if ( ZOrder !== this.Borders.ZOrder )
if (ZOrder !== this.Borders.ZOrder)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Borders_ZOrder, Old : this.Borders.ZOrder, New : ZOrder } );
History.Add(new CChangesSectionBordersZOrder(this, this.Borders.ZOrder, ZOrder));
this.Borders.ZOrder = ZOrder;
}
},
......@@ -445,9 +450,9 @@ CSectionPr.prototype =
Set_Footer_First : function(Footer)
{
if ( Footer !== this.FooterFirst )
if (Footer !== this.FooterFirst)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Footer_First, Old : this.FooterFirst, New : Footer } );
History.Add(new CChangesSectionFooterFirst(this, this.FooterFirst, Footer));
this.FooterFirst = Footer;
}
},
......@@ -459,9 +464,9 @@ CSectionPr.prototype =
Set_Footer_Even : function(Footer)
{
if ( Footer !== this.FooterEven )
if (Footer !== this.FooterEven)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Footer_Even, Old : this.FooterEven, New : Footer } );
History.Add(new CChangesSectionFooterEven(this, this.FooterEven, Footer));
this.FooterEven = Footer;
}
},
......@@ -473,9 +478,9 @@ CSectionPr.prototype =
Set_Footer_Default : function(Footer)
{
if ( Footer !== this.FooterDefault )
if (Footer !== this.FooterDefault)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Footer_Default, Old : this.FooterDefault, New : Footer } );
History.Add(new CChangesSectionFooterDefault(this, this.FooterDefault, Footer));
this.FooterDefault = Footer;
}
},
......@@ -487,9 +492,9 @@ CSectionPr.prototype =
Set_Header_First : function(Header)
{
if ( Header !== this.HeaderFirst )
if (Header !== this.HeaderFirst)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Header_First, Old : this.HeaderFirst, New : Header } );
History.Add(new CChangesSectionHeaderFirst(this, this.HeaderFirst, Header));
this.HeaderFirst = Header;
}
},
......@@ -501,9 +506,9 @@ CSectionPr.prototype =
Set_Header_Even : function(Header)
{
if ( Header !== this.HeaderEven )
if (Header !== this.HeaderEven)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Header_Even, Old : this.HeaderEven, New : Header } );
History.Add(new CChangesSectionHeaderEven(this, this.HeaderEven, Header));
this.HeaderEven = Header;
}
},
......@@ -515,9 +520,9 @@ CSectionPr.prototype =
Set_Header_Default : function(Header)
{
if ( Header !== this.HeaderDefault )
if (Header !== this.HeaderDefault)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Header_Default, Old : this.HeaderDefault, New : Header } );
History.Add(new CChangesSectionHeaderDefault(this, this.HeaderDefault, Header));
this.HeaderDefault = Header;
}
},
......@@ -529,9 +534,9 @@ CSectionPr.prototype =
Set_TitlePage : function(Value)
{
if ( Value !== this.TitlePage )
if (Value !== this.TitlePage)
{
History.Add( this, { Type : AscDFH.historyitem_Section_TitlePage, Old : this.TitlePage, New : Value } );
History.Add(new CChangesSectionTitlePage(this, this.TitlePage, Value));
this.TitlePage = Value;
}
},
......@@ -543,9 +548,9 @@ CSectionPr.prototype =
Set_PageMargins_Header : function(Header)
{
if ( Header !== this.PageMargins.Header )
if (Header !== this.PageMargins.Header)
{
History.Add( this, { Type : AscDFH.historyitem_Section_PageMargins_Header, Old : this.PageMargins.Header, New : Header } );
History.Add(new CChangesSectionPageMarginsHeader(this, this.PageMargins.Header, Header));
this.PageMargins.Header = Header;
}
},
......@@ -557,9 +562,9 @@ CSectionPr.prototype =
Set_PageMargins_Footer : function(Footer)
{
if ( Footer !== this.PageMargins.Footer )
if (Footer !== this.PageMargins.Footer)
{
History.Add( this, { Type : AscDFH.historyitem_Section_PageMargins_Footer, Old : this.PageMargins.Footer, New : Footer } );
History.Add(new CChangesSectionPageMarginsFooter(this, this.PageMargins.Footer, Footer));
this.PageMargins.Footer = Footer;
}
},
......@@ -633,9 +638,9 @@ CSectionPr.prototype =
Set_PageNum_Start : function(Start)
{
if ( Start !== this.PageNumType.Start )
if (Start !== this.PageNumType.Start)
{
History.Add( this, { Type : AscDFH.historyitem_Section_PageNumType_Start, Old : this.PageNumType.Start, New : Start } );
History.Add(new CChangesSectionPageNumTypeStart(this, this.PageNumType.Start, Start));
this.PageNumType.Start = Start;
}
},
......@@ -662,45 +667,45 @@ CSectionPr.prototype =
Set_Columns_EqualWidth : function(Equal)
{
if ( Equal !== this.Columns.Equal )
if (Equal !== this.Columns.Equal)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Columns_EqualWidth, Old : this.Columns.EqualWidth, New : Equal } );
History.Add(new CChangesSectionColumnsEqualWidth(this, this.Columns.EqualWidth, Equal));
this.Columns.EqualWidth = Equal;
}
},
Set_Columns_Space : function(Space)
{
if ( Space !== this.Columns.Space )
if (Space !== this.Columns.Space)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Columns_Space, Old : this.Columns.Space, New : Space } );
History.Add(new CChangesSectionColumnsSpace(this, this.Columns.Space, Space));
this.Columns.Space = Space;
}
},
Set_Columns_Num : function(_Num)
{
var Num = Math.max( _Num, 1 );
var Num = Math.max(_Num, 1);
if ( Num !== this.Columns.Num )
if (Num !== this.Columns.Num)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Columns_Num, Old : this.Columns.Num, New : Num } );
History.Add(new CChangesSectionColumnsNum(this, this.Columns.Num, Num));
this.Columns.Num = Num;
}
},
Set_Columns_Sep : function(Sep)
{
if ( Sep !== this.Columns.Sep )
if (Sep !== this.Columns.Sep)
{
History.Add( this, { Type : AscDFH.historyitem_Section_Columns_Sep, Old : this.Columns.Sep, New : Sep } );
History.Add(new CChangesSectionColumnsSep(this, this.Columns.Sep, Sep));
this.Columns.Sep = Sep;
}
},
Set_Columns_Cols : function(Cols)
{
History.Add(this, {Type : AscDFH.historyitem_Section_Columns_SetCols, Old : this.Columns.Cols, New : Cols});
History.Add(new CChangesSectionColumnsSetCols(this, this.Columns.Cols, Cols));
this.Columns.Cols = Cols;
},
......@@ -708,13 +713,13 @@ CSectionPr.prototype =
{
var OldCol = this.Columns.Cols[Index];
if ( undefined === OldCol || OldCol.Space !== Space || OldCol.W !== W )
if (undefined === OldCol || OldCol.Space !== Space || OldCol.W !== W)
{
var NewCol = new CSectionColumn();
NewCol.W = W;
NewCol.Space = Space;
History.Add( this, { Type : AscDFH.historyitem_Section_Columns_Col, Index : Index, Old : OldCol, New : NewCol } );
History.Add(new CChangesSectionColumnsCol(this, OldCol, NewCol, Index));
this.Columns.Cols[Index] = NewCol;
}
},
......@@ -802,1134 +807,173 @@ CSectionPr.prototype =
//----------------------------------------------------------------------------------------------------------------------
// Undo/Redo функции
//----------------------------------------------------------------------------------------------------------------------
Undo : function(Data)
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_Section_PageSize_Orient :
{
this.PageSize.Orient = Data.Old;
break;
}
case AscDFH.historyitem_Section_PageSize_Size:
{
this.PageSize.W = Data.Old.W;
this.PageSize.H = Data.Old.H;
break;
}
case AscDFH.historyitem_Section_PageMargins:
{
this.PageMargins.Left = Data.Old.L;
this.PageMargins.Top = Data.Old.T;
this.PageMargins.Right = Data.Old.R;
this.PageMargins.Bottom = Data.Old.B;
break;
}
case AscDFH.historyitem_Section_Type:
{
this.Type = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_Left:
{
this.Borders.Left = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_Top:
{
this.Borders.Top = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_Right:
{
this.Borders.Right = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_Bottom:
{
this.Borders.Bottom = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_Display:
{
this.Borders.Display = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_OffsetFrom:
{
this.Borders.OffsetFrom = Data.Old;
break;
}
case AscDFH.historyitem_Section_Borders_ZOrder:
Refresh_RecalcData : function(Data)
{
this.Borders.ZOrder = Data.Old;
break;
}
// Найдем данную секцию в документе
var Index = this.LogicDocument.SectionsInfo.Find( this );
case AscDFH.historyitem_Section_Header_First:
{
this.HeaderFirst = Data.Old;
break;
}
if ( -1 === Index )
return;
case AscDFH.historyitem_Section_Header_Even:
{
this.HeaderEven = Data.Old;
break;
}
// Здесь есть 1 исключение: когда мы добавляем колонтитул для первой страницы, может так получиться, что
// у данной секции флаг TitlePage = False, а значит пересчет надо запускать с места где данный колонтитул
// первый раз начнет использоваться, а не с текущей секции.
case AscDFH.historyitem_Section_Header_Default:
if ( (AscDFH.historyitem_Section_Header_First === Data.Type || AscDFH.historyitem_Section_Footer_First === Data.Type) && false === this.TitlePage )
{
this.HeaderDefault = Data.Old;
break;
}
case AscDFH.historyitem_Section_Footer_First:
var bHeader = AscDFH.historyitem_Section_Header_First === Data.Type ? true : false
var SectionsCount = this.LogicDocument.SectionsInfo.Get_SectionsCount();
while ( Index < SectionsCount - 1 )
{
this.FooterFirst = Data.Old;
break;
}
Index++;
case AscDFH.historyitem_Section_Footer_Even:
{
this.FooterEven = Data.Old;
break;
}
var TempSectPr = this.LogicDocument.SectionsInfo.Get_SectPr2(Index).SectPr;
case AscDFH.historyitem_Section_Footer_Default:
{
this.FooterDefault = Data.Old;
// Если в следующей секции свой колонтитул, тогда наш добавленный колонтитул вообще ни на что не влияет
if ( (true === bHeader && null !== TempSectPr.Get_Header_First()) || (true !== bHeader && null !== TempSectPr.Get_Footer_First()) )
break;
}
case AscDFH.historyitem_Section_TitlePage:
// Если в следующей секции есть титульная страница, значит мы нашли нужную секцию
if ( true === TempSectPr.Get_TitlePage() )
{
this.TitlePage = Data.Old;
break;
}
case AscDFH.historyitem_Section_PageMargins_Header:
if ( 0 === Index )
{
this.PageMargins.Header = Data.Old;
break;
this.LogicDocument.Refresh_RecalcData2(0, 0);
}
case AscDFH.historyitem_Section_PageMargins_Footer:
else
{
this.PageMargins.Footer = Data.Old;
break;
var DocIndex = this.LogicDocument.SectionsInfo.Elements[Index - 1].Index + 1;
this.LogicDocument.Refresh_RecalcData2( DocIndex, 0 );
}
case AscDFH.historyitem_Section_PageNumType_Start:
{
this.PageNumType.Start = Data.Old;
break;
}
case AscDFH.historyitem_Section_Columns_EqualWidth:
{
this.Columns.EqualWidth = Data.Old;
break;
}
case AscDFH.historyitem_Section_Columns_Space:
{
this.Columns.Space = Data.Old;
break;
}
case AscDFH.historyitem_Section_Columns_Num:
else
{
this.Columns.Num = Data.Old;
break;
}
case AscDFH.historyitem_Section_Columns_Sep:
if ( 0 === Index )
{
this.Columns.Sep = Data.Old;
break;
// Первая секция, значит мы должны пересчитать начиная с самого начала документа
this.LogicDocument.Refresh_RecalcData2(0, 0);
}
case AscDFH.historyitem_Section_Columns_Col:
else
{
this.Columns.Cols[Data.Index] = Data.Old;
break;
// Ищем номер элемента, на котором закончилась предыдущая секция, начиная со следующего после него элемента
// и пересчитываем документ.
var DocIndex = this.LogicDocument.SectionsInfo.Elements[Index - 1].Index + 1;
this.LogicDocument.Refresh_RecalcData2( DocIndex, 0 );
}
case AscDFH.historyitem_Section_Columns_SetCols:
{
this.Columns.Cols = Data.Old;
break;
}
case AscDFH.historyitem_Section_Footnote_Pos:
{
this.FootnotePr.Pos = Data.Old;
break;
}
case AscDFH.historyitem_Section_Footnote_NumStart:
{
this.FootnotePr.NumStart = Data.Old;
break;
}
case AscDFH.historyitem_Section_Footnote_NumRestart:
{
this.FootnotePr.NumRestart = Data.Old;
break;
}
case AscDFH.historyitem_Section_Footnote_NumFormat:
{
this.FootnotePr.NumFormat = Data.Old;
break;
}
}
// Дополнительно кроме этого мы должны обновить пересчет в колонтитулах, причем только начиная с данной секции
this.LogicDocument.On_SectionChange( this );
},
Redo : function(Data)
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_Section_PageSize_Orient :
{
this.PageSize.Orient = Data.New;
break;
}
case AscDFH.historyitem_Section_PageSize_Size:
{
this.PageSize.W = Data.New.W;
this.PageSize.H = Data.New.H;
break;
}
case AscDFH.historyitem_Section_PageMargins:
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
Write_ToBinary2 : function(Writer)
{
this.PageMargins.Left = Data.New.L;
this.PageMargins.Top = Data.New.T;
this.PageMargins.Right = Data.New.R;
this.PageMargins.Bottom = Data.New.B;
break;
}
Writer.WriteLong( AscDFH.historyitem_type_Section );
case AscDFH.historyitem_Section_Type:
{
this.Type = Data.New;
// String2 : Id
// String2 : Id LogicDocument
// Variable : PageSize
// Variable : PageMargins
// Byte : Type
// Variable : Borders
// Колонтитулы не пишем в бинарник, при созданиии класса они всегда null, а TitlePage = false
// Variable : PageNumType
// Variable : CSectionColumns
// Variable : CFootnotePr
break;
}
Writer.WriteString2( "" + this.Id );
Writer.WriteString2( "" + this.LogicDocument.Get_Id() );
this.PageSize.Write_ToBinary( Writer );
this.PageMargins.Write_ToBinary( Writer );
Writer.WriteByte( this.Type );
this.Borders.Write_ToBinary( Writer );
this.PageNumType.Write_ToBinary( Writer );
this.Columns.Write_ToBinary(Writer);
this.FootnotePr.WriteToBinary(Writer);
},
case AscDFH.historyitem_Section_Borders_Left:
Read_FromBinary2 : function(Reader)
{
this.Borders.Left = Data.New;
break;
}
// String2 : Id
// String2 : Id LogicDocument
// Variable : PageSize
// Variable : PageMargins
// Byte : Type
// Variable : Borders
// Колонтитулы не пишем в бинарник, при созданиии класса они всегда null, а TitlePage = false
// Variable : PageNumType
// Variable : CSectionColumns
// Variable : CFootnotePr
case AscDFH.historyitem_Section_Borders_Top:
{
this.Borders.Top = Data.New;
break;
this.Id = Reader.GetString2();
this.LogicDocument = g_oTableId.Get_ById( Reader.GetString2() );
this.PageSize.Read_FromBinary( Reader );
this.PageMargins.Read_FromBinary( Reader );
this.Type = Reader.GetByte();
this.Borders.Read_FromBinary( Reader );
this.PageNumType.Read_FromBinary( Reader );
this.Columns.Read_FromBinary(Reader);
this.FootnotePr.ReadFromBinary(Reader);
}
case AscDFH.historyitem_Section_Borders_Right:
};
CSectionPr.prototype.GetFootnotePr = function()
{
return this.FootnotePr;
};
CSectionPr.prototype.SetFootnotePos = function(nPos)
{
if (this.FootnotePr.Pos !== nPos)
{
this.Borders.Right = Data.New;
break;
History.Add(new CChangesSectionFootnotePos(this, this.FootnotePr.Pos, nPos));
this.FootnotePr.Pos = nPos;
}
};
CSectionPr.prototype.GetFootnotePos = function()
{
if (undefined === this.FootnotePr.Pos)
return section_footnote_PosPageBottom;
case AscDFH.historyitem_Section_Borders_Bottom:
return this.FootnotePr.Pos;
};
CSectionPr.prototype.SetFootnoteNumStart = function(nStart)
{
if (this.FootnotePr.NumStart !== nStart)
{
this.Borders.Bottom = Data.New;
break;
History.Add(new CChangesSectionFootnoteNumStart(this, this.FootnotePr.NumStart, nStart));
this.FootnotePr.NumStart = nStart;
}
};
CSectionPr.prototype.GetFootnoteNumStart = function()
{
if (undefined === this.FootnotePr.NumStart)
return 1;
case AscDFH.historyitem_Section_Borders_Display:
return this.FootnotePr.NumStart;
};
CSectionPr.prototype.SetFootnoteNumRestart = function(nRestartType)
{
if (this.FootnotePr.NumRestart !== nRestartType)
{
this.Borders.Display = Data.New;
break;
History.Add(new CChangesSectionFootnoteNumRestart(this, this.FootnotePr.NumRestart, nRestartType));
this.FootnotePr.NumRestart = nRestartType;
}
};
CSectionPr.prototype.GetFootnoteNumRestart = function()
{
if (undefined === this.FootnotePr.NumRestart)
return this.private_GetDocumentWideFootnotePr().NumRestart;
case AscDFH.historyitem_Section_Borders_OffsetFrom:
return this.FootnotePr.NumRestart;
};
CSectionPr.prototype.SetFootnoteNumFormat = function(nFormatType)
{
if (this.FootnotePr.NumFormat !== nFormatType)
{
this.Borders.OffsetFrom = Data.New;
break;
}
case AscDFH.historyitem_Section_Borders_ZOrder:
{
this.Borders.ZOrder = Data.New;
break;
}
case AscDFH.historyitem_Section_Header_First:
{
this.HeaderFirst = Data.New;
break;
}
case AscDFH.historyitem_Section_Header_Even:
{
this.HeaderEven = Data.New;
break;
}
case AscDFH.historyitem_Section_Header_Default:
{
this.HeaderDefault = Data.New;
break;
}
case AscDFH.historyitem_Section_Footer_First:
{
this.FooterFirst = Data.New;
break;
}
case AscDFH.historyitem_Section_Footer_Even:
{
this.FooterEven = Data.New;
break;
}
case AscDFH.historyitem_Section_Footer_Default:
{
this.FooterDefault = Data.New;
break;
}
case AscDFH.historyitem_Section_TitlePage:
{
this.TitlePage = Data.New;
break;
}
case AscDFH.historyitem_Section_PageMargins_Header:
{
this.PageMargins.Header = Data.New;
break;
}
case AscDFH.historyitem_Section_PageMargins_Footer:
{
this.PageMargins.Footer = Data.New;
break;
}
case AscDFH.historyitem_Section_PageNumType_Start:
{
this.PageNumType.Start = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_EqualWidth:
{
this.Columns.EqualWidth = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_Space:
{
this.Columns.Space = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_Num:
{
this.Columns.Num = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_Sep:
{
this.Columns.Sep = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_Col:
{
this.Columns.Cols[Data.Index] = Data.New;
break;
}
case AscDFH.historyitem_Section_Columns_SetCols:
{
this.Columns.Cols = Data.New;
break;
}
case AscDFH.historyitem_Section_Footnote_Pos:
{
this.FootnotePr.Pos = Data.New;
break;
}
case AscDFH.historyitem_Section_Footnote_NumStart:
{
this.FootnotePr.NumStart = Data.New;
break;
}
case AscDFH.historyitem_Section_Footnote_NumRestart:
{
this.FootnotePr.NumRestart = Data.New;
break;
}
case AscDFH.historyitem_Section_Footnote_NumFormat:
{
this.FootnotePr.NumFormat = Data.New;
break;
}
}
},
Refresh_RecalcData : function(Data)
{
// Найдем данную секцию в документе
var Index = this.LogicDocument.SectionsInfo.Find( this );
if ( -1 === Index )
return;
// Здесь есть 1 исключение: когда мы добавляем колонтитул для первой страницы, может так получиться, что
// у данной секции флаг TitlePage = False, а значит пересчет надо запускать с места где данный колонтитул
// первый раз начнет использоваться, а не с текущей секции.
if ( (AscDFH.historyitem_Section_Header_First === Data.Type || AscDFH.historyitem_Section_Footer_First === Data.Type) && false === this.TitlePage )
{
var bHeader = AscDFH.historyitem_Section_Header_First === Data.Type ? true : false
var SectionsCount = this.LogicDocument.SectionsInfo.Get_SectionsCount();
while ( Index < SectionsCount - 1 )
{
Index++;
var TempSectPr = this.LogicDocument.SectionsInfo.Get_SectPr2(Index).SectPr;
// Если в следующей секции свой колонтитул, тогда наш добавленный колонтитул вообще ни на что не влияет
if ( (true === bHeader && null !== TempSectPr.Get_Header_First()) || (true !== bHeader && null !== TempSectPr.Get_Footer_First()) )
break;
// Если в следующей секции есть титульная страница, значит мы нашли нужную секцию
if ( true === TempSectPr.Get_TitlePage() )
{
if ( 0 === Index )
{
this.LogicDocument.Refresh_RecalcData2(0, 0);
}
else
{
var DocIndex = this.LogicDocument.SectionsInfo.Elements[Index - 1].Index + 1;
this.LogicDocument.Refresh_RecalcData2( DocIndex, 0 );
}
}
}
}
else
{
if ( 0 === Index )
{
// Первая секция, значит мы должны пересчитать начиная с самого начала документа
this.LogicDocument.Refresh_RecalcData2(0, 0);
}
else
{
// Ищем номер элемента, на котором закончилась предыдущая секция, начиная со следующего после него элемента
// и пересчитываем документ.
var DocIndex = this.LogicDocument.SectionsInfo.Elements[Index - 1].Index + 1;
this.LogicDocument.Refresh_RecalcData2( DocIndex, 0 );
}
}
// Дополнительно кроме этого мы должны обновить пересчет в колонтитулах, причем только начиная с данной секции
this.LogicDocument.On_SectionChange( this );
},
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
Save_Changes : function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_Section );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_Section_PageSize_Orient:
{
// Byte : Orient
Writer.WriteByte( Data.New );
break;
}
case AscDFH.historyitem_Section_PageSize_Size:
{
// Double : W
// Double : H
Writer.WriteDouble(Data.New.W);
Writer.WriteDouble(Data.New.H);
break;
}
case AscDFH.historyitem_Section_PageMargins:
{
// Double : Left
// Double : Top
// Double : Right
// Double : Bottom
Writer.WriteDouble( Data.New.L );
Writer.WriteDouble( Data.New.T );
Writer.WriteDouble( Data.New.R );
Writer.WriteDouble( Data.New.B );
break;
}
case AscDFH.historyitem_Section_Type:
{
// Byte : Type
Writer.WriteByte( Data.New );
break;
}
case AscDFH.historyitem_Section_Borders_Left:
case AscDFH.historyitem_Section_Borders_Top:
case AscDFH.historyitem_Section_Borders_Right:
case AscDFH.historyitem_Section_Borders_Bottom:
{
// Variable : CDocumentBorder
Data.New.Write_ToBinary( Writer );
break;
}
case AscDFH.historyitem_Section_Borders_Display:
case AscDFH.historyitem_Section_Borders_OffsetFrom:
case AscDFH.historyitem_Section_Borders_ZOrder:
{
// Byte : Value
Writer.WriteByte( Data.New );
break;
}
case AscDFH.historyitem_Section_Header_First:
case AscDFH.historyitem_Section_Header_Even:
case AscDFH.historyitem_Section_Header_Default:
case AscDFH.historyitem_Section_Footer_First:
case AscDFH.historyitem_Section_Footer_Even:
case AscDFH.historyitem_Section_Footer_Default:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( null === Data.New )
Writer.WriteBool( true );
else
{
Writer.WriteBool( false );
Writer.WriteString2( Data.New.Get_Id() );
}
break;
}
case AscDFH.historyitem_Section_TitlePage:
{
// Bool : TitlePage
Writer.WriteBool( Data.New );
break;
}
case AscDFH.historyitem_Section_PageMargins_Header:
case AscDFH.historyitem_Section_PageMargins_Footer:
{
// Double : Header/Footer distance
Writer.WriteDouble( Data.New );
break;
}
case AscDFH.historyitem_Section_PageNumType_Start:
{
// Long : PageNumType.Start
Writer.WriteLong( Data.New );
break;
}
case AscDFH.historyitem_Section_Columns_EqualWidth:
{
// Bool : Equal
Writer.WriteBool( Data.New );
break;
}
case AscDFH.historyitem_Section_Columns_Space:
{
// Double : Space
Writer.WriteDouble( Data.New );
break;
}
case AscDFH.historyitem_Section_Columns_Num:
{
// Long : Num
Writer.WriteLong( Data.New );
break;
}
case AscDFH.historyitem_Section_Columns_Sep:
{
// Bool : Sep
Writer.WriteBool( Data.New );
break;
}
case AscDFH.historyitem_Section_Columns_Col:
{
// Long : Index
// Bool : undefined ?
// false ->
// Variable : CSectionColumn
Writer.WriteLong( Data.Index );
if ( undefined === Data.New )
Writer.WriteBool( true );
else
{
Writer.WriteBool( false );
Data.New.Write_ToBinary( Writer );
}
break;
}
case AscDFH.historyitem_Section_Columns_SetCols:
{
// Long : Count
// Array of variable : array of CSectionColumn
var Count = Data.New.length;
Writer.WriteLong(Count);
for (var Index = 0; Index < Count; ++Index)
{
Data.New[Index].Write_ToBinary(Writer);
}
break;
}
case AscDFH.historyitem_Section_Footnote_Pos:
case AscDFH.historyitem_Section_Footnote_NumStart:
case AscDFH.historyitem_Section_Footnote_NumRestart:
case AscDFH.historyitem_Section_Footnote_NumFormat:
{
// Bool : undefined ?
// false -> Long : value
if (undefined === Data.New)
Writer.WriteBool(true);
else
{
Writer.WriteBool(false);
Writer.WriteLong(Data.New);
}
break;
}
}
},
Load_Changes : function(Reader)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_Section != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case AscDFH.historyitem_Section_PageSize_Orient:
{
// Byte : Orient
this.PageSize.Orient = Reader.GetByte();
break;
}
case AscDFH.historyitem_Section_PageSize_Size:
{
// Double : W
// Double : H
this.PageSize.W = Reader.GetDouble();
this.PageSize.H = Reader.GetDouble();
break;
}
case AscDFH.historyitem_Section_PageMargins:
{
// Double : Left
// Double : Top
// Double : Right
// Double : Bottom
this.PageMargins.Left = Reader.GetDouble();
this.PageMargins.Top = Reader.GetDouble();
this.PageMargins.Right = Reader.GetDouble();
this.PageMargins.Bottom = Reader.GetDouble();
break;
}
case AscDFH.historyitem_Section_Type:
{
// Byte : Type
this.Type = Reader.GetByte();
break;
}
case AscDFH.historyitem_Section_Borders_Left:
{
// Variable : CDocumentBorder
this.Borders.Left.Read_FromBinary(Reader);
break;
}
case AscDFH.historyitem_Section_Borders_Top:
{
// Variable : CDocumentBorder
this.Borders.Top.Read_FromBinary(Reader);
break;
}
case AscDFH.historyitem_Section_Borders_Right:
{
// Variable : CDocumentBorder
this.Borders.Right.Read_FromBinary(Reader);
break;
}
case AscDFH.historyitem_Section_Borders_Bottom:
{
// Variable : CDocumentBorder
this.Borders.Bottom.Read_FromBinary(Reader);
break;
}
case AscDFH.historyitem_Section_Borders_Display:
{
// Byte : Value
this.Borders.Display = Reader.GetByte();
break;
}
case AscDFH.historyitem_Section_Borders_OffsetFrom:
{
// Byte : Value
this.Borders.OffsetFrom = Reader.GetByte();
break;
}
case AscDFH.historyitem_Section_Borders_ZOrder:
{
// Byte : Value
this.Borders.ZOrder = Reader.GetByte();
break;
}
case AscDFH.historyitem_Section_Header_First:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.HeaderFirst = null;
else
this.HeaderFirst = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_Header_Even:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.HeaderEven = null;
else
this.HeaderEven = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_Header_Default:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.HeaderDefault = null;
else
this.HeaderDefault = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_Footer_First:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.FooterFirst = null;
else
this.FooterFirst = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_Footer_Even:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.FooterEven = null;
else
this.FooterEven = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_Footer_Default:
{
// Bool : Is null
// false ->
// String : Id колонтитула
if ( true === Reader.GetBool() )
this.FooterDefault = null;
else
this.FooterDefault = g_oTableId.Get_ById( Reader.GetString2() );
break;
}
case AscDFH.historyitem_Section_TitlePage:
{
// Bool : TitlePage
this.TitlePage = Reader.GetBool();
break;
}
case AscDFH.historyitem_Section_PageMargins_Header:
{
// Double : Header distance
this.PageMargins.Header = Reader.GetDouble();
break;
}
case AscDFH.historyitem_Section_PageMargins_Footer:
{
// Double : Footer distance
this.PageMargins.Footer = Reader.GetDouble();
break;
}
case AscDFH.historyitem_Section_PageNumType_Start:
{
// Long : PageNumType.Start
this.PageNumType.Start = Reader.GetLong();
break;
}
case AscDFH.historyitem_Section_Columns_EqualWidth:
{
// Bool : Equal
this.Columns.EqualWidth = Reader.GetBool();
break;
}
case AscDFH.historyitem_Section_Columns_Space:
{
// Double : Space
this.Columns.Space = Reader.GetDouble();
break;
}
case AscDFH.historyitem_Section_Columns_Num:
{
// Long : Num
this.Columns.Num = Reader.GetLong();
break;
}
case AscDFH.historyitem_Section_Columns_Sep:
{
// Bool : Sep
this.Columns.Sep = Reader.GetBool();
break;
}
case AscDFH.historyitem_Section_Columns_Col:
{
// Long : Index
// Bool : undefined ?
// false ->
// Variable : CSectionColumn
var Index = Reader.GetLong();
if ( true === Reader.GetBool() )
this.Columns.Cols[Index] = undefined;
else
{
this.Columns.Cols[Index] = new CSectionColumn();
this.Columns.Cols[Index].Read_FromBinary( Reader );
}
break;
}
case AscDFH.historyitem_Section_Columns_SetCols:
{
// Long : Count
// Array of variable : array of CSectionColumn
var Count = Reader.GetLong();
this.Columns.Cols = [];
for (var Index = 0; Index < Count; ++Index)
{
this.Columns.Cols[Index] = new CSectionColumn();
this.Columns.Cols[Index].Read_FromBinary(Reader);
}
break;
}
case AscDFH.historyitem_Section_Footnote_Pos:
{
// Bool : undefined ?
// false -> Long : value
if (true === Reader.GetBool())
this.FootnotePr.Pos = undefined;
else
this.FootnotePr.Pos = Reader.GetLong();
break;
}
case AscDFH.historyitem_Section_Footnote_NumStart:
{
// Bool : undefined ?
// false -> Long : value
if (true === Reader.GetBool())
this.FootnotePr.NumStart = undefined;
else
this.FootnotePr.NumStart = Reader.GetLong();
break;
}
case AscDFH.historyitem_Section_Footnote_NumRestart:
{
// Bool : undefined ?
// false -> Long : value
if (true === Reader.GetBool())
this.FootnotePr.NumRestart = undefined;
else
this.FootnotePr.NumRestart = Reader.GetLong();
break;
}
case AscDFH.historyitem_Section_Footnote_NumFormat:
{
// Bool : undefined ?
// false -> Long : value
if (true === Reader.GetBool())
this.FootnotePr.NumFormat = undefined;
else
this.FootnotePr.NumFormat = Reader.GetLong();
break;
}
}
},
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong( AscDFH.historyitem_type_Section );
// String2 : Id
// String2 : Id LogicDocument
// Variable : PageSize
// Variable : PageMargins
// Byte : Type
// Variable : Borders
// Колонтитулы не пишем в бинарник, при созданиии класса они всегда null, а TitlePage = false
// Variable : PageNumType
// Variable : CSectionColumns
// Variable : CFootnotePr
Writer.WriteString2( "" + this.Id );
Writer.WriteString2( "" + this.LogicDocument.Get_Id() );
this.PageSize.Write_ToBinary( Writer );
this.PageMargins.Write_ToBinary( Writer );
Writer.WriteByte( this.Type );
this.Borders.Write_ToBinary( Writer );
this.PageNumType.Write_ToBinary( Writer );
this.Columns.Write_ToBinary(Writer);
this.FootnotePr.WriteToBinary(Writer);
},
Read_FromBinary2 : function(Reader)
{
// String2 : Id
// String2 : Id LogicDocument
// Variable : PageSize
// Variable : PageMargins
// Byte : Type
// Variable : Borders
// Колонтитулы не пишем в бинарник, при созданиии класса они всегда null, а TitlePage = false
// Variable : PageNumType
// Variable : CSectionColumns
// Variable : CFootnotePr
this.Id = Reader.GetString2();
this.LogicDocument = g_oTableId.Get_ById( Reader.GetString2() );
this.PageSize.Read_FromBinary( Reader );
this.PageMargins.Read_FromBinary( Reader );
this.Type = Reader.GetByte();
this.Borders.Read_FromBinary( Reader );
this.PageNumType.Read_FromBinary( Reader );
this.Columns.Read_FromBinary(Reader);
this.FootnotePr.ReadFromBinary(Reader);
}
};
CSectionPr.prototype.GetFootnotePr = function()
{
return this.FootnotePr;
};
CSectionPr.prototype.SetFootnotePos = function(nPos)
{
if (this.FootnotePr.Pos !== nPos)
{
History.Add(this, {
Type : AscDFH.historyitem_Section_Footnote_Pos,
Old : this.FootnotePr.Pos,
New : nPos
});
this.FootnotePr.Pos = nPos;
}
};
CSectionPr.prototype.GetFootnotePos = function()
{
if (undefined === this.FootnotePr.Pos)
return section_footnote_PosPageBottom;
return this.FootnotePr.Pos;
};
CSectionPr.prototype.SetFootnoteNumStart = function(nStart)
{
if (this.FootnotePr.NumStart !== nStart)
{
History.Add(this, {
Type : AscDFH.historyitem_Section_Footnote_NumStart,
Old : this.FootnotePr.NumStart,
New : nStart
});
this.FootnotePr.NumStart = nStart;
}
};
CSectionPr.prototype.GetFootnoteNumStart = function()
{
if (undefined === this.FootnotePr.NumStart)
return 1;
return this.FootnotePr.NumStart;
};
CSectionPr.prototype.SetFootnoteNumRestart = function(nRestartType)
{
if (this.FootnotePr.NumRestart !== nRestartType)
{
History.Add(this, {
Type : AscDFH.historyitem_Section_Footnote_NumRestart,
Old : this.FootnotePr.NumRestart,
New : nRestartType
});
this.FootnotePr.NumRestart = nRestartType;
}
};
CSectionPr.prototype.GetFootnoteNumRestart = function()
{
if (undefined === this.FootnotePr.NumRestart)
return this.private_GetDocumentWideFootnotePr().NumRestart;
return this.FootnotePr.NumRestart;
};
CSectionPr.prototype.SetFootnoteNumFormat = function(nFormatType)
{
if (this.FootnotePr.NumFormat !== nFormatType)
{
History.Add(this, {
Type : AscDFH.historyitem_Section_Footnote_NumFormat,
Old : this.FootnotePr.NumFormat,
New : nFormatType
});
History.Add(new CChangesSectionFootnoteNumFormat(this, this.FootnotePr.NumFormat, nFormatType));
this.FootnotePr.NumFormat = nFormatType;
}
};
......
/*
* (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: 10.11.2016
* Time: 14:24
*/
AscDFH.changesFactory[AscDFH.historyitem_Section_PageSize_Orient] = CChangesSectionPageOrient;
AscDFH.changesFactory[AscDFH.historyitem_Section_PageSize_Size] = CChangesSectionPageSize;
AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins] = CChangesSectionPageMargins;
AscDFH.changesFactory[AscDFH.historyitem_Section_Type] = CChangesSectionType;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Left] = CChangesSectionBordersLeft;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Top] = CChangesSectionBordersTop;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Right] = CChangesSectionBordersRight;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Bottom] = CChangesSectionBordersBottom;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Display] = CChangesSectionBordersDisplay;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_OffsetFrom] = CChangesSectionBordersOffsetFrom;
AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_ZOrder] = CChangesSectionBordersZOrder;
AscDFH.changesFactory[AscDFH.historyitem_Section_Header_First] = CChangesSectionHeaderFirst;
AscDFH.changesFactory[AscDFH.historyitem_Section_Header_Even] = CChangesSectionHeaderEven;
AscDFH.changesFactory[AscDFH.historyitem_Section_Header_Default] = CChangesSectionHeaderDefault;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_First] = CChangesSectionFooterFirst;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_Even] = CChangesSectionFooterEven;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_Default] = CChangesSectionFooterDefault;
AscDFH.changesFactory[AscDFH.historyitem_Section_TitlePage] = CChangesSectionTitlePage;
AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins_Header] = CChangesSectionPageMarginsHeader;
AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins_Footer] = CChangesSectionPageMarginsFooter;
AscDFH.changesFactory[AscDFH.historyitem_Section_PageNumType_Start] = CChangesSectionPageNumTypeStart;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_EqualWidth] = CChangesSectionColumnsEqualWidth;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Space] = CChangesSectionColumnsSpace;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Num] = CChangesSectionColumnsNum;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Sep] = CChangesSectionColumnsSep;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Col] = CChangesSectionColumnsCol;
AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_SetCols] = CChangesSectionColumnsSetCols;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_Pos] = CChangesSectionFootnotePos;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumStart] = CChangesSectionFootnoteNumStart;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumRestart] = CChangesSectionFootnoteNumRestart;
AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumFormat] = CChangesSectionFootnoteNumFormat;
/**
* Базовый класс для изменения колонтитулов
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesSectionBaseHeaderFooter(Class, Old, New)
{
CChangesSectionBaseHeaderFooter.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBaseHeaderFooter, AscDFH.CChangesBaseProperty);
CChangesSectionBaseHeaderFooter.prototype.WriteToBinary = function(Writer)
{
// Long : Flags
// 1bit : is New null?
// 2bit : is Old null?
// 1bit == 0: String : New id
// 2bit == 0: String : Old id
var nFlags = 0;
if (null === this.New)
nFlags |= 1;
if (null === this.Old)
nFlags |= 2;
Writer.WriteLong(nFlags);
if (null !== this.New)
Writer.WriteString2(this.New.Get_Id());
if (null !== this.Old)
Writer.WriteString2(this.Old.Get_Id());
};
CChangesSectionBaseHeaderFooter.prototype.ReadFromBinary = function(Reader)
{
// Long : Flags
// 1bit : is New null?
// 2bit : is Old null?
// 1bit == 0: String : New id
// 2bit == 0: String : Old id
var nFlags = Reader.GetLong();
if (nFlags & 1)
this.New = null;
else
this.New = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
if (nFlags & 2)
this.Old = null;
else
this.Old = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseByteValue}
*/
function CChangesSectionPageOrient(Class, Old, New)
{
CChangesSectionPageOrient.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageOrient, AscDFH.CChangesBaseByteValue);
CChangesSectionPageOrient.prototype.Type = AscDFH.historyitem_Section_PageSize_Orient;
CChangesSectionPageOrient.prototype.private_SetValue = function(Value)
{
this.Class.PageSize.Orient = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesSectionPageSize(Class, Old, New)
{
CChangesSectionPageSize.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageSize, AscDFH.CChangesBaseProperty);
CChangesSectionPageSize.prototype.Type = AscDFH.historyitem_Section_PageSize_Size;
CChangesSectionPageSize.prototype.private_SetValue = function(Value)
{
this.Class.PageSize.W = Value.W;
this.Class.PageSize.H = Value.H;
};
CChangesSectionPageSize.prototype.WriteToBinary = function(Writer)
{
// Double : New.W
// Double : New.H
// Double : Old.W
// Double : Old.H
Writer.WriteDouble(this.New.W);
Writer.WriteDouble(this.New.H);
Writer.WriteDouble(this.Old.W);
Writer.WriteDouble(this.Old.H);
};
CChangesSectionPageSize.prototype.ReadFromBinary = function(Reader)
{
// Double : New.W
// Double : New.H
// Double : Old.W
// Double : Old.H
this.New = {
W : Reader.GetDouble(),
H : Reader.GetDouble()
};
this.Old = {
W : Reader.GetDouble(),
H : Reader.GetDouble()
};
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesSectionPageMargins(Class, Old, New)
{
CChangesSectionPageMargins.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageMargins, AscDFH.CChangesBaseProperty);
CChangesSectionPageMargins.prototype.Type = AscDFH.historyitem_Section_PageMargins;
CChangesSectionPageMargins.prototype.private_SetValue = function(Value)
{
this.Class.PageMargins.Left = Value.L;
this.Class.PageMargins.Top = Value.T;
this.Class.PageMargins.Right = Value.R;
this.Class.PageMargins.Bottom = Value.B;
};
CChangesSectionPageMargins.prototype.WriteToBinary = function(Writer)
{
// Double : New.L
// Double : New.T
// Double : New.R
// Double : New.B
// Double : Old.L
// Double : Old.T
// Double : Old.R
// Double : Old.B
Writer.WriteDouble(this.New.L);
Writer.WriteDouble(this.New.T);
Writer.WriteDouble(this.New.R);
Writer.WriteDouble(this.New.B);
Writer.WriteDouble(this.Old.L);
Writer.WriteDouble(this.Old.T);
Writer.WriteDouble(this.Old.R);
Writer.WriteDouble(this.Old.B);
};
CChangesSectionPageMargins.prototype.ReadFromBinary = function(Reader)
{
// Double : New.L
// Double : New.T
// Double : New.R
// Double : New.B
// Double : Old.L
// Double : Old.T
// Double : Old.R
// Double : Old.B
this.New = {
L : Reader.GetDouble(),
T : Reader.GetDouble(),
R : Reader.GetDouble(),
B : Reader.GetDouble()
};
this.Old = {
L : Reader.GetDouble(),
T : Reader.GetDouble(),
R : Reader.GetDouble(),
B : Reader.GetDouble()
};
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseByteValue}
*/
function CChangesSectionType(Class, Old, New)
{
CChangesSectionType.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionType, AscDFH.CChangesBaseByteValue);
CChangesSectionType.prototype.Type = AscDFH.historyitem_Section_Type;
CChangesSectionType.prototype.private_SetValue = function(Value)
{
this.Class.Type = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
*/
function CChangesSectionBordersLeft(Class, Old, New)
{
CChangesSectionBordersLeft.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersLeft, AscDFH.CChangesBaseObjectValue);
CChangesSectionBordersLeft.prototype.Type = AscDFH.historyitem_Section_Borders_Left;
CChangesSectionBordersLeft.prototype.private_CreateObject = function()
{
return new CDocumentBorder();
};
CChangesSectionBordersLeft.prototype.private_SetValue = function(Value)
{
this.Class.Borders.Left = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
*/
function CChangesSectionBordersTop(Class, Old, New)
{
CChangesSectionBordersTop.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersTop, AscDFH.CChangesBaseObjectValue);
CChangesSectionBordersTop.prototype.Type = AscDFH.historyitem_Section_Borders_Top;
CChangesSectionBordersTop.prototype.private_CreateObject = function()
{
return new CDocumentBorder();
};
CChangesSectionBordersTop.prototype.private_SetValue = function(Value)
{
this.Class.Borders.Top = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
*/
function CChangesSectionBordersRight(Class, Old, New)
{
CChangesSectionBordersRight.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersRight, AscDFH.CChangesBaseObjectValue);
CChangesSectionBordersRight.prototype.Type = AscDFH.historyitem_Section_Borders_Right;
CChangesSectionBordersRight.prototype.private_CreateObject = function()
{
return new CDocumentBorder();
};
CChangesSectionBordersRight.prototype.private_SetValue = function(Value)
{
this.Class.Borders.Right = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseObjectValue}
*/
function CChangesSectionBordersBottom(Class, Old, New)
{
CChangesSectionBordersBottom.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersBottom, AscDFH.CChangesBaseObjectValue);
CChangesSectionBordersBottom.prototype.Type = AscDFH.historyitem_Section_Borders_Bottom;
CChangesSectionBordersBottom.prototype.private_CreateObject = function()
{
return new CDocumentBorder();
};
CChangesSectionBordersBottom.prototype.private_SetValue = function(Value)
{
this.Class.Borders.Bottom = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseByteValue}
*/
function CChangesSectionBordersDisplay(Class, Old, New)
{
CChangesSectionBordersDisplay.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersDisplay, AscDFH.CChangesBaseByteValue);
CChangesSectionBordersDisplay.prototype.Type = AscDFH.historyitem_Section_Borders_Display;
CChangesSectionBordersDisplay.prototype.private_SetValue = function(Value)
{
this.Class.Borders.Display = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseByteValue}
*/
function CChangesSectionBordersOffsetFrom(Class, Old, New)
{
CChangesSectionBordersOffsetFrom.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersOffsetFrom, AscDFH.CChangesBaseByteValue);
CChangesSectionBordersOffsetFrom.prototype.Type = AscDFH.historyitem_Section_Borders_OffsetFrom;
CChangesSectionBordersOffsetFrom.prototype.private_SetValue = function(Value)
{
this.Class.Borders.OffsetFrom = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseByteValue}
*/
function CChangesSectionBordersZOrder(Class, Old, New)
{
CChangesSectionBordersZOrder.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionBordersZOrder, AscDFH.CChangesBaseByteValue);
CChangesSectionBordersZOrder.prototype.Type = AscDFH.historyitem_Section_Borders_ZOrder;
CChangesSectionBordersZOrder.prototype.private_SetValue = function(Value)
{
this.Class.Borders.ZOrder = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionHeaderFirst(Class, Old, New)
{
CChangesSectionHeaderFirst.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionHeaderFirst, CChangesSectionBaseHeaderFooter);
CChangesSectionHeaderFirst.prototype.Type = AscDFH.historyitem_Section_Header_First;
CChangesSectionHeaderFirst.prototype.private_SetValue = function(Value)
{
this.Class.HeaderFirst = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionHeaderEven(Class, Old, New)
{
CChangesSectionHeaderEven.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionHeaderEven, CChangesSectionBaseHeaderFooter);
CChangesSectionHeaderEven.prototype.Type = AscDFH.historyitem_Section_Header_Even;
CChangesSectionHeaderEven.prototype.private_SetValue = function(Value)
{
this.Class.HeaderEven = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionHeaderDefault(Class, Old, New)
{
CChangesSectionHeaderDefault.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionHeaderDefault, CChangesSectionBaseHeaderFooter);
CChangesSectionHeaderDefault.prototype.Type = AscDFH.historyitem_Section_Header_Default;
CChangesSectionHeaderDefault.prototype.private_SetValue = function(Value)
{
this.Class.HeaderDefault = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionFooterFirst(Class, Old, New)
{
CChangesSectionFooterFirst.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFooterFirst, CChangesSectionBaseHeaderFooter);
CChangesSectionFooterFirst.prototype.Type = AscDFH.historyitem_Section_Footer_First;
CChangesSectionFooterFirst.prototype.private_SetValue = function(Value)
{
this.Class.FooterFirst = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionFooterEven(Class, Old, New)
{
CChangesSectionFooterEven.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFooterEven, CChangesSectionBaseHeaderFooter);
CChangesSectionFooterEven.prototype.Type = AscDFH.historyitem_Section_Footer_Even;
CChangesSectionFooterEven.prototype.private_SetValue = function(Value)
{
this.Class.FooterEven = Value;
};
/**
* @constructor
* @extends {CChangesSectionBaseHeaderFooter}
*/
function CChangesSectionFooterDefault(Class, Old, New)
{
CChangesSectionFooterDefault.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFooterDefault, CChangesSectionBaseHeaderFooter);
CChangesSectionFooterDefault.prototype.Type = AscDFH.historyitem_Section_Footer_Default;
CChangesSectionFooterDefault.prototype.private_SetValue = function(Value)
{
this.Class.FooterDefault = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseBoolValue}
*/
function CChangesSectionTitlePage(Class, Old, New)
{
CChangesSectionTitlePage.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionTitlePage, AscDFH.CChangesBaseBoolValue);
CChangesSectionTitlePage.prototype.Type = AscDFH.historyitem_Section_TitlePage;
CChangesSectionTitlePage.prototype.private_SetValue = function(Value)
{
this.Class.TitlePage = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseDoubleValue}
*/
function CChangesSectionPageMarginsHeader(Class, Old, New)
{
CChangesSectionPageMarginsHeader.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageMarginsHeader, AscDFH.CChangesBaseDoubleValue);
CChangesSectionPageMarginsHeader.prototype.Type = AscDFH.historyitem_Section_PageMargins_Header;
CChangesSectionPageMarginsHeader.prototype.private_SetValue = function(Value)
{
this.Class.PageMargins.Header = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseDoubleValue}
*/
function CChangesSectionPageMarginsFooter(Class, Old, New)
{
CChangesSectionPageMarginsFooter.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageMarginsFooter, AscDFH.CChangesBaseDoubleValue);
CChangesSectionPageMarginsFooter.prototype.Type = AscDFH.historyitem_Section_PageMargins_Footer;
CChangesSectionPageMarginsFooter.prototype.private_SetValue = function(Value)
{
this.Class.PageMargins.Footer = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongValue}
*/
function CChangesSectionPageNumTypeStart(Class, Old, New)
{
CChangesSectionPageNumTypeStart.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionPageNumTypeStart, AscDFH.CChangesBaseLongValue);
CChangesSectionPageNumTypeStart.prototype.Type = AscDFH.historyitem_Section_PageNumType_Start;
CChangesSectionPageNumTypeStart.prototype.private_SetValue = function(Value)
{
this.Class.PageNumType.Start = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongValue}
*/
function CChangesSectionColumnsEqualWidth(Class, Old, New)
{
CChangesSectionColumnsEqualWidth.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionColumnsEqualWidth, AscDFH.CChangesBaseLongValue);
CChangesSectionColumnsEqualWidth.prototype.Type = AscDFH.historyitem_Section_Columns_EqualWidth;
CChangesSectionColumnsEqualWidth.prototype.private_SetValue = function(Value)
{
this.Class.Columns.EqualWidth = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseDoubleValue}
*/
function CChangesSectionColumnsSpace(Class, Old, New)
{
CChangesSectionColumnsSpace.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionColumnsSpace, AscDFH.CChangesBaseDoubleValue);
CChangesSectionColumnsSpace.prototype.Type = AscDFH.historyitem_Section_Columns_Space;
CChangesSectionColumnsSpace.prototype.private_SetValue = function(Value)
{
this.Class.Columns.Space = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongValue}
*/
function CChangesSectionColumnsNum(Class, Old, New)
{
CChangesSectionColumnsNum.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionColumnsNum, AscDFH.CChangesBaseLongValue);
CChangesSectionColumnsNum.prototype.Type = AscDFH.historyitem_Section_Columns_Num;
CChangesSectionColumnsNum.prototype.private_SetValue = function(Value)
{
this.Class.Columns.Num = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseBoolValue}
*/
function CChangesSectionColumnsSep(Class, Old, New)
{
CChangesSectionColumnsSep.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionColumnsSep, AscDFH.CChangesBaseBoolValue);
CChangesSectionColumnsSep.prototype.Type = AscDFH.historyitem_Section_Columns_Sep;
CChangesSectionColumnsSep.prototype.private_SetValue = function(Value)
{
this.Class.Columns.Sep = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesSectionColumnsCol(Class, Old, New, Index)
{
CChangesSectionColumnsCol.superclass.constructor.call(this, Class, Old, New);
this.Index = Index;
}
AscCommon.extendClass(CChangesSectionColumnsCol, AscDFH.CChangesBaseProperty);
CChangesSectionColumnsCol.prototype.Type = AscDFH.historyitem_Section_Columns_Col;
CChangesSectionColumnsCol.prototype.private_SetValue = function(Value)
{
this.Class.Columns.Cols[this.Index] = Value;
};
CChangesSectionColumnsCol.prototype.WriteToBinary = function(Writer)
{
// Long : ColumnIndex
// Long : flags
// 1bit : is new undefined?
// 2bit : is old undefined?
// 1bit == 0 : CSectionColumn : New
// 2bit == 0 : CSectionColumn : Old
Writer.WriteLong(this.Index);
var nFlags = 0;
if (undefined === this.New)
nFlags |= 1;
if (undefined === this.Old)
nFlags |= 2;
Writer.WriteLong(nFlags);
if (undefined !== this.New)
this.New.Write_ToBinary(Writer);
if (undefined !== this.Old)
this.Old.Write_ToBinary(Writer);
};
CChangesSectionColumnsCol.prototype.ReadFromBinary = function(Reader)
{
// Long : ColumnIndex
// Long : flags
// 1bit : is new undefined?
// 2bit : is old undefined?
// 1bit == 0 : CSectionColumn : New
// 2bit == 0 : CSectionColumn : Old
this.Index = Reader.GetLong();
var nFlags = Reader.GetLong();
if (nFlags & 1)
{
this.New = undefined;
}
else
{
this.New = new CSectionColumn();
this.New.Read_FromBinary(Reader);
}
if (nFlags & 2)
{
this.Old = undefined;
}
else
{
this.Old = new CSectionColumn();
this.Old.Read_FromBinary(Reader);
}
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseProperty}
*/
function CChangesSectionColumnsSetCols(Class, Old, New)
{
CChangesSectionColumnsSetCols.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionColumnsSetCols, AscDFH.CChangesBaseProperty);
CChangesSectionColumnsSetCols.prototype.Type = AscDFH.historyitem_Section_Columns_SetCols;
CChangesSectionColumnsSetCols.prototype.private_SetValue = function(Value)
{
this.Class.Columns.Cols = Value;
};
CChangesSectionColumnsSetCols.prototype.WriteToBinary = function(Writer)
{
// Long : Count of new column
// Array of CSectionColumn: new columns
// Long : Count of old column
// Array of CSectionColumn: old columns
var nCount = this.New.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.New[nIndex].Write_ToBinary(Writer);
}
nCount = this.Old.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.Old[nIndex].Write_ToBinary(Writer);
}
};
CChangesSectionColumnsSetCols.prototype.ReadFromBinary = function(Reader)
{
// Long : Count of new column
// Array of CSectionColumn: new columns
// Long : Count of old column
// Array of CSectionColumn: old columns
var nCount = Reader.GetLong();
this.New = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.New[nIndex] = new CSectionColumn();
this.New[nIndex].Read_FromBinary(Reader);
}
nCount = Reader.GetLong();
this.Old = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.Old[nIndex] = new CSectionColumn();
this.Old[nIndex].Read_FromBinary(Reader);
}
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
*/
function CChangesSectionFootnotePos(Class, Old, New)
{
CChangesSectionFootnotePos.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFootnotePos, AscDFH.CChangesBaseLongProperty);
CChangesSectionFootnotePos.prototype.Type = AscDFH.historyitem_Section_Footnote_Pos;
CChangesSectionFootnotePos.prototype.private_SetValue = function(Value)
{
this.Class.FootnotePr.Pos = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
*/
function CChangesSectionFootnoteNumStart(Class, Old, New)
{
CChangesSectionFootnoteNumStart.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFootnoteNumStart, AscDFH.CChangesBaseLongProperty);
CChangesSectionFootnoteNumStart.prototype.Type = AscDFH.historyitem_Section_Footnote_NumStart;
CChangesSectionFootnoteNumStart.prototype.private_SetValue = function(Value)
{
this.Class.FootnotePr.NumStart = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
*/
function CChangesSectionFootnoteNumRestart(Class, Old, New)
{
CChangesSectionFootnoteNumRestart.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFootnoteNumRestart, AscDFH.CChangesBaseLongProperty);
CChangesSectionFootnoteNumRestart.prototype.Type = AscDFH.historyitem_Section_Footnote_NumRestart;
CChangesSectionFootnoteNumRestart.prototype.private_SetValue = function(Value)
{
this.Class.FootnotePr.NumRestart = Value;
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
*/
function CChangesSectionFootnoteNumFormat(Class, Old, New)
{
CChangesSectionFootnoteNumFormat.superclass.constructor.call(this, Class, Old, New);
}
AscCommon.extendClass(CChangesSectionFootnoteNumFormat, AscDFH.CChangesBaseLongProperty);
CChangesSectionFootnoteNumFormat.prototype.Type = AscDFH.historyitem_Section_Footnote_NumFormat;
CChangesSectionFootnoteNumFormat.prototype.private_SetValue = function(Value)
{
this.Class.FootnotePr.NumFormat = Value;
};
\ 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