Commit 600e299f authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented drawing a rect on moving mouse over a class CBlockLevelSdt.

parent 192124e8
...@@ -15023,6 +15023,13 @@ CDocument.prototype.controller_IsInBlockLevelSdt = function() ...@@ -15023,6 +15023,13 @@ CDocument.prototype.controller_IsInBlockLevelSdt = function()
return null; return null;
}; };
CDocument.prototype.controller_DrawContentControlsHover = function(X, Y, PageAbs)
{
var ContentPos = this.Internal_GetContentPosByXY(X, Y, PageAbs);
var Item = this.Content[ContentPos];
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, PageAbs);
Item.DrawContentControlsHover(X, Y, ElementPageIndex);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// //
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
...@@ -15145,10 +15152,7 @@ CDocument.prototype.DrawContentControls = function(PageAbs, MouseX, MouseY, Mous ...@@ -15145,10 +15152,7 @@ CDocument.prototype.DrawContentControls = function(PageAbs, MouseX, MouseY, Mous
} }
else if (PageAbs === MousePage) else if (PageAbs === MousePage)
{ {
var ContentPos = this.Internal_GetContentPosByXY(MouseX, MouseY, MousePage); this.Controller.DrawContentControlsHover(MouseX, MouseY, MousePage);
var Item = this.Content[ContentPos];
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, MouseX, MouseY, MousePage);
//Item.DrawContentControls(MouseX, MouseY, MousePage);
} }
}; };
......
...@@ -8491,6 +8491,14 @@ CDocumentContent.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt) ...@@ -8491,6 +8491,14 @@ CDocumentContent.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
return oBlockLevelSdt; return oBlockLevelSdt;
}; };
CDocumentContent.prototype.DrawContentControlsHover = function(X, Y, CurPage)
{
var ContentPos = this.Internal_GetContentPosByXY(X, Y, CurPage);
var Item = this.Content[ContentPos];
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, CurPage);
Item.DrawContentControlsHover(X, Y, ElementPageIndex);
};
function CDocumentContentStartState(DocContent) function CDocumentContentStartState(DocContent)
{ {
......
...@@ -573,7 +573,10 @@ CDocumentContentElementBase.prototype.GetSelectionAnchorPos = function() ...@@ -573,7 +573,10 @@ CDocumentContentElementBase.prototype.GetSelectionAnchorPos = function()
}; };
CDocumentContentElementBase.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt) CDocumentContentElementBase.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{ {
return this.Content.IsInBlockLevelSdt(this); return null;
};
CDocumentContentElementBase.prototype.DrawContentControlsHover = function(X, Y, CurPage)
{
}; };
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц // Функции для работы с номерами страниц
......
...@@ -737,3 +737,7 @@ CDocumentControllerBase.prototype.RemoveTextSelection = function(){}; ...@@ -737,3 +737,7 @@ CDocumentControllerBase.prototype.RemoveTextSelection = function(){};
* @returns {CBlockLevelSdt?} * @returns {CBlockLevelSdt?}
*/ */
CDocumentControllerBase.prototype.IsInBlockLevelSdt = function(){return null;}; CDocumentControllerBase.prototype.IsInBlockLevelSdt = function(){return null;};
/**
* Рисуем выделение контейнер, когда проводим мышкой над ним
*/
CDocumentControllerBase.prototype.DrawContentControlsHover = function(X, Y, PageAbs){};
\ No newline at end of file
...@@ -525,3 +525,11 @@ CDrawingsController.prototype.IsInBlockLevelSdt = function() ...@@ -525,3 +525,11 @@ CDrawingsController.prototype.IsInBlockLevelSdt = function()
return null; return null;
}; };
CDrawingsController.prototype.DrawContentControlsHover = function(X, Y, PageAbs)
{
var oTargetTextObject = AscFormat.getTargetTextObject(this.DrawingObjects);
if (oTargetTextObject)
return oTargetTextObject.DrawContentControlsHover(X, Y, 0);
return null;
};
\ No newline at end of file
...@@ -3225,6 +3225,15 @@ CFootnotesController.prototype.IsInBlockLevelSdt = function() ...@@ -3225,6 +3225,15 @@ CFootnotesController.prototype.IsInBlockLevelSdt = function()
return null; return null;
}; };
CFootnotesController.prototype.DrawContentControlsHover = function(X, Y, PageAbs)
{
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
var oFootnote = oResult.Footnote;
oFootnote.DrawContentControlsHover(X, Y, oResult.FootnotePageIndex);
}
};
function CFootEndnotePageColumn() function CFootEndnotePageColumn()
......
...@@ -489,3 +489,9 @@ CHdrFtrController.prototype.IsInBlockLevelSdt = function() ...@@ -489,3 +489,9 @@ CHdrFtrController.prototype.IsInBlockLevelSdt = function()
return null; return null;
}; };
CHdrFtrController.prototype.DrawContentControlsHover = function(X, Y, PageAbs)
{
var CurHdrFtr = this.HdrFtr.CurHdrFtr;
if (null != CurHdrFtr)
return CurHdrFtr.Content.DrawContentControlsHover(X, Y, CurHdrFtr.Content.Get_StartPage_Relative());
};
\ No newline at end of file
...@@ -382,3 +382,7 @@ CLogicDocumentController.prototype.IsInBlockLevelSdt = function() ...@@ -382,3 +382,7 @@ CLogicDocumentController.prototype.IsInBlockLevelSdt = function()
{ {
return this.LogicDocument.controller_IsInBlockLevelSdt(); return this.LogicDocument.controller_IsInBlockLevelSdt();
}; };
CLogicDocumentController.prototype.DrawContentControlsHover = function(X, Y, PageAbs)
{
this.LogicDocument.controller_DrawContentControlsHover(X, Y, PageAbs);
};
\ No newline at end of file
...@@ -12098,6 +12098,9 @@ Paragraph.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt) ...@@ -12098,6 +12098,9 @@ Paragraph.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{ {
return oBlockLevelSdt; return oBlockLevelSdt;
}; };
Paragraph.prototype.DrawContentControlsHover = function(X, Y, CurPage)
{
};
var pararecalc_0_All = 0; var pararecalc_0_All = 0;
var pararecalc_0_None = 1; var pararecalc_0_None = 1;
......
...@@ -567,6 +567,28 @@ CBlockLevelSdt.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt) ...@@ -567,6 +567,28 @@ CBlockLevelSdt.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
{ {
return this.Content.IsInBlockLevelSdt(this); return this.Content.IsInBlockLevelSdt(this);
}; };
CBlockLevelSdt.prototype.DrawContentControlsHover = function(X, Y, CurPage)
{
this.Content.DrawContentControlsHover(X, Y, CurPage);
var oDrawingDocument = this.LogicDocument.Get_DrawingDocument();
var oRects = {};
for (var nCurPage = 0, nPagesCount = this.GetPagesCount(); nCurPage < nPagesCount; ++nCurPage)
{
var nPageAbs = this.Get_AbsolutePage(nCurPage);
if (!oRects[nPageAbs])
oRects[nPageAbs] = [];
var oBounds = this.GetPageBounds(nCurPage);
oRects[nPageAbs].push({X : oBounds.Left, Y : oBounds.Top, R : oBounds.Right, B : oBounds.Bottom});
}
for (var nPageAbs in oRects)
{
oDrawingDocument.DrawContentControl(this.GetId(), c_oContentControlTrack.Hover, nPageAbs, oRects[nPageAbs]);
}
};
CBlockLevelSdt.prototype.DrawContentControls = function(PageAbs) CBlockLevelSdt.prototype.DrawContentControls = function(PageAbs)
{ {
var oDrawingDocument = this.LogicDocument.Get_DrawingDocument(); var oDrawingDocument = this.LogicDocument.Get_DrawingDocument();
......
...@@ -12006,6 +12006,16 @@ CTable.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt) ...@@ -12006,6 +12006,16 @@ CTable.prototype.IsInBlockLevelSdt = function(oBlockLevelSdt)
return oBlockLevelSdt; return oBlockLevelSdt;
}; };
CTable.prototype.DrawContentControlsHover = function(X, Y, CurPage)
{
var oPos = this.Internal_GetCellByXY(X, Y, CurPage);
var oRow = this.Content[oPos.Row];
if (oRow && oPos.Cell < oRow.Get_CellsCount())
{
var oCell = oRow.Get_Cell(oPos.Cell);
oCell.Content_DrawContentControlsHover(X, Y, CurPage - oCell.Content.Get_StartPage_Relative());
}
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Класс CTableLook // Класс CTableLook
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
......
...@@ -1792,7 +1792,21 @@ CTableCell.prototype = ...@@ -1792,7 +1792,21 @@ CTableCell.prototype =
{ {
} }
}; };
CTableCell.private_TransformXY = function(X, Y)
{
// TODO: Везде, где идет такой код заменить на данную функцию
var _X = X, _Y = Y;
var Transform = this.private_GetTextDirectionTransform();
if (null !== Transform)
{
Transform = global_MatrixTransformer.Invert(Transform);
_X = Transform.TransformPointX(X, Y);
_Y = Transform.TransformPointY(X, Y);
}
return {X : _X, Y : _Y};
};
CTableCell.prototype.Get_TopElement = function() CTableCell.prototype.Get_TopElement = function()
{ {
if (this.Row && this.Row.Table) if (this.Row && this.Row.Table)
...@@ -1846,6 +1860,11 @@ CTableCell.prototype.Get_TopDocumentContent = function() ...@@ -1846,6 +1860,11 @@ CTableCell.prototype.Get_TopDocumentContent = function()
return null; return null;
}; };
CTableCell.prototype.Content_DrawContentControlsHover = function(X, Y, CurPage)
{
var oPos = this.private_TransformXY(X, Y);
this.Content.DrawContentControlsHover(oPos.X, oPos.Y, CurPage);
};
function CTableCellRecalculateObject() function CTableCellRecalculateObject()
{ {
......
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