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 = ...@@ -392,7 +392,7 @@ ParaMath.prototype =
Check_NearestPos : function(ParaNearPos, Depth) Check_NearestPos : function(ParaNearPos, Depth)
{ {
var MathNearPos = new CParagraphElementNearPos(); /*var MathNearPos = new CParagraphElementNearPos();
MathNearPos.NearPos = ParaNearPos.NearPos; MathNearPos.NearPos = ParaNearPos.NearPos;
MathNearPos.Depth = Depth; MathNearPos.Depth = Depth;
...@@ -401,7 +401,7 @@ ParaMath.prototype = ...@@ -401,7 +401,7 @@ ParaMath.prototype =
ParaNearPos.Classes.push( this ); ParaNearPos.Classes.push( this );
var CurPos = ParaNearPos.NearPos.ContentPos.Get(Depth); 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) Get_DrawingObjectRun : function(Id)
......
...@@ -4638,12 +4638,13 @@ ParaRun.prototype = ...@@ -4638,12 +4638,13 @@ ParaRun.prototype =
Split_Run : function(Pos) 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() ); NewRun.Set_Pr( this.Pr.Copy() );
if(this.Type == para_Math_Run) if(bMathRun)
NewRun.Set_MathPrp(this.MathPrp.Copy()); NewRun.Set_MathPrp(this.MathPrp.Copy());
...@@ -5587,6 +5588,14 @@ ParaRun.prototype = ...@@ -5587,6 +5588,14 @@ ParaRun.prototype =
break; break;
} }
case historyitem_ParaRun_MathStyle:
{
this.MathPrp.sty = Data.Old;
this.Recalc_CompiledPr(true);
break;
}
} }
}, },
...@@ -5940,6 +5949,14 @@ ParaRun.prototype = ...@@ -5940,6 +5949,14 @@ ParaRun.prototype =
break; break;
} }
case historyitem_ParaRun_MathStyle:
{
this.MathPrp.sty = Data.New;
this.Recalc_CompiledPr(true);
break;
}
} }
}, },
...@@ -7437,10 +7454,10 @@ ParaRun.prototype.Apply_Style = function(Value) ...@@ -7437,10 +7454,10 @@ ParaRun.prototype.Apply_Style = function(Value)
{ {
if(Value !== this.MathPrp.sty) if(Value !== this.MathPrp.sty)
{ {
var OldValue = 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); this.Recalc_CompiledPr(true);
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
var historyitem_Math_AddItem = 1; // Добавляем элемент var historyitem_Math_AddItem = 1; // Добавляем элемент
var historyitem_Math_RemoveItem = 2; // Удаляем элемент var historyitem_Math_RemoveItem = 2; // Удаляем элемент
var historyitem_Math_Style = 3; // Меняем стиль MathPr
...@@ -808,8 +808,8 @@ CMPrp.prototype = ...@@ -808,8 +808,8 @@ CMPrp.prototype =
NewMPrp.brk = this.brk; NewMPrp.brk = this.brk;
NewMPrp.lit = this.lit; NewMPrp.lit = this.lit;
NewMPrp.nor = this.nor; NewMPrp.nor = this.nor;
NewMPrp.typeText = this.sty; NewMPrp.sty = this.sty;
NewMPrp.italic = this.scr; NewMPrp.scr = this.scr;
return NewMPrp; return NewMPrp;
} }
...@@ -4410,6 +4410,7 @@ CMathContent.prototype = ...@@ -4410,6 +4410,7 @@ CMathContent.prototype =
if(!bSelectRunPrp && bStartCurrRPrp) if(!bSelectRunPrp && bStartCurrRPrp)
start++; start++;
else if(bSelectRunPrp && bStartPrevRPrp)
else if(bSelectRunPrp && bStartPrevRPrp) else if(bSelectRunPrp && bStartPrevRPrp)
start--; start--;
...@@ -5245,7 +5246,7 @@ CMathContent.prototype = ...@@ -5245,7 +5246,7 @@ CMathContent.prototype =
Pos = StartPos + 1; Pos = StartPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]}); History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]});
this.content.splice(Pos, 0, CRun); this.content.splice(Pos, 0, CRun);
CRunPos = Pos + 1; CRunPos = Pos;
} }
if(RRun !== null) if(RRun !== null)
...@@ -5264,19 +5265,59 @@ CMathContent.prototype = ...@@ -5264,19 +5265,59 @@ CMathContent.prototype =
if(StartPos > EndPos) if(StartPos > EndPos)
{ {
var temp = StartPos; var temp = StartPos;
EndPos = StartPos; StartPos = EndPos;
StartPos = temp; 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);
// 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);
}
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 );
} }
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 = ...@@ -5744,7 +5785,7 @@ CMathContent.prototype =
this.content = Content_start.concat(Content_end); this.content = Content_start.concat(Content_end);
this.CurPos = Pos - 1; this.CurPos = Pos - 1;
this.setPlaceholderAfterRemove(); // выставляем placeholder после удаления всех остальных элементов //this.setPlaceholderAfterRemove(); // выставляем placeholder после удаления всех остальных элементов
break; 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