Commit 77f79041 authored by Anna.Pavlova's avatar Anna.Pavlova

Реализовала Apply_TextPr (применение текстовых настроек для MathPrp в Run)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57191 954022d7-b5bf-4e40-9824-e11837661b57
parent 33f33ed5
......@@ -392,7 +392,7 @@ ParaMath.prototype =
Check_NearestPos : function(ParaNearPos, Depth)
{
var MathNearPos = new CParagraphElementNearPos();
/*var MathNearPos = new CParagraphElementNearPos();
MathNearPos.NearPos = ParaNearPos.NearPos;
MathNearPos.Depth = Depth;
......@@ -401,7 +401,7 @@ ParaMath.prototype =
ParaNearPos.Classes.push( this );
var CurPos = ParaNearPos.NearPos.ContentPos.Get(Depth);
this.Content[CurPos].Check_NearestPos( ParaNearPos, Depth + 1 );
this.Content[CurPos].Check_NearestPos( ParaNearPos, Depth + 1 );*/
},
Get_DrawingObjectRun : function(Id)
......
......@@ -4638,12 +4638,13 @@ ParaRun.prototype =
Split_Run : function(Pos)
{
// Создаем новый ран
var NewRun = new ParaRun(this.Paragraph, this.Type == para_Math_Run);
var bMathRun = this.Type == para_Math_Run
var NewRun = new ParaRun(this.Paragraph, bMathRun);
// Копируем настройки
NewRun.Set_Pr( this.Pr.Copy() );
if(this.Type == para_Math_Run)
if(bMathRun)
NewRun.Set_MathPrp(this.MathPrp.Copy());
......@@ -5587,6 +5588,14 @@ ParaRun.prototype =
break;
}
case historyitem_ParaRun_MathStyle:
{
this.MathPrp.sty = Data.Old;
this.Recalc_CompiledPr(true);
break;
}
}
},
......@@ -5940,6 +5949,14 @@ ParaRun.prototype =
break;
}
case historyitem_ParaRun_MathStyle:
{
this.MathPrp.sty = Data.New;
this.Recalc_CompiledPr(true);
break;
}
}
},
......@@ -7438,9 +7455,9 @@ ParaRun.prototype.Apply_Style = function(Value)
if(Value !== this.MathPrp.sty)
{
var OldValue = this.MathPrp.sty;
this.MathPrp = Value;
this.MathPrp.sty = Value;
History.Add( this, { Type : historyitem_Math_Style, New : Value, Old : OldValue } );
History.Add( this, { Type : historyitem_ParaRun_MathStyle, New : Value, Old : OldValue } );
this.Recalc_CompiledPr(true);
}
......
......@@ -33,7 +33,7 @@
var historyitem_Math_AddItem = 1; // Добавляем элемент
var historyitem_Math_RemoveItem = 2; // Удаляем элемент
var historyitem_Math_Style = 3; // Меняем стиль MathPr
......@@ -808,8 +808,8 @@ CMPrp.prototype =
NewMPrp.brk = this.brk;
NewMPrp.lit = this.lit;
NewMPrp.nor = this.nor;
NewMPrp.typeText = this.sty;
NewMPrp.italic = this.scr;
NewMPrp.sty = this.sty;
NewMPrp.scr = this.scr;
return NewMPrp;
}
......@@ -4410,6 +4410,7 @@ CMathContent.prototype =
if(!bSelectRunPrp && bStartCurrRPrp)
start++;
else if(bSelectRunPrp && bStartPrevRPrp)
else if(bSelectRunPrp && bStartPrevRPrp)
start--;
......@@ -5245,7 +5246,7 @@ CMathContent.prototype =
Pos = StartPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]});
this.content.splice(Pos, 0, CRun);
CRunPos = Pos + 1;
CRunPos = Pos;
}
if(RRun !== null)
......@@ -5264,19 +5265,59 @@ CMathContent.prototype =
if(StartPos > EndPos)
{
var temp = StartPos;
EndPos = StartPos;
StartPos = temp;
StartPos = EndPos;
EndPos = temp;
}
for(var i = StartPos; i <= EndPos; i++)
for(var i = StartPos + 1; i < EndPos; i++)
this.content[i].Apply_TextPr(TextPr, IncFontSize, true );
if(this.content[EndPos].Type == para_Math_Run)
{
var elem = this.content[i];
NewRuns = this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
if( elem.Type == para_Math_Composition)
elem.Apply_TextPr( TextPr, IncFontSize, true );
else if(elem.Type == para_Math_Run)
elem.Apply_TextPr( TextPr, IncFontSize, false );
// LRun - null
CRun = NewRuns[1];
RRun = NewRuns[2];
if(RRun !== null)
{
Pos = EndPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [RRun]});
this.content.splice(Pos, 0, RRun);
}
}
else
this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, true);
if(this.content[StartPos].Type == para_Math_Run)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
LRun = NewRuns[0];
CRun = NewRuns[1];
// RRun - null
if(LRun !== null)
{
Pos = StartPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]});
this.content.splice(Pos, 0, CRun);
this.SelectStartPos++;
this.SelectEndPos++;
this.CurPos++;
}
}
else
this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, true);
}
......@@ -5744,7 +5785,7 @@ CMathContent.prototype =
this.content = Content_start.concat(Content_end);
this.CurPos = Pos - 1;
this.setPlaceholderAfterRemove(); // выставляем placeholder после удаления всех остальных элементов
//this.setPlaceholderAfterRemove(); // выставляем placeholder после удаления всех остальных элементов
break;
}
......
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