Commit f0a6e378 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented bounding path around the CInlineLevelSdt.

parent 7f04d9bc
...@@ -1104,6 +1104,7 @@ ...@@ -1104,6 +1104,7 @@
window['AscDFH'].historyitem_type_Presentation = 58 << 16; window['AscDFH'].historyitem_type_Presentation = 58 << 16;
window['AscDFH'].historyitem_type_BlockLevelSdt = 59 << 16; window['AscDFH'].historyitem_type_BlockLevelSdt = 59 << 16;
window['AscDFH'].historyitem_type_SdtPr = 60 << 16; window['AscDFH'].historyitem_type_SdtPr = 60 << 16;
window['AscDFH'].historyitem_type_InlineLevelSdt = 61 << 16;
window['AscDFH'].historyitem_type_CommonShape = 1000 << 16; // Этот класс добавлен для элементов, у которых нет конкретного класса window['AscDFH'].historyitem_type_CommonShape = 1000 << 16; // Этот класс добавлен для элементов, у которых нет конкретного класса
......
...@@ -262,6 +262,7 @@ ...@@ -262,6 +262,7 @@
this.m_oFactoryClass[AscDFH.historyitem_type_deg_subsup] = AscCommonWord.CDegreeSubSup; this.m_oFactoryClass[AscDFH.historyitem_type_deg_subsup] = AscCommonWord.CDegreeSubSup;
this.m_oFactoryClass[AscDFH.historyitem_type_deg] = AscCommonWord.CDegree; this.m_oFactoryClass[AscDFH.historyitem_type_deg] = AscCommonWord.CDegree;
this.m_oFactoryClass[AscDFH.historyitem_type_BlockLevelSdt] = AscCommonWord.CBlockLevelSdt; this.m_oFactoryClass[AscDFH.historyitem_type_BlockLevelSdt] = AscCommonWord.CBlockLevelSdt;
this.m_oFactoryClass[AscDFH.historyitem_type_InlineLevelSdt] = AscCommonWord.CInlineLevelSdt;
if (window['AscCommonSlide']) if (window['AscCommonSlide'])
......
...@@ -8138,8 +8138,12 @@ CDocument.prototype.private_UpdateTracks = function(bSelection, bEmptySelection) ...@@ -8138,8 +8138,12 @@ CDocument.prototype.private_UpdateTracks = function(bSelection, bEmptySelection)
else else
this.DrawingDocument.Update_MathTrack(false); this.DrawingDocument.Update_MathTrack(false);
var oBlockLevelSdt = oSelectedInfo.GetBlockLevelSdt(); var oBlockLevelSdt = oSelectedInfo.GetBlockLevelSdt();
if (oBlockLevelSdt) var oInlineLevelSdt = oSelectedInfo.GetInlineLevelSdt();
if (oInlineLevelSdt)
oInlineLevelSdt.DrawContentControlsTrack(false);
else if (oBlockLevelSdt)
oBlockLevelSdt.DrawContentControlsTrack(false); oBlockLevelSdt.DrawContentControlsTrack(false);
else else
this.DrawingDocument.OnDrawContentControl(null, c_oContentControlTrack.In); this.DrawingDocument.OnDrawContentControl(null, c_oContentControlTrack.In);
......
...@@ -48,7 +48,7 @@ function CInlineLevelSdt() ...@@ -48,7 +48,7 @@ function CInlineLevelSdt()
this.Pr = new CSdtPr(); this.Pr = new CSdtPr();
this.Type = para_InlineLevelSdt; this.Type = para_InlineLevelSdt;
this.BoundsPath = []; this.BoundsPaths = null;
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора) // Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add(this, this.Id); g_oTableId.Add(this, this.Id);
...@@ -198,9 +198,10 @@ CInlineLevelSdt.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _C ...@@ -198,9 +198,10 @@ CInlineLevelSdt.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _C
if (0 === CurLine && 0 === CurRange && true !== PRSA.RecalcFast) if (0 === CurLine && 0 === CurRange && true !== PRSA.RecalcFast)
this.Bounds = {}; this.Bounds = {};
var X0 = PRSA.X; var oParagraph = PRSA.Paragraph;
var Y0 = PRSA.Y0; var Y0 = oParagraph.Lines[_CurLine].Top + oParagraph.Pages[_CurPage].Y;
var Y1 = PRSA.Y1; var Y1 = oParagraph.Lines[_CurLine].Bottom + oParagraph.Pages[_CurPage].Y;
var X0 = PRSA.X;
CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Range_Spaces.apply(this, arguments); CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Range_Spaces.apply(this, arguments);
...@@ -214,8 +215,7 @@ CInlineLevelSdt.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _C ...@@ -214,8 +215,7 @@ CInlineLevelSdt.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _C
Page : PRSA.Paragraph.Get_AbsolutePage(_CurPage) Page : PRSA.Paragraph.Get_AbsolutePage(_CurPage)
}; };
this.BoundsPath[_CurPage] = null; this.BoundsPath = null;
this.BoundsPath.length = _CurPage;
}; };
CInlineLevelSdt.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos) CInlineLevelSdt.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{ {
...@@ -324,30 +324,30 @@ CInlineLevelSdt.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth ...@@ -324,30 +324,30 @@ CInlineLevelSdt.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth
}; };
CInlineLevelSdt.prototype.GetBoundingPolygon = function() CInlineLevelSdt.prototype.GetBoundingPolygon = function()
{ {
var arrRects = []; if (null === this.BoundsPaths)
for (var Key in this.Bounds)
{ {
arrRects.push(this.Bounds[Key]); var arrRects = [];
} for (var Key in this.Bounds)
{
arrRects.push(this.Bounds[Key]);
}
var oPolygon = new CPolygon(); var oPolygon = new CPolygon();
oPolygon.fill([arrRects]); oPolygon.fill([arrRects]);
return oPolygon.GetPaths(0);
}; this.BoundsPaths = oPolygon.GetPaths(0);
CInlineLevelSdt.prototype.DrawBoundingPolygon = function(pGraphics, arrPaths)
{
pGraphics.p_color(255, 0, 0, 255);
for (var nIndex = 0, nCount = arrPaths.length; nIndex < nCount; ++nIndex)
{
pGraphics.DrawPolygon(arrPaths[nIndex], 1, 0);
} }
return this.BoundsPaths;
}; };
CInlineLevelSdt.prototype.Draw_Lines = function(PDSL) CInlineLevelSdt.prototype.DrawContentControlsTrack = function(isHover)
{ {
CParagraphContentWithParagraphLikeContent.prototype.Draw_Lines.apply(this, arguments); if (!this.Paragraph)
return;
this.DrawBoundingPolygon(PDSL.Graphics, this.GetBoundingPolygon()); var oDrawingDocument = this.Paragraph.Get_DrawingDocument();
oDrawingDocument.OnDrawContentControl(this.GetId(), isHover ? c_oContentControlTrack.Hover : c_oContentControlTrack.In, this.GetBoundingPolygon(), this.Get_ParentTextTransform());
}; };
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Выставление настроек // Выставление настроек
...@@ -424,7 +424,7 @@ CInlineLevelSdt.prototype.GetContentControlLock = function() ...@@ -424,7 +424,7 @@ CInlineLevelSdt.prototype.GetContentControlLock = function()
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
CInlineLevelSdt.prototype.Write_ToBinary2 = function(Writer) CInlineLevelSdt.prototype.Write_ToBinary2 = function(Writer)
{ {
Writer.WriteLong(AscDFH.historyitem_type_Field); Writer.WriteLong(AscDFH.historyitem_type_InlineLevelSdt);
// String : Id // String : Id
// Long : Количество элементов // Long : Количество элементов
...@@ -469,6 +469,9 @@ CInlineLevelSdt.prototype.UpdatePath = function(CurPage, oPath) ...@@ -469,6 +469,9 @@ CInlineLevelSdt.prototype.UpdatePath = function(CurPage, oPath)
{ {
this.BoundsPath[CurPage] = oPath; this.BoundsPath[CurPage] = oPath;
}; };
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CInlineLevelSdt = CInlineLevelSdt;
function TEST_ADD_SDT() function TEST_ADD_SDT()
{ {
...@@ -485,7 +488,8 @@ function TEST_ADD_SDT() ...@@ -485,7 +488,8 @@ function TEST_ADD_SDT()
oInlineContentControl.Add_ToContent(0, oRun); oInlineContentControl.Add_ToContent(0, oRun);
var oPara = oLogicDocument.GetCurrentParagraph(); var oPara = oLogicDocument.GetCurrentParagraph();
oPara.Add_ToContent(0, oInlineContentControl); oPara.Add_ToContent(0, new ParaRun());
oPara.Add_ToContent(1, oInlineContentControl);
oLogicDocument.Recalculate(); oLogicDocument.Recalculate();
......
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