Commit aa61d3e7 authored by Ilya Kirillov's avatar Ilya Kirillov

Added function for receiving an array with all ContentControls stored in the document.

parent cb1b5845
......@@ -15150,6 +15150,18 @@ CDocument.prototype.AddContentControl = function()
return this.Controller.AddContentControl();
};
CDocument.prototype.GetAllContentControls = function()
{
var arrContentControls = [];
this.SectionsInfo.GetAllContentControls(arrContentControls);
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
this.Content[nIndex].GetAllContentControls(arrContentControls);
}
return arrContentControls;
};
function CDocumentSelectionState()
{
......@@ -15493,6 +15505,31 @@ CDocumentSectionsInfo.prototype =
}
}
};
CDocumentSectionsInfo.prototype.GetAllContentControls = function(arrContentControls)
{
for (var nIndex = 0, nCount = this.Elements.length; nIndex < nCount; ++nIndex)
{
var SectPr = this.Elements[nIndex].SectPr;
if (null != SectPr.HeaderFirst)
SectPr.HeaderFirst.GetAllContentControls(arrContentControls);
if (null != SectPr.HeaderDefault)
SectPr.HeaderDefault.GetAllContentControls(arrContentControls);
if (null != SectPr.HeaderEven)
SectPr.HeaderEven.GetAllContentControls(arrContentControls);
if (null != SectPr.FooterFirst)
SectPr.FooterFirst.GetAllContentControls(arrContentControls);
if (null != SectPr.FooterDefault)
SectPr.FooterDefault.GetAllContentControls(arrContentControls);
if (null != SectPr.FooterEven)
SectPr.FooterEven.GetAllContentControls(arrContentControls);
}
};
function CDocumentSectionsInfoElement(SectPr, Index)
{
......
......@@ -8468,6 +8468,18 @@ CDocumentContent.prototype.AddContentControl = function()
else
return this.private_AddContentControl();
};
CDocumentContent.prototype.GetAllContentControls = function(arrContentControls)
{
if (!arrContentControls)
arrContentControls = [];
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
this.Content[nIndex].GetAllContentControls(arrContentControls);
}
return arrContentControls;
};
function CDocumentContentStartState(DocContent)
......
......@@ -626,6 +626,9 @@ CDocumentContentElementBase.prototype.GetStyleFromFormatting = function()
{
return null;
};
CDocumentContentElementBase.prototype.GetAllContentControls = function(arrContentControls)
{
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -1270,6 +1270,10 @@ CHeaderFooter.prototype.ForceRecalculate = function(nPageAbs)
{
this.RecalcInfo.NeedRecalc[nPageAbs] = true;
};
CHeaderFooter.prototype.GetAllContentControls = function(arrContentControls)
{
return this.Content.GetAllContentControls(arrContentControls);
};
//-----------------------------------------------------------------------------------
// Класс для работы с колонтитулами
......
......@@ -12098,6 +12098,19 @@ Paragraph.prototype.Get_FirstParagraph = function()
{
return this;
};
Paragraph.prototype.GetAllContentControls = function(arrContentControls)
{
if (!arrContentControls)
arrContentControls = [];
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
if (this.Content[nIndex].GetAllContentControls)
this.Content[nIndex].GetAllContentControls(arrContentControls);
}
return arrContentControls;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
......@@ -2470,6 +2470,11 @@ ParaDrawing.prototype.Get_ObjectType = function()
return AscDFH.historyitem_type_Drawing;
};
ParaDrawing.prototype.GetAllContentControls = function(arrContentControls)
{
// TODO: Реализовать
};
/**
* Класс, описывающий текущее положение параграфа при рассчете позиции автофигуры.
......
......@@ -1729,6 +1729,11 @@ ParaFootnoteReference.prototype.CreateDocumentFontMap = function(FontMap)
if (this.Footnote)
this.Footnote.Document_CreateFontMap(FontMap);
};
ParaFootnoteReference.prototype.GetAllContentControls = function(arrContentControls)
{
if (this.Footnote)
this.Footnote.GetAllContentControls(arrContentControls);
};
/**
* Класс представляющий номер сноски внутри сноски.
......
......@@ -2677,6 +2677,19 @@ CParagraphContentWithParagraphLikeContent.prototype.GetFootnoteRefsInRange = fun
this.Content[CurPos].GetFootnoteRefsInRange(arrFootnotes, _CurLine, _CurRange);
}
};
CParagraphContentWithParagraphLikeContent.prototype.GetAllContentControls = function(arrContentControls)
{
if (!arrContentControls)
arrContentControls = [];
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
if (this.Content[nIndex].GetAllContentControls)
this.Content[nIndex].GetAllContentControls(arrContentControls);
}
return arrContentControls;
};
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -9131,6 +9131,20 @@ ParaRun.prototype.GetFootnoteRefsInRange = function(arrFootnotes, _CurLine, _Cur
arrFootnotes.push(this.Content[CurPos]);
}
};
ParaRun.prototype.GetAllContentControls = function(arrContentControls)
{
if (!arrContentControls)
return;
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
var oItem = this.Content[nIndex];
if (para_Drawing === oItem.Type || para_FootnoteReference === oItem.Type)
{
oItem.GetAllContentControls(arrContentControls);
}
}
};
function CParaRunStartState(Run)
{
......
......@@ -656,6 +656,11 @@ CBlockLevelSdt.prototype.GetStyleFromFormatting = function()
{
return this.Content.GetStyleFromFormatting();
};
CBlockLevelSdt.prototype.GetAllContentControls = function(arrContentControls)
{
arrContentControls.push(this);
this.Content.GetAllContentControls(arrContentControls);
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr)
{
......
......@@ -12006,6 +12006,18 @@ CTable.prototype.AddContentControl = function()
return null;
};
CTable.prototype.GetAllContentControls = function(arrContentControls)
{
for (var nCurRow = 0, nRowsCount = this.Content.length; nCurRow < nRowsCount; ++nCurRow)
{
var oRow = this.Content[nCurRow];
for (var nCurCell = 0, nCellsCount = oRow.Get_CellsCount(); nCurCell < nCellsCount; ++nCurCell)
{
var oCell = oRow.Get_Cell(nCurCell);
oCell.Content.GetAllContentControls(arrContentControls);
}
}
};
//----------------------------------------------------------------------------------------------------------------------
// Класс CTableLook
//----------------------------------------------------------------------------------------------------------------------
......
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