Commit 795cdc5a authored by Ilya.Kirillov's avatar Ilya.Kirillov

Переделана функция определения попадания курсора в селект в классе CParagraph,...

Переделана функция определения попадания курсора в селект в классе CParagraph, теперь зацепление выделенного текста в формулах работает правильно.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58920 954022d7-b5bf-4e40-9824-e11837661b57
parent a0b78397
......@@ -1284,6 +1284,11 @@ ParaComment.prototype =
{
return true;
},
Selection_CheckParaContentPos : function(ContentPos)
{
return true;
},
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -1876,6 +1876,18 @@ ParaHyperlink.prototype.Selection_CheckParaEnd = function()
return false;
};
ParaHyperlink.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
var CurPos = ContentPos.Get(Depth);
if (this.Selection.StartPos <= CurPos && CurPos <= this.Selection.EndPos)
return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth + 1, bStart && this.Selection.StartPos === CurPos, bEnd && CurPos === this.Selection.EndPos);
else if (this.Selection.EndPos <= CurPos && CurPos <= this.Selection.StartPos)
return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth + 1, bStart && this.Selection.EndPos === CurPos, bEnd && CurPos === this.Selection.StartPos);
return false;
};
ParaHyperlink.prototype.Is_SelectedAll = function(Props)
{
var Selection = this.State.Selection;
......
......@@ -1206,14 +1206,14 @@ ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
var CurX = SearchPos.CurX;
Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
SearchPos.InText = true;
SearchPos.DiffX = 0.001;
SearchPos.InTextPos = SearchPos.Pos.Copy();
SearchPos.InTextPos.Copy_FromDepth(SearchPos.Pos, Depth);
}
SearchPos.CurX = CurX + Dx;
......@@ -1413,6 +1413,11 @@ ParaMath.prototype.Selection_CheckParaEnd = function()
return false;
};
ParaMath.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
return this.Root.Selection_CheckParaContentPos(ContentPos, Depth, bStart, bEnd);
};
ParaMath.prototype.Is_SelectedAll = function(Props)
{
// TODO: ParaMath.Is_SelectedAll
......
......@@ -5850,7 +5850,7 @@ Paragraph.prototype =
if ( undefined !== NearPos )
{
if ( this === NearPos.Paragraph && ( ( true === this.Selection.Use && ((NearPos.ContentPos.Compare( SelSP ) >= 0 && NearPos.ContentPos.Compare( SelEP ) <= 0) || (NearPos.SearchPos.Compare( SelSP ) >= 0 && NearPos.SearchPos.Compare( SelEP ) <= 0)) ) || true === this.ApplyToAll ) )
if (this === NearPos.Paragraph && ((true === this.Selection.Use && true === this.Selection_CheckParaContentPos(NearPos.ContentPos)) || true === this.ApplyToAll))
return true;
return false;
......@@ -5865,10 +5865,7 @@ Paragraph.prototype =
if ( true === SearchPosXY.InText )
{
var CurPos = SearchPosXY.InTextPos.Get(0);
if ( SearchPosXY.InTextPos.Compare( SelSP ) >= 0 && SearchPosXY.InTextPos.Compare( SelEP ) <= 0 && ( para_Math !== this.Content[CurPos].Type || true !== this.Content[CurPos].Selection_IsPlaceholder() ) )
return true;
return this.Selection_CheckParaContentPos(SearchPosXY.InTextPos);
}
return false;
......@@ -5877,6 +5874,23 @@ Paragraph.prototype =
return false;
},
/**
* Проверяем попадание заданной позиции в селект. Сравнение стартовой и конечной позиций с заданной не совпадает
* с работой данной функии, например в формулах.
* @param ContentPos Заданная позиция в параграфе.
*/
Selection_CheckParaContentPos : function(ContentPos)
{
var CurPos = ContentPos.Get(0);
if (this.Selection.StartPos <= CurPos && CurPos <= this.Selection.EndPos)
return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, 1, this.Selection.StartPos === CurPos, CurPos === this.Selection.EndPos);
else (this.Selection.EndPos <= CurPos && CurPos <= this.Selection.StartPos)
return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, 1, this.Selection.EndPos === CurPos, CurPos === this.Selection.StartPos);
return false;
},
Selection_CalculateTextPr : function()
{
if ( true === this.Selection.Use || true === this.ApplyToAll )
......@@ -12372,6 +12386,17 @@ CParagraphContentPos.prototype =
return PRPos;
},
Copy_FromDepth : function(ContentPos, Depth)
{
var Count = ContentPos.Data.length;
for (var CurDepth = Depth; CurDepth < Count; CurDepth++)
{
this.Update2(ContentPos.Data[CurDepth], CurDepth);
}
this.Depth = ContentPos.Depth;
},
Compare : function(Pos)
{
var CurDepth = 0;
......
......@@ -4524,6 +4524,26 @@ ParaRun.prototype.Selection_CheckParaEnd = function()
return false;
};
ParaRun.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
var CurPos = ContentPos.Get(Depth);
if (this.Selection.StartPos <= this.Selection.EndPos && this.Selection.StartPos <= CurPos && CurPos <= this.Selection.EndPos)
{
if (((true !== bEnd) || (true === bEnd && CurPos !== this.Selection.EndPos)) &&
((true !== bStart) || (true === bStart && CurPos !== this.Selection.StartPos)))
return true;
}
else if (this.Selection.StartPos > this.Selection.EndPos && this.Selection.EndPos <= CurPos && CurPos <= this.Selection.StartPos)
{
if (((true !== bEnd) || (true === bEnd && CurPos !== this.Selection.StartPos)) &&
((true !== bStart) || (true === bStart && CurPos !== this.Selection.EndPos)))
return true;
}
return false;
};
//-----------------------------------------------------------------------------------
// Функции для работы с настройками текста свойств
//-----------------------------------------------------------------------------------
......
......@@ -613,7 +613,6 @@ CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine)
this.Content[nPos].Recalculate_Reset(StartRange, StartLine);
}
};
CMathBase.prototype.Fill_LogicalContent = function(nCount)
{
for (var nIndex = 0; nIndex < nCount; nIndex++)
......@@ -741,7 +740,6 @@ CMathBase.prototype.Create_FontMap = function(Map)
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; nIndex++)
this.Content[nIndex].Create_FontMap(Map);
};
CMathBase.prototype.Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
return this.Content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
......@@ -849,13 +847,28 @@ CMathBase.prototype.Select_WholeElement = function()
if (null !== this.Parent)
this.Parent.Select_Element(this);
};
CMathBase.prototype.Set_SelectionContentPos = ParaHyperlink.prototype.Set_SelectionContentPos;
CMathBase.prototype.Get_LeftPos = ParaHyperlink.prototype.Get_LeftPos;
CMathBase.prototype.Get_RightPos = ParaHyperlink.prototype.Get_RightPos;
CMathBase.prototype.Get_WordStartPos = ParaHyperlink.prototype.Get_WordStartPos;
CMathBase.prototype.Get_WordEndPos = ParaHyperlink.prototype.Get_WordEndPos;
CMathBase.prototype.Selection_Remove = ParaHyperlink.prototype.Selection_Remove;
CMathBase.prototype.Select_All = ParaHyperlink.prototype.Select_All;
CMathBase.prototype.Set_SelectionContentPos = ParaHyperlink.prototype.Set_SelectionContentPos;
CMathBase.prototype.Get_LeftPos = ParaHyperlink.prototype.Get_LeftPos;
CMathBase.prototype.Get_RightPos = ParaHyperlink.prototype.Get_RightPos;
CMathBase.prototype.Get_WordStartPos = ParaHyperlink.prototype.Get_WordStartPos;
CMathBase.prototype.Get_WordEndPos = ParaHyperlink.prototype.Get_WordEndPos;
CMathBase.prototype.Selection_Remove = ParaHyperlink.prototype.Selection_Remove;
CMathBase.prototype.Select_All = ParaHyperlink.prototype.Select_All;
CMathBase.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
if (true !== this.Selection.Use)
return false;
var CurPos = ContentPos.Get(Depth);
if (this.Selection.StartPos === this.Selection.EndPos && this.Selection.StartPos === CurPos)
return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth + 1, bStart, bEnd);
if (this.Selection.StartPos !== this.Selection.EndPos)
return true;
return false;
};
function CMathBasePr()
{
......
......@@ -4361,4 +4361,15 @@ CMathContent.prototype.Get_AllFontNames = function(AllFonts)
{
for (var nIndex = 0, nCount = this.content.length; nIndex < nCount; nIndex++)
this.content[nIndex].Get_AllFontNames(AllFonts);
};
CMathContent.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
var CurPos = ContentPos.Get(Depth);
if (this.Selection.Start <= CurPos && CurPos <= this.Selection.End)
return this.content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth + 1, bStart && this.Selection.Start === CurPos, bEnd && CurPos === this.Selection.End);
else if (this.Selection.End <= CurPos && CurPos <= this.Selection.Start)
return this.content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth + 1, bStart && this.Selection.End === CurPos, bEnd && CurPos === this.Selection.Start);
return false;
};
\ No newline at end of file
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