Commit 3e7c331f authored by Ilya Kirillov's avatar Ilya Kirillov

Drawing a frame around CBlockLevelSdt.

parent f6ef2884
......@@ -15011,6 +15011,18 @@ CDocument.prototype.controller_GetCurrentSectionPr = function()
var nContentPos = this.CurPos.ContentPos;
return this.SectionsInfo.Get_SectPr(nContentPos).SectPr;
};
CDocument.prototype.controller_IsInBlockLevelSdt = function()
{
if (false === this.Selection.Use || this.Selection.StartPos === this.Selection.EndPos)
{
if (true === this.Selection.Use)
return this.Content[this.Selection.StartPos].IsInBlockLevelSdt(null);
else
return this.Content[this.CurPos.ContentPos].IsInBlockLevelSdt(null);
}
return null;
};
//----------------------------------------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------------------------------------
......@@ -15124,6 +15136,21 @@ CDocument.prototype.MoveToFillingForm = function(bNext)
this.Document_UpdateSelectionState();
}
};
CDocument.prototype.DrawContentControls = function(PageAbs, MouseX, MouseY, MousePage)
{
var oBlockLevelSdt = this.Controller.IsInBlockLevelSdt();
if (null !== oBlockLevelSdt)
{
oBlockLevelSdt.DrawContentControls(PageAbs);
}
else if (PageAbs === MousePage)
{
var ContentPos = this.Internal_GetContentPosByXY(MouseX, MouseY, MousePage);
var Item = this.Content[ContentPos];
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, MouseX, MouseY, MousePage);
//Item.DrawContentControls(MouseX, MouseY, MousePage);
}
};
function CDocumentSelectionState()
{
......
......@@ -8479,6 +8479,18 @@ CDocumentContent.prototype.IsBlockLevelSdtContent = function()
{
return (this.Parent && this.Parent instanceof CBlockLevelSdt);
};
CDocumentContent.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{
if (false === this.Selection.Use || this.Selection.StartPos === this.Selection.EndPos)
{
if (true === this.Selection.Use)
return this.Content[this.Selection.StartPos].IsInBlockLevelSdt(oBlockLevelSdt);
else
return this.Content[this.CurPos.ContentPos].IsInBlockLevelSdt(oBlockLevelSdt);
}
return oBlockLevelSdt;
};
function CDocumentContentStartState(DocContent)
{
......
......@@ -571,6 +571,10 @@ CDocumentContentElementBase.prototype.GetSelectionAnchorPos = function()
{
return null;
};
CDocumentContentElementBase.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{
return this.Content.IsInBlockLevelSdt(this);
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -732,3 +732,8 @@ CDocumentControllerBase.prototype.GetCurrentSectionPr = function(){return null;}
* Отличие от RemoveSelection в том, что сбрасываем селект с текста, но не сбрасываем с автофигур
*/
CDocumentControllerBase.prototype.RemoveTextSelection = function(){};
/**
* Если выделение или курсор находятся в контейнере - получаем его.
* @returns {CBlockLevelSdt?}
*/
CDocumentControllerBase.prototype.IsInBlockLevelSdt = function(){return null;};
......@@ -517,4 +517,11 @@ CDrawingsController.prototype.RemoveTextSelection = function()
{
this.DrawingObjects.removeTextSelection();
};
CDrawingsController.prototype.IsInBlockLevelSdt = function()
{
var oTargetTextObject = AscFormat.getTargetTextObject(this.DrawingObjects);
if (oTargetTextObject)
return oTargetTextObject.IsInBlockLevelSdt(null);
return null;
};
......@@ -3218,6 +3218,13 @@ CFootnotesController.prototype.ResetRecalculateCache = function()
this.Footnote[Id].Reset_RecalculateCache();
}
};
CFootnotesController.prototype.IsInBlockLevelSdt = function()
{
if (true !== this.Selection.Use || 0 === this.Selection.Direction)
return this.CurFootnote.IsInBlockLevelSdt(null);
return null;
};
function CFootEndnotePageColumn()
......
......@@ -482,3 +482,10 @@ CHdrFtrController.prototype.RemoveTextSelection = function()
if (null != CurHdrFtr)
return CurHdrFtr.Content.RemoveTextSelection();
};
CHdrFtrController.prototype.IsInBlockLevelSdt = function()
{
if (this.HdrFtr.CurHdrFtr)
return this.HdrFtr.CurHdrFtr.Content.IsInBlockLevelSdt(null);
return null;
};
\ No newline at end of file
......@@ -378,3 +378,7 @@ CLogicDocumentController.prototype.RemoveTextSelection = function()
{
return this.RemoveSelection();
};
CLogicDocumentController.prototype.IsInBlockLevelSdt = function()
{
return this.LogicDocument.controller_IsInBlockLevelSdt();
};
\ No newline at end of file
......@@ -12094,6 +12094,10 @@ Paragraph.prototype.GetCurrentParagraph = function()
{
return this;
};
Paragraph.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{
return oBlockLevelSdt;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
......@@ -126,14 +126,6 @@ CBlockLevelSdt.prototype.Read_FromBinary2 = function(Reader)
CBlockLevelSdt.prototype.Draw = function(CurPage, oGraphics)
{
this.Content.Draw(CurPage, oGraphics);
var oPageBounds = this.GetPageBounds(CurPage);
oGraphics.p_color(0, 0, 255, 255);
oGraphics.drawVerLine(0, oPageBounds.Left, oPageBounds.Top, oPageBounds.Bottom, 0);
oGraphics.drawVerLine(0, oPageBounds.Right, oPageBounds.Top, oPageBounds.Bottom, 0);
oGraphics.drawHorLine(0, oPageBounds.Top, oPageBounds.Left, oPageBounds.Right, 0);
oGraphics.drawHorLine(0, oPageBounds.Bottom, oPageBounds.Left, oPageBounds.Right, 0);
};
CBlockLevelSdt.prototype.Get_CurrentPage_Absolute = function()
{
......@@ -571,6 +563,31 @@ CBlockLevelSdt.prototype.GetSelectionAnchorPos = function()
{
return this.Content.GetSelectionAnchorPos();
};
CBlockLevelSdt.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{
return this.Content.IsInBlockLevelSdt(this);
};
CBlockLevelSdt.prototype.DrawContentControls = function(PageAbs)
{
var oDrawingDocument = this.LogicDocument.Get_DrawingDocument();
var arrRects = [];
for (var nCurPage = 0, nPagesCount = this.GetPagesCount(); nCurPage < nPagesCount; ++nCurPage)
{
var nCurPageAbs = this.Get_AbsolutePage(nCurPage);
if (nCurPageAbs === PageAbs)
{
var oBounds = this.GetPageBounds(nCurPage);
arrRects.push({X : oBounds.Left, Y : oBounds.Top, R : oBounds.Right, B : oBounds.Bottom});
}
else if (nCurPageAbs > PageAbs)
{
break;
}
}
oDrawingDocument.DrawContentControl(this.GetId(), c_oContentControlTrack.In, PageAbs, arrRects);
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr)
{
......
......@@ -11999,6 +11999,13 @@ CTable.prototype.GetTableProps = function()
{
return this.Get_Props();
};
CTable.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{
if (true !== this.Selection.Use || table_Selection_Text === this.Selection.Type)
return this.CurCell.Content.IsInBlockLevelSdt(oBlockLevelSdt);
return oBlockLevelSdt;
};
//----------------------------------------------------------------------------------------------------------------------
// Класс 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