Commit 850b224e authored by Ilya Kirillov's avatar Ilya Kirillov

Functions for work with page numbers of paragraph/table were moved in the base class.

parent ab6b6ada
......@@ -142,6 +142,53 @@ CDocumentContentElementBase.prototype.Write_ToBinary2 = function(Writer)
CDocumentContentElementBase.prototype.Read_FromBinary2 = function(Reader)
{
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
CDocumentContentElementBase.prototype.Get_StartPage_Absolute = function()
{
return this.Get_AbsolutePage(0);
};
CDocumentContentElementBase.prototype.Get_StartPage_Relative = function()
{
return this.PageNum;
};
CDocumentContentElementBase.prototype.Get_StartColumn = function()
{
return this.ColumnNum;
};
CDocumentContentElementBase.prototype.Get_ColumnsCount = function()
{
return this.ColumnsCount;
};
CDocumentContentElementBase.prototype.private_GetRelativePageIndex = function(CurPage)
{
if (!this.ColumnsCount || 0 === this.ColumnsCount)
return this.PageNum + CurPage;
return this.PageNum + ((this.ColumnNum + CurPage) / this.ColumnsCount | 0);
};
CDocumentContentElementBase.prototype.private_GetAbsolutePageIndex = function(CurPage)
{
return this.Parent.Get_AbsolutePage(this.private_GetRelativePageIndex(CurPage));
};
CDocumentContentElementBase.prototype.Get_AbsolutePage = function(CurPage)
{
return this.private_GetAbsolutePageIndex(CurPage);
};
CDocumentContentElementBase.prototype.Get_AbsoluteColumn = function(CurPage)
{
if (this.Parent instanceof CDocument)
return this.private_GetColumnIndex(CurPage);
return this.Parent.Get_AbsoluteColumn(this.private_GetRelativePageIndex(CurPage));
};
CDocumentContentElementBase.prototype.private_GetColumnIndex = function(CurPage)
{
return (this.ColumnNum + CurPage) - (((this.ColumnNum + CurPage) / this.ColumnsCount | 0) * this.ColumnsCount);
};
//----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
......
......@@ -7096,9 +7096,6 @@ Paragraph.prototype.Selection_IsEmpty = function(bCheckHidden)
return true;
};
//-----------------------------------------------------------------------------------
// Функции для работы с нумерацией параграфов в документах
//-----------------------------------------------------------------------------------
Paragraph.prototype.Get_StartTabsCount = function(TabsCounter)
{
var ContentLen = this.Content.length;
......@@ -9441,25 +9438,6 @@ Paragraph.prototype.PreDelete = function()
}
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
Paragraph.prototype.Get_StartPage_Absolute = function()
{
return this.Get_AbsolutePage(0);
};
Paragraph.prototype.Get_StartPage_Relative = function()
{
return this.PageNum;
};
Paragraph.prototype.Get_StartColumn = function()
{
return this.ColumnNum;
};
Paragraph.prototype.Get_ColumnsCount = function()
{
return this.ColumnsCount;
};
//----------------------------------------------------------------------------------------------------------------------
// Дополнительные функции
//----------------------------------------------------------------------------------------------------------------------
Paragraph.prototype.Document_SetThisElementCurrent = function(bUpdateStates)
......@@ -11735,36 +11713,6 @@ Paragraph.prototype.Get_PagesCount = function()
{
return this.Pages.length;
};
Paragraph.prototype.private_GetRelativePageIndex = function(CurPage)
{
if (!this.ColumnsCount || 0 === this.ColumnsCount)
return this.PageNum + CurPage;
return this.PageNum + ((this.ColumnNum + CurPage) / this.ColumnsCount | 0);
};
Paragraph.prototype.private_GetAbsolutePageIndex = function(CurPage)
{
return this.Parent.Get_AbsolutePage(this.private_GetRelativePageIndex(CurPage));
};
Paragraph.prototype.Get_StartColumn = function()
{
return this.ColumnNum;
};
Paragraph.prototype.Get_AbsolutePage = function(CurPage)
{
return this.private_GetAbsolutePageIndex(CurPage);
};
Paragraph.prototype.Get_AbsoluteColumn = function(CurPage)
{
if (this.Parent instanceof CDocument)
return this.private_GetColumnIndex(CurPage);
return this.Parent.Get_AbsoluteColumn(this.private_GetRelativePageIndex(CurPage));
};
Paragraph.prototype.private_GetColumnIndex = function(CurPage)
{
return (this.ColumnNum + CurPage) - (((this.ColumnNum + CurPage) / this.ColumnsCount | 0) * this.ColumnsCount);
};
Paragraph.prototype.Is_EmptyPage = function(CurPage)
{
if (!this.Pages[CurPage] || this.Pages[CurPage].EndLine < this.Pages[CurPage].StartLine)
......
......@@ -2390,51 +2390,6 @@ CTable.prototype.Get_PrevElementEndInfo = function(RowIndex)
return this.Content[RowIndex - 1].Get_EndInfo();
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
CTable.prototype.Get_StartPage_Absolute = function()
{
return this.Get_AbsolutePage(0);
};
CTable.prototype.Get_StartPage_Relative = function()
{
return this.PageNum;
};
CTable.prototype.Get_StartColumn = function()
{
return this.ColumnNum;
};
CTable.prototype.Get_ColumnsCount = function()
{
return this.ColumnsCount;
};
CTable.prototype.private_GetRelativePageIndex = function(CurPage)
{
if (!this.ColumnsCount || 0 === this.ColumnsCount)
return this.PageNum + CurPage;
return this.PageNum + ((this.ColumnNum + CurPage) / this.ColumnsCount | 0);
};
CTable.prototype.private_GetAbsolutePageIndex = function(CurPage)
{
return this.Parent.Get_AbsolutePage(this.private_GetRelativePageIndex(CurPage));
};
CTable.prototype.Get_AbsolutePage = function(CurPage)
{
return this.private_GetAbsolutePageIndex(CurPage);
};
CTable.prototype.Get_AbsoluteColumn = function(CurPage)
{
if (this.Parent instanceof CDocument)
return this.private_GetColumnIndex(CurPage);
return this.Parent.Get_AbsoluteColumn(this.private_GetRelativePageIndex(CurPage));
};
CTable.prototype.private_GetColumnIndex = function(CurPage)
{
return (this.ColumnNum + CurPage) - (((this.ColumnNum + CurPage) / this.ColumnsCount | 0) * this.ColumnsCount);
};
//----------------------------------------------------------------------------------------------------------------------
// Функции к которым идет обращение из родительского класса
//----------------------------------------------------------------------------------------------------------------------
CTable.prototype.Copy = function(Parent)
......
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