Commit 670bcdb7 authored by Ilya Kirillov's avatar Ilya Kirillov

Added function for setting outlineLvl property to paragraph.

parent e65e2de6
......@@ -1315,6 +1315,7 @@
window['AscDFH'].historyitem_Paragraph_SectionPr = window['AscDFH'].historyitem_type_Paragraph | 34;
window['AscDFH'].historyitem_Paragraph_PrChange = window['AscDFH'].historyitem_type_Paragraph | 35;
window['AscDFH'].historyitem_Paragraph_PrReviewInfo = window['AscDFH'].historyitem_type_Paragraph | 36;
window['AscDFH'].historyitem_Paragraph_OutlineLvl = window['AscDFH'].historyitem_type_Paragraph | 37;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе ParaTextPr
//------------------------------------------------------------------------------------------------------------------
......
......@@ -880,4 +880,16 @@ CDocumentContentBase.prototype.FindNextFillingForm = function(isNext, isCurrent,
CDocumentContentBase.prototype.IsSelectedSingleElement = function()
{
return (true === this.Selection.Use && docpostype_Content === this.Get_DocPosType() && this.Selection.Flag === selectionflag_Common && this.Selection.StartPos === this.Selection.EndPos)
};
\ No newline at end of file
};
CDocumentContentBase.prototype.GetOutlineParagraphs = function(arrOutline)
{
if (!arrOutline)
arrOutline = [];
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
this.Content[nIndex].GetOutlineParagraphs(arrOutline);
}
return arrOutline;
};
......@@ -693,6 +693,9 @@ CDocumentContentElementBase.prototype.Get_Index = function()
return this.Index;
};
CDocumentContentElementBase.prototype.GetOutlineParagraphs = function(arrOutline)
{
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -8817,6 +8817,14 @@ Paragraph.prototype.Set_Bullet = function(Bullet)
this.CompiledPr.NeedRecalc = true;
this.private_UpdateTrackRevisionOnChangeParaPr(true);
};
Paragraph.prototype.SetOutlineLvl = function(nLvl)
{
this.private_AddPrChange();
History.Add(new CChangesParagraphOutlineLvl(this, this.Pr.OutlineLvl, nLvl));
this.Pr.OutlineLvl = nLvl;
this.CompiledPr.NeedRecalc = true;
this.private_UpdateTrackRevisionOnChangeParaPr(true);
};
/**
* Проверяем начинается ли текущий параграф с новой страницы.
*/
......@@ -12351,6 +12359,12 @@ Paragraph.prototype.GetComplexFieldsByPos = function(oParaPos, bReturnFieldPos)
this.Set_ParaContentPos(oCurrentPos, false, -1, -1, false);
return arrComplexFields;
};
Paragraph.prototype.GetOutlineParagraphs = function(arrOutline)
{
var ParaPr = this.Get_CompiledPr2(false);
if (undefined !== ParaPr.OutlineLvl)
arrOutline.push({Paragraph : this, Lvl : ParaPr.OutlineLvl});
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
......@@ -73,6 +73,7 @@ AscDFH.changesFactory[AscDFH.historyitem_Paragraph_FramePr] =
AscDFH.changesFactory[AscDFH.historyitem_Paragraph_SectionPr] = CChangesParagraphSectPr;
AscDFH.changesFactory[AscDFH.historyitem_Paragraph_PrChange] = CChangesParagraphPrChange;
AscDFH.changesFactory[AscDFH.historyitem_Paragraph_PrReviewInfo] = CChangesParagraphPrReviewInfo;
AscDFH.changesFactory[AscDFH.historyitem_Paragraph_OutlineLvl] = CChangesParagraphOutlineLvl;
function private_ParagraphChangesOnLoadPr(oColor)
{
......@@ -246,7 +247,8 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Paragraph_Pr]
AscDFH.historyitem_Paragraph_PresentationPr_Level,
AscDFH.historyitem_Paragraph_FramePr,
AscDFH.historyitem_Paragraph_PrChange,
AscDFH.historyitem_Paragraph_PrReviewInfo
AscDFH.historyitem_Paragraph_PrReviewInfo,
AscDFH.historyitem_Paragraph_OutlineLvl
];
AscDFH.changesRelationMap[AscDFH.historyitem_Paragraph_PresentationPr_Bullet] = [
AscDFH.historyitem_Paragraph_PresentationPr_Bullet,
......@@ -273,6 +275,9 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Paragraph_PrReviewInfo]
AscDFH.historyitem_Paragraph_PrChange,
AscDFH.historyitem_Paragraph_PrReviewInfo
];
AscDFH.changesRelationMap[AscDFH.historyitem_Paragraph_OutlineLvl] = [
AscDFH.historyitem_Paragraph_OutlineLvl
];
// Общая функция Merge для изменений, которые зависят только от себя и AscDFH.historyitem_Paragraph_Pr
function private_ParagraphChangesOnMergePr(oChange)
......@@ -1759,4 +1764,26 @@ CChangesParagraphPrReviewInfo.prototype.Merge = function(oChange)
return false;
return true;
};
\ No newline at end of file
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}
*/
function CChangesParagraphOutlineLvl(Class, Old, New, Color)
{
AscDFH.CChangesBaseLongProperty.call(this, Class, Old, New, Color);
}
CChangesParagraphOutlineLvl.prototype = Object.create(AscDFH.CChangesBaseLongProperty.prototype);
CChangesParagraphOutlineLvl.prototype.constructor = CChangesParagraphOutlineLvl;
CChangesParagraphOutlineLvl.prototype.Type = AscDFH.historyitem_Paragraph_OutlineLvl;
CChangesParagraphOutlineLvl.prototype.private_SetValue = function(Value)
{
var oParagraph = this.Class;
oParagraph.Pr.OutlineLvl = Value;
oParagraph.CompiledPr.NeedRecalc = true;
oParagraph.private_UpdateTrackRevisionOnChangeParaPr(false);
private_ParagraphChangesOnSetValue(this.Class);
};
CChangesParagraphOutlineLvl.prototype.Merge = private_ParagraphChangesOnMergePr;
CChangesParagraphOutlineLvl.prototype.Load = private_ParagraphChangesOnLoadPr;
\ No newline at end of file
......@@ -12094,6 +12094,19 @@ CTable.prototype.GetAllContentControls = function(arrContentControls)
}
}
};
CTable.prototype.GetOutlineParagraphs = function(arrOutline)
{
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);
if (oCell)
oCell.Content.GetOutlineParagraphs(arrOutline);
}
}
};
//----------------------------------------------------------------------------------------------------------------------
// Класс 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