Commit 58a727a4 authored by Ilya Kirillov's avatar Ilya Kirillov

Functions for work with Parent, Next, Prev, Index were moved to a base class.

parent 7d98cda8
......@@ -42,6 +42,53 @@
* Базовый класс для элементов содержимого документа (Paragraph, CTable, CBlockLevelSdt)
* @constructor
*/
function CDocumentContentElementBase()
function CDocumentContentElementBase(oParent)
{
}
\ No newline at end of file
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.Parent = oParent;
this.Prev = null;
this.Next = null;
this.Index = -1; // перед тем как пользоваться этим параметром нужно у родительского класса вызывать this.Parent.Update_ContentIndexing();
}
CDocumentContentElementBase.prototype.Is_Inline = function()
{
return true;
};
CDocumentContentElementBase.prototype.Set_DocumentIndex = function(nIndex)
{
this.Index = nIndex;
};
CDocumentContentElementBase.prototype.Set_DocumentNext = function(oElement)
{
this.Next = oElement;
};
CDocumentContentElementBase.prototype.Set_DocumentPrev = function(oElement)
{
this.Prev = oElement;
};
CDocumentContentElementBase.prototype.Get_DocumentNext = function()
{
return this.Next;
};
CDocumentContentElementBase.prototype.Get_DocumentPrev = function()
{
return this.Prev;
};
CDocumentContentElementBase.prototype.Set_Parent = function(oParent)
{
this.Parent = oParent;
};
CDocumentContentElementBase.prototype.Get_Parent = function()
{
return this.Parent;
};
CDocumentContentElementBase.prototype.GetId = function()
{
return this.Id;
};
CDocumentContentElementBase.prototype.Get_Id = function()
{
return this.GetId();
};
\ No newline at end of file
......@@ -68,16 +68,8 @@ var REVIEW_COLOR = new AscCommon.CColor(255, 0, 0, 255);
*/
function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit, bFromPresentation)
{
CDocumentContentElementBase.call(this);
CDocumentContentElementBase.call(this, Parent);
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.Prev = null;
this.Next = null;
this.Index = -1; // перед тем как пользоваться этим параметром нужно у родительского класса вызывать this.Parent.Update_ContentIndexing();
this.Parent = Parent;
this.PageNum = PageNum;
this.ColumnNum = 0;
this.ColumnsCount = 1;
......@@ -239,14 +231,6 @@ Paragraph.prototype.Save_StartState = function()
{
this.StartState = new CParagraphStartState(this);
};
Paragraph.prototype.GetId = function()
{
return this.Id;
};
Paragraph.prototype.Get_Id = function()
{
return this.GetId();
};
Paragraph.prototype.Use_Wrap = function()
{
if (true !== this.Is_Inline())
......@@ -9096,34 +9080,6 @@ Paragraph.prototype.Get_AnchorPos = function(Drawing)
return Result;
};
Paragraph.prototype.Set_DocumentNext = function(Object)
{
this.Next = Object;
};
Paragraph.prototype.Set_DocumentPrev = function(Object)
{
this.Prev = Object;
};
Paragraph.prototype.Get_DocumentNext = function()
{
return this.Next;
};
Paragraph.prototype.Get_DocumentPrev = function()
{
return this.Prev;
};
Paragraph.prototype.Set_DocumentIndex = function(Index)
{
this.Index = Index;
};
Paragraph.prototype.Set_Parent = function(ParentObject)
{
this.Parent = ParentObject;
};
Paragraph.prototype.Get_Parent = function()
{
return this.Parent;
};
Paragraph.prototype.Is_ContentOnFirstPage = function()
{
// Если параграф сразу переносится на новую страницу, тогда это значение обычно -1
......
......@@ -38,18 +38,17 @@
*/
/**
*
* @param oLogicDocument
* @param oParent - родительский класс
* @param oLogicDocument - главный класс документа
* @constructor
* @extends {CDocumentContentElementBase}
*/
function CBlockLevelSdt(oLogicDocument)
function CBlockLevelSdt(oLogicDocument, oParent)
{
CDocumentContentElementBase.call(this);
CDocumentContentElementBase.call(this, oParent);
this.LogicDocument = oLogicDocument;
this.Content = new CDocumentContent(this, oLogicDocument.Get_DrawingDocument(), 0, 0, 0, 0, true, false, false);
this.Index = -1;
this.X = 0;
this.Y = 0;
......@@ -58,6 +57,9 @@ function CBlockLevelSdt(oLogicDocument)
this.PageNum = 0;
this.ColumnNum = 0;
this.ColumnsCount = 0;
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add(this, this.Id);
}
CBlockLevelSdt.prototype = Object.create(CDocumentContentElementBase.prototype);
......@@ -67,10 +69,6 @@ CBlockLevelSdt.prototype.Is_Inline = function()
{
return true;
};
CBlockLevelSdt.prototype.Set_DocumentIndex = function(nIndex)
{
this.Index = nIndex;
};
CBlockLevelSdt.prototype.Reset = function(X, Y, XLimit, YLimit, PageAbs, ColumnAbs, ColumnsCount)
{
this.Content.Reset(X, Y, XLimit, YLimit);
......
......@@ -82,16 +82,10 @@ var type_Table = 0x0002;
//----------------------------------------------------------------------------------------------------------------------
function CTable(DrawingDocument, Parent, Inline, PageNum, X, Y, XLimit, YLimit, Rows, Cols, TableGrid, bPresentation)
{
CDocumentContentElementBase.call(this);
this.Id = AscCommon.g_oIdCounter.Get_NewId();
CDocumentContentElementBase.call(this, Parent);
this.Markup = new AscCommon.CTableMarkup(this);
this.Prev = null;
this.Next = null;
this.Index = -1; // перед тем как пользоваться этим параметром нужно у родительского класса вызывать this.Parent.Update_ContentIndexing();
this.Inline = Inline;
this.Lock = new AscCommon.CLock();
......@@ -112,7 +106,6 @@ function CTable(DrawingDocument, Parent, Inline, PageNum, X, Y, XLimit, YLimit,
this.LogicDocument = this.DrawingDocument.m_oLogicDocument;
}
this.Parent = Parent;
this.PageNum = PageNum;
this.ColumnNum = 0;
this.ColumnsCount = 1;
......@@ -2284,26 +2277,6 @@ CTable.prototype.Get_MaxTopBorder = function(RowIndex)
return MaxTopBorder;
};
CTable.prototype.Set_DocumentNext = function(Object)
{
this.Next = Object;
};
CTable.prototype.Set_DocumentPrev = function(Object)
{
this.Prev = Object;
};
CTable.prototype.Get_DocumentNext = function()
{
return this.Next;
};
CTable.prototype.Get_DocumentPrev = function()
{
return this.Prev;
};
CTable.prototype.Set_DocumentIndex = function(Index)
{
this.Index = Index;
};
/**
* Вычисляем небольшое смещение по X, необходимое для совместимости с Word разных версий
*/
......@@ -2477,10 +2450,6 @@ CTable.prototype.GetType = function()
{
return type_Table;
};
CTable.prototype.GetId = function()
{
return this.Get_Id();
};
CTable.prototype.Get_Type = function()
{
return type_Table;
......@@ -3064,18 +3033,6 @@ CTable.prototype.Get_NearestPos = function(CurPage, X, Y, bAnchor, Drawing)
return Cell.Content_Get_NearestPos(CurPage - Cell.Content.Get_StartPage_Relative(), X, Y, bAnchor, Drawing);
};
CTable.prototype.Set_Parent = function(ParentObject)
{
this.Parent = ParentObject;
};
CTable.prototype.Get_Parent = function()
{
return this.Parent;
};
CTable.prototype.Get_Id = function()
{
return this.Id;
};
CTable.prototype.Get_ParentTextTransform = function()
{
return this.Parent.Get_ParentTextTransform();
......
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