lab.nexedi.com will be down from Thursday, 20 March 2025, 07:30:00 UTC for a duration of approximately 2 hours

Commit 07911390 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлен баг с позиционированием курсора в местах обтекания текста вокруг автофигур (баг 27112).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59367 954022d7-b5bf-4e40-9824-e11837661b57
parent c0781f3c
...@@ -1199,6 +1199,11 @@ ParaComment.prototype = ...@@ -1199,6 +1199,11 @@ ParaComment.prototype =
return false; return false;
}, },
Get_ElementByPos : function(ContentPos, Depth)
{
return this;
},
Get_PosByDrawing : function(Id, ContentPos, Depth) Get_PosByDrawing : function(Id, ContentPos, Depth)
{ {
......
...@@ -1474,6 +1474,15 @@ ParaHyperlink.prototype.Get_PosByElement = function(Class, ContentPos, Depth, Us ...@@ -1474,6 +1474,15 @@ ParaHyperlink.prototype.Get_PosByElement = function(Class, ContentPos, Depth, Us
return false; return false;
}; };
ParaHyperlink.prototype.Get_ElementByPos = function(ContentPos, Depth)
{
if (Depth + 1 >= ContentPos.Depth)
return this;
var CurPos = ContentPos.Get(Depth);
return this.Content[CurPos].Get_ElementByPos(ContentPos, Depth + 1);
};
ParaHyperlink.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth) ParaHyperlink.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth)
{ {
var Count = this.Content.length; var Count = this.Content.length;
...@@ -2348,7 +2357,6 @@ ParaHyperlink.prototype.Write_ToBinary2SpreadSheets = function(Writer) ...@@ -2348,7 +2357,6 @@ ParaHyperlink.prototype.Write_ToBinary2SpreadSheets = function(Writer)
Writer.WriteLong(0); Writer.WriteLong(0);
}; };
function CParaHyperLinkStartState(HyperLink) function CParaHyperLinkStartState(HyperLink)
{ {
this.Value = HyperLink.Value; this.Value = HyperLink.Value;
......
...@@ -1407,6 +1407,13 @@ ParaMath.prototype.Get_PosByElement = function(Class, ContentPos, Depth, UseRang ...@@ -1407,6 +1407,13 @@ ParaMath.prototype.Get_PosByElement = function(Class, ContentPos, Depth, UseRang
return true; return true;
// TODO: ParaMath.Get_PosByElement // TODO: ParaMath.Get_PosByElement
return false;
};
ParaMath.prototype.Get_ElementByPos = function(ContentPos, Depth)
{
return this.Root.Get_ElementByPos(ContentPos, Depth);
}; };
ParaMath.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth) ParaMath.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth)
......
...@@ -3314,6 +3314,8 @@ Paragraph.prototype = ...@@ -3314,6 +3314,8 @@ Paragraph.prototype =
this.Content[CurPos].Cursor_MoveToStartPos(false); this.Content[CurPos].Cursor_MoveToStartPos(false);
} }
this.private_CorrectCurPosRangeLine();
this.CurPos.ContentPos = CurPos; this.CurPos.ContentPos = CurPos;
}, },
...@@ -12119,6 +12121,65 @@ Paragraph.prototype.private_ResetSelection = function() ...@@ -12119,6 +12121,65 @@ Paragraph.prototype.private_ResetSelection = function()
this.CurPos.ContentPos = 0; this.CurPos.ContentPos = 0;
}; };
Paragraph.prototype.private_CorrectCurPosRangeLine = function()
{
if (-1 !== this.CurPos.Line)
return;
// В данной функции мы подбираем для курсора подходящие физическое расположение, если логическое расположение
// предполагает несколько физических позиций (например начало/конец строки или попадание между обтеканием).
var ParaCurPos = this.Get_ParaContentPos(false, false);
var Ranges = this.Get_RangesByPos(ParaCurPos);
this.CurPos.Line = -1;
this.CurPos.Range = -1;
for (var Index = 0, Count = Ranges.length; Index < Count; Index++)
{
var RangeIndex = Ranges[Index].Range;
var LineIndex = Ranges[Index].Line;
var Range = this.Lines[LineIndex].Ranges[RangeIndex];
if (Range.W > 0)
{
this.CurPos.Line = LineIndex;
this.CurPos.Range = RangeIndex;
break;
}
}
};
/**
* Получаем массив отрезков, в которые попадает заданная позиция. Их может быть больше 1, например,
* на месте разрыва строки.
* @param ContentPos - заданная позиция
* @returns массив отрезков
*/
Paragraph.prototype.Get_RangesByPos = function(ContentPos)
{
var Run = this.Get_ElementByPos(ContentPos);
if (null === Run || para_Run !== Run.Type)
return [];
return Run.Get_RangesByPos(ContentPos.Get(ContentPos.Depth - 1));
};
/**
* Получаем элемент по заданной позиции
* @param ContentPos - заданная позиция
* @returns ссылка на элемент
*/
Paragraph.prototype.Get_ElementByPos = function(ContentPos)
{
if (ContentPos.Depth <= 1)
return this;
var CurPos = ContentPos.Get(0);
return this.Content[CurPos].Get_ElementByPos(ContentPos, 1);
};
var pararecalc_0_All = 0; var pararecalc_0_All = 0;
var pararecalc_0_None = 1; var pararecalc_0_None = 1;
......
This diff is collapsed.
...@@ -738,7 +738,8 @@ CMathBase.prototype = ...@@ -738,7 +738,8 @@ CMathBase.prototype =
} }
////////////////////////// //////////////////////////
}; };
CMathBase.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph; CMathBase.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph;
CMathBase.prototype.Get_ElementByPos = ParaHyperlink.prototype.Get_ElementByPos;
CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine) CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine)
{ {
for (var nPos = 0, nCount = this.Content.length; nPos < nCount; nPos++) for (var nPos = 0, nCount = this.Content.length; nPos < nCount; nPos++)
......
...@@ -2020,7 +2020,8 @@ CMathContent.prototype = ...@@ -2020,7 +2020,8 @@ CMathContent.prototype =
this.Correct_ContentPos(-1); this.Correct_ContentPos(-1);
} }
}; };
CMathContent.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph; CMathContent.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph;
CMathContent.prototype.Get_ElementByPos = ParaHyperlink.prototype.Get_ElementByPos;
CMathContent.prototype.Load_FromMenu = function(Type, Paragraph) CMathContent.prototype.Load_FromMenu = function(Type, Paragraph)
{ {
this.Paragraph = Paragraph; this.Paragraph = Paragraph;
......
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