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

функция для добавления/удаления пустых Run в контенте (в тч для мат объектов)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55425 954022d7-b5bf-4e40-9824-e11837661b57
parent 24327261
......@@ -115,7 +115,7 @@ ParaMath.prototype =
{
if(sText)
{
var MathRun = new ParaRun(this.Paragraph, true, this.Root);
var MathRun = new ParaRun(this.Paragraph, true);
var Pos = oElem.CurPos,
PosEnd = Pos + 1;
......@@ -982,7 +982,7 @@ ParaMath.prototype =
{
oCont.content[Start].Selection_DrawRange(0, 0, SelectionDraw);
SelectionDraw.FindStart = false;
SelectionDraw.FindStart = false; // выставляем здесь флаг, для того чтобы правильно отрисовался селект для случая пустой ран мат. объект пустой ран
SelectionDraw.W += oCont.WidthToElement[End] - oCont.WidthToElement[Start + 1]; // startPos < endPos !
oCont.content[End].Selection_DrawRange(0,0, SelectionDraw);
......
......@@ -1387,8 +1387,13 @@ CMathBase.prototype =
{
SelectionDraw.W += this.size.width;
SelectionDraw.FindStart = false;
},
SetRunEmptyToContent: function(bAll)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].SetRunEmptyToContent(bAll);
}
//////////////////////////
}
......@@ -1193,14 +1193,15 @@ CMathContent.prototype =
obj.setComposition(this.Composition);
obj.setArgSize(this.argSize);
if(this.content.length == 0)
this.content.push(obj);
/*if(this.content.length == 0)
{
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true));
//this.CurPos++;
}
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true));*/
this.content.push(obj);
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true));
//this.CurPos += 2;
......@@ -7487,6 +7488,7 @@ CMathContent.prototype =
return flag;
},
/// Position for Paragraph
Get_ParaContentPosByXY: function(SearchPos, Depth)
{
......@@ -7694,6 +7696,53 @@ CMathContent.prototype =
GetId : function()
{
return this.Id;
},
SetRunEmptyToContent: function(bAll)
{
var current = null, left = null;
var NewContent = [];
// После чтения из файла формулы, выставить курсор в конец !
var len = this.content.length;
for(var i = 0; i < len; i++)
{
current = this.content[i];
var bLeftRun = left !== null ? left.typeObj == MATH_PARA_RUN : false,
bRightRun = i < len - 1 ? this.content[i + 1].typeObj === MATH_PARA_RUN : false;
var bCurrComp = current.typeObj == MATH_COMP,
bCurrEmptyRun = current.typeObj == MATH_PARA_RUN && current.Is_Empty();
var bDeleteEmptyRun = bCurrEmptyRun && (bLeftRun || bRightRun);
if(bCurrComp && !bLeftRun) // добавление пустого Run перед мат объектом
{
NewContent.push( new ParaRun(this.Composition.Parent.Paragraph, true) );
NewContent.push( this.content[i] ); // Math Object
this.content[i].SetRunEmptyToContent(bAll);
left = current;
}
else if(! bDeleteEmptyRun )
{
NewContent.push(this.content[i]);
left = current;
}
}
if(this.content[len - 1].typeObj == MATH_COMP)
{
NewContent.push( new ParaRun(this.Composition.Parent.Paragraph, true) );
}
this.content = NewContent;
},
//////////////////////////
......
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