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

Implemented functions for check hit in drawing object, text, table border in...

Implemented functions for check hit in drawing object, text, table border in footnotes. Implemented moving inline objects between main part of the document and footnotes.
parent 2a935189
......@@ -5777,11 +5777,14 @@ CDocument.prototype.Is_TableBorder = function(X, Y, PageIndex)
}
else
{
// TODO: Добавить обработку сносок
if (-1 != this.DrawingObjects.isPointInDrawingObjects(X, Y, PageIndex, this))
{
return null;
}
else if (true === this.Footnotes.CheckHitInFootnote(X, Y, PageIndex))
{
return this.Footnotes.IsTableBorder(X, Y, PageIndex);
}
else
{
var ColumnsInfo = {};
......@@ -5795,8 +5798,6 @@ CDocument.prototype.Is_TableBorder = function(X, Y, PageIndex)
return null;
}
}
return null;
};
/**
* Проверяем, попали ли мы четко в текст (не лежащий в автофигуре)
......@@ -5816,12 +5817,17 @@ CDocument.prototype.Is_InText = function(X, Y, PageIndex)
}
else
{
// TODO: Добавить обработку сносок
var ContentPos = this.Internal_GetContentPosByXY(X, Y, PageIndex);
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, PageIndex);
var Item = this.Content[ContentPos];
return Item.Is_InText(X, Y, ElementPageIndex);
if (true === this.Footnotes.CheckHitInFootnote(X, Y, PageIndex))
{
return this.Footnotes.IsInText(X, Y, PageIndex);
}
else
{
var ContentPos = this.Internal_GetContentPosByXY(X, Y, PageIndex);
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, PageIndex);
var Item = this.Content[ContentPos];
return Item.Is_InText(X, Y, ElementPageIndex);
}
}
};
CDocument.prototype.Get_ParentTextTransform = function()
......@@ -5843,11 +5849,14 @@ CDocument.prototype.Is_InDrawing = function(X, Y, PageIndex)
}
else
{
// TODO: Добавить обработку сносок
if (-1 != this.DrawingObjects.isPointInDrawingObjects(X, Y, this.CurPage, this))
{
return true;
}
else if (true === this.Footnotes.CheckHitInFootnote(X, Y, PageIndex))
{
return this.Footnotes.IsInDrawing(X, Y, PageIndex);
}
else
{
var ContentPos = this.Internal_GetContentPosByXY(X, Y, PageIndex);
......@@ -7212,7 +7221,6 @@ CDocument.prototype.Get_NearestPos = function(PageNum, X, Y, bAnchor, Drawing)
if (undefined === bAnchor)
bAnchor = false;
// TODO: Доработать сноски
if (docpostype_HdrFtr === this.Get_DocPosType())
return this.HdrFtr.Get_NearestPos(PageNum, X, Y, bAnchor, Drawing);
......@@ -7225,6 +7233,10 @@ CDocument.prototype.Get_NearestPos = function(PageNum, X, Y, bAnchor, Drawing)
var NearestPos = this.DrawingObjects.getNearestPos(X, Y, PageNum, Drawing);
if (( nInDrawing === DRAWING_ARRAY_TYPE_BEFORE || nInDrawing === DRAWING_ARRAY_TYPE_INLINE || ( false === bInText && nInDrawing >= 0 ) ) && null != NearestPos)
return NearestPos;
NearestPos = true === this.Footnotes.CheckHitInFootnote(X, Y, PageNum) ? this.Footnotes.GetNearestPos(X, Y, PageNum, false, Drawing) : null;
if (null !== NearestPos)
return NearestPos;
}
var ContentPos = this.Internal_GetContentPosByXY(X, Y, PageNum);
......
......@@ -396,7 +396,7 @@ CDocumentContent.prototype.Set_CurrentElement = function(Index, bUp
this.Selection.EndPos = ContentPos;
}
this.Parent.Set_CurrentElement(bUpdateStates, this.Get_StartPage_Absolute());
this.Parent.Set_CurrentElement(bUpdateStates, this.Get_StartPage_Absolute(), this);
};
CDocumentContent.prototype.Is_ThisElementCurrent = function()
{
......@@ -4439,10 +4439,10 @@ CDocumentContent.prototype.Insert_Content = function(Selecte
}
if (true === bNeedSelect)
this.Parent.Set_CurrentElement(false, this.Get_StartPage_Absolute());
this.Parent.Set_CurrentElement(false, this.Get_StartPage_Absolute(), this);
else if (null !== this.LogicDocument && docpostype_HdrFtr === this.LogicDocument.CurPos.Type)
{
this.Parent.Set_CurrentElement(false, this.Get_StartPage_Absolute());
this.Parent.Set_CurrentElement(false, this.Get_StartPage_Absolute(), this);
var DocContent = this;
var HdrFtr = this.Is_HdrFtr(true);
if (null !== HdrFtr)
......@@ -7872,7 +7872,7 @@ CDocumentContent.prototype.Select_DrawingObject = function(Id)
{
this.Selection_Remove();
this.Parent.Set_CurrentElement(true, this.Get_StartPage_Absolute() + this.CurPage);
this.Parent.Set_CurrentElement(true, this.Get_StartPage_Absolute() + this.CurPage, this);
// Прячем курсор
this.DrawingDocument.TargetEnd();
......
......@@ -321,6 +321,54 @@ CFootnotesController.prototype.GetCurFootnote = function()
{
return this.CurFootnote;
};
CFootnotesController.prototype.IsInDrawing = function(X, Y, PageAbs)
{
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
var oFootnote = oResult.Footnote;
var PageRel = oFootnote.GetRelaitivePageIndex(PageAbs);
return oFootnote.Is_InDrawing(X, Y, PageRel);
}
return false;
};
CFootnotesController.prototype.IsTableBorder = function(X, Y, PageAbs)
{
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
var oFootnote = oResult.Footnote;
var PageRel = oFootnote.GetRelaitivePageIndex(PageAbs);
return oFootnote.Is_TableBorder(X, Y, PageRel);
}
return null;
};
CFootnotesController.prototype.IsInText = function(X, Y, PageAbs)
{
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
var oFootnote = oResult.Footnote;
var PageRel = oFootnote.GetRelaitivePageIndex(PageAbs);
return oFootnote.Is_InText(X, Y, PageRel);
}
return null;
};
CFootnotesController.prototype.GetNearestPos = function(X, Y, PageAbs, bAnchor, Drawing)
{
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
var oFootnote = oResult.Footnote;
var PageRel = oFootnote.GetRelaitivePageIndex(PageAbs);
return oFootnote.Get_NearestPos(PageRel, X, Y, bAnchor, Drawing);
}
return null;
};
/**
* Проверяем попадание в сноски на заданной странице.
* @param X
......@@ -527,7 +575,26 @@ CFootnotesController.prototype.Set_CurrentElement = function(bUpdateStates, Page
{
if (oFootnote instanceof CFootEndnote)
{
this.private_SetCurrentFootnoteNoSelection(oFootnote);
if (oFootnote.Is_SelectionUse())
{
this.CurFootnote = oFootnote;
this.Selection.Use = true;
this.Selection.Direction = 0;
this.Selection.Start.Footnote = oFootnote;
this.Selection.End.Footnote = oFootnote;
this.Selection.Footnotes = {};
this.Selection.Footnotes[oFootnote.Get_Id()] = oFootnote;
this.LogicDocument.Selection.Use = true;
this.LogicDocument.Selection.Start = false;
}
else
{
this.private_SetCurrentFootnoteNoSelection(oFootnote);
this.LogicDocument.Selection.Use = false;
this.LogicDocument.Selection.Start = false;
}
this.LogicDocument.Set_DocPosType(docpostype_Footnotes);
if (false != bUpdateStates)
......@@ -1880,8 +1947,6 @@ CFootnotesController.prototype.IsMovingTableBorder = function()
};
CFootnotesController.prototype.CheckPosInSelection = function(X, Y, PageAbs, NearPos)
{
// TODO: Доделать с NearPos
var oResult = this.private_GetFootnoteByXY(X, Y, PageAbs);
if (oResult)
{
......
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