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

Применение текстовых настроек для добавляемых мат объектов из меню (для математического текста)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59685 954022d7-b5bf-4e40-9824-e11837661b57
parent 145764f3
......@@ -198,7 +198,7 @@ ParaMath.prototype.Add = function(Item)
else
this.Get_ParaContentPos(false, false, ContentPos);
var MathTxtPr = this.Root.GetMathTextPr(ContentPos, 0);
var TextPr = this.Root.GetMathTextPrForMenu(ContentPos, 0);
// Нам нужно разделить данный Run на 2 части
var RightRun = Run.Split2(Run.State.ContentPos);
......@@ -212,7 +212,14 @@ ParaMath.prototype.Add = function(Item)
oContent.Load_FromMenu(Item.Menu, this.Paragraph);
var lng2 = oContent.Content.length;
oContent.Set_MathTextPr2(MathTxtPr.TextPr, MathTxtPr.MathPr, false, StartPos + 1, lng2 - lng);
var Pos_ApplyTextPr =
{
StartPos: StartPos + 1,
EndPos: lng2 - lng
};
oContent.Apply_TextPr(TextPr, undefined, false, Pos_ApplyTextPr);
//oContent.Set_MathTextPr2(MathTxtPr.TextPr, MathTxtPr.MathPr, false, StartPos + 1, lng2 - lng);
}
if ((para_Text === Type || para_Space === Type) && null !== NewElement)
......
......@@ -8061,7 +8061,7 @@ ParaRun.prototype.Math_GetInfoLetter = function(Info)
else
Info.Result = false;
}
ParaRun.prototype.GetMathTextPr = function()
ParaRun.prototype.GetMathTextPrForMenu = function()
{
var TextPr = new CTextPr();
......@@ -8070,7 +8070,11 @@ ParaRun.prototype.GetMathTextPr = function()
TextPr.Merge(this.Pr);
return {TextPr: TextPr, MathPr: this.MathPrp.Copy()};
var MathTextPr = this.MathPrp.Copy();
TextPr.Set_FromObject(MathTextPr.GetBoldItalic());
return TextPr;
}
ParaRun.prototype.ApplyPoints = function(PointsInfo)
{
......
......@@ -693,20 +693,20 @@ CMathBase.prototype =
}
}
for(var i=0; i < this.nRow; i++)
// если у нас вложенный мат объект, то CtrPrp возьмутся у родительского класса
for(var i = 0 ; i < this.Content.length; i++)
{
for(var j = 0; j < this.nCol; j++)
{
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
this.Content[i].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
},
GetMathTextPr: function(ContentPos, Depth)
GetMathTextPrForMenu: function(ContentPos, Depth)
{
var pos = ContentPos.Get(Depth);
return this.Content[pos].GetMathTextPr(ContentPos, Depth+1);
return this.Content[pos].GetMathTextPrForMenu(ContentPos, Depth+1);
},
Set_MathTextPr2: function(TextPr, MathPr, bAll)
{
......
......@@ -629,6 +629,27 @@ CMPrp.prototype =
this.sty = STY_PLAIN;
else
this.sty = undefined;
},
GetBoldItalic: function()
{
var Object =
{
Italic: undefined,
Bold: undefined
};
if(this.sty == STY_BI)
{
Object.Bold = true;
}
else if(this.sty == STY_BOLD)
{
Object.Bold = true;
Object.Italic = false;
}
return Object;
}
}
......@@ -1379,13 +1400,13 @@ CMathContent.prototype =
return TextPr;
},
GetMathTextPr: function(ContentPos, Depth)
GetMathTextPrForMenu: function(ContentPos, Depth)
{
var pos = ContentPos.Get(Depth);
return this.Content[pos].GetMathTextPr(ContentPos, Depth + 1);
return this.Content[pos].GetMathTextPrForMenu(ContentPos, Depth + 1);
},
Apply_TextPr: function(TextPr, IncFontSize, ApplyToAll)
Apply_TextPr: function(TextPr, IncFontSize, ApplyToAll, PosForMenu)
{
if ( true === ApplyToAll )
{
......@@ -1394,8 +1415,20 @@ CMathContent.prototype =
}
else
{
var StartPos = this.Selection.Start;
var EndPos = this.Selection.End;
var StartPos, EndPos, bMenu = false;
if(PosForMenu !== undefined)
{
StartPos = PosForMenu.StartPos;
EndPos = PosForMenu.EndPos;
bMenu = true;
}
else
{
StartPos = this.Selection.Start;
EndPos = this.Selection.End;
}
var NewRuns;
var LRun, CRun, RRun;
......@@ -1407,7 +1440,7 @@ CMathContent.prototype =
if(FirstPos == 0)
this.ParaMath.NeedCompiledCtrPr();
if( !this.Selection.Use || (bSelectOneElement && this.Content[StartPos].Type == para_Math_Run) ) // TextPr меняем только в одном Run
if( ( !this.Selection.Use && !bMenu ) || (bSelectOneElement && this.Content[StartPos].Type == para_Math_Run) ) // TextPr меняем только в одном Run
{
var Pos = !this.Selection.Use ? this.CurPos : StartPos;
......
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