Commit 0a5bc188 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

к rev 68326

Поправлен баг: проверка на ForcedBreak для контекстного меню при селекте нескольких элементов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68330 954022d7-b5bf-4e40-9824-e11837661b57
parent d27ea799
......@@ -4729,9 +4729,37 @@ CMathContent.prototype.Check_Composition = function()
return Pos !== null && this.Content[Pos].Type == para_Math_Composition;
};
CMathContent.prototype.Can_ModifyForcedBreak = function(Pr)
{
var Pos = this.private_GetPosRunForForcedBreak();
if(Pos !== null && this.bOneLine == false)
{
var bBreakOperator = this.Content[Pos].Check_ForcedBreak();
var CurrentRun = this.Content[Pos];
var bCanCheckNearsRun = bBreakOperator == false && false == CurrentRun.Is_SelectionUse();
var bPrevItem = bCanCheckNearsRun && Pos > 0 && true == CurrentRun.Cursor_Is_Start(),
bNextItem = bCanCheckNearsRun && Pos < this.Content.length - 1 && true == CurrentRun.Cursor_Is_End();
var bPrevRun = bPrevItem && this.Content[Pos - 1].Type == para_Math_Run,
bNextRun = bNextItem && this.Content[Pos + 1].Type == para_Math_Run;
if(bBreakOperator)
{
this.Content[Pos].Math_Can_ModidyForcedBreak(Pr);
}
else if(bPrevRun)
{
this.Content[Pos - 1].Math_Can_ModidyForcedBreak(Pr, true, false);
}
else if(bNextRun)
{
this.Content[Pos + 1].Math_Can_ModidyForcedBreak(Pr, false, true);
}
}
};
CMathContent.prototype.private_GetPosRunForForcedBreak = function()
{
var Pos = null;
var CurPos;
if(true === this.Selection.Use)
{
......@@ -4745,15 +4773,24 @@ CMathContent.prototype.Can_ModifyForcedBreak = function(Pr)
}
var bFirstItem = false;
for(CurPos = StartPos; CurPos <= EndPos; CurPos++)
var bHaveSelectedItem = false;
for(var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
if(true !== this.Content[CurPos].Selection_IsEmpty())
var Item = this.Content[CurPos];
var bSelect = true !== Item.Selection_IsEmpty(),
bSelectRun = bSelect == true && Item.Type == para_Math_Run,
bSelectComp = bSelect == true && Item.Type == para_Math_Composition;
var bSelectManyRuns = bSelectRun && bHaveSelectedItem;
if(bSelectComp || bSelectManyRuns)
{
if(bFirstItem == true)
Pos = null;
break;
}
bFirstItem = true;
if(bSelectRun)
{
bHaveSelectedItem = true;
Pos = CurPos;
}
}
......@@ -4763,31 +4800,7 @@ CMathContent.prototype.Can_ModifyForcedBreak = function(Pr)
Pos = this.CurPos;
}
if(Pos !== null && this.bOneLine == false)
{
var bBreakOperator = this.Content[Pos].Check_ForcedBreak();
var CurrentRun = this.Content[Pos];
var bCanCheckNearsRun = bBreakOperator == false && false == CurrentRun.Is_SelectionUse();
var bPrevItem = bCanCheckNearsRun && Pos > 0 && true == CurrentRun.Cursor_Is_Start(),
bNextItem = bCanCheckNearsRun && Pos < this.Content.length - 1 && true == CurrentRun.Cursor_Is_End();
var bPrevRun = bPrevItem && this.Content[Pos - 1].Type == para_Math_Run,
bNextRun = bNextItem && this.Content[Pos + 1].Type == para_Math_Run;
if(bBreakOperator)
{
this.Content[Pos].Math_Can_ModidyForcedBreak(Pr);
}
else if(bPrevRun)
{
this.Content[Pos - 1].Math_Can_ModidyForcedBreak(Pr, true, false);
}
else if(bNextRun)
{
this.Content[Pos + 1].Math_Can_ModidyForcedBreak(Pr, false, true);
}
}
return Pos;
};
CMathContent.prototype.private_FindCurrentPosInContent = function()
{
......
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