Commit a7ff4aea authored by Anna.Pavlova's avatar Anna.Pavlova

1. Убрала лишние копирования CtrPr

2. Убрала функцию Apply_TextPrForRunEmpty из CMathContent

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66499 954022d7-b5bf-4e40-9824-e11837661b57
parent 2345feb9
...@@ -672,8 +672,8 @@ ParaMath.prototype.Add = function(Item) ...@@ -672,8 +672,8 @@ ParaMath.prototype.Add = function(Item)
if(oContent.bRoot == false && Run.IsPlaceholder()) if(oContent.bRoot == false && Run.IsPlaceholder())
{ {
var ctrPrp = oContent.Parent.Get_CtrPrp(); // копия ctrPrp var CtrRunPr = oContent.Get_ParentCtrRunPr(false); // ctrPrp (не копия)
Run.Apply_TextPr(ctrPrp, undefined, true); Run.Apply_TextPr(CtrRunPr, undefined, true);
} }
if(Item.Value == 38) if(Item.Value == 38)
......
...@@ -23,6 +23,7 @@ function CMathBase(bInside) ...@@ -23,6 +23,7 @@ function CMathBase(bInside)
this.CtrPrp = new CTextPr(); this.CtrPrp = new CTextPr();
this.CompiledCtrPrp = new CTextPr(); this.CompiledCtrPrp = new CTextPr();
this.TextPrControlLetter = new CTextPr(); this.TextPrControlLetter = new CTextPr();
//this.CtrPr = new CCtrPr();
this.ArgSize = new CMathArgSize(); this.ArgSize = new CMathArgSize();
...@@ -125,13 +126,13 @@ CMathBase.prototype.setCtrPrp = function(txtPrp) // выставляем ctrPrp ...@@ -125,13 +126,13 @@ CMathBase.prototype.setCtrPrp = function(txtPrp) // выставляем ctrPrp
this.CtrPrp.Merge(txtPrp); this.CtrPrp.Merge(txtPrp);
} }
}; };
CMathBase.prototype.Get_CtrPrp = function() CMathBase.prototype.Get_CtrPrp = function(bCopy)
{ {
var CtrPrp; var CtrPrp;
if(this.bInside === true) if(this.bInside === true)
CtrPrp = this.Parent.Get_CtrPrp(); CtrPrp = this.Parent.Get_CtrPrp(bCopy);
else else
CtrPrp = this.CtrPrp.Copy(); CtrPrp = bCopy ? this.CtrPrp.Copy() : this.CtrPrp;
return CtrPrp; return CtrPrp;
}; };
...@@ -2592,7 +2593,6 @@ function CEmptyRunRecalculateObject(StartLine, StartRange) ...@@ -2592,7 +2593,6 @@ function CEmptyRunRecalculateObject(StartLine, StartRange)
this.WrapState = ALIGN_EMPTY; this.WrapState = ALIGN_EMPTY;
} }
CEmptyRunRecalculateObject.prototype = CEmptyRunRecalculateObject.prototype =
{ {
Save_Lines : function(Obj, Copy) Save_Lines : function(Obj, Copy)
......
...@@ -745,7 +745,7 @@ CMathContent.prototype.init = function() ...@@ -745,7 +745,7 @@ CMathContent.prototype.init = function()
{ {
}; };
CMathContent.prototype.addElementToContent = function(obj) //for "read" CMathContent.prototype.addElementToContent = function(obj)
{ {
this.Internal_Content_Add(this.Content.length, obj, false); this.Internal_Content_Add(this.Content.length, obj, false);
this.CurPos = this.Content.length-1; this.CurPos = this.Content.length-1;
...@@ -1141,74 +1141,76 @@ CMathContent.prototype.private_CorrectContent = function() ...@@ -1141,74 +1141,76 @@ CMathContent.prototype.private_CorrectContent = function()
{ {
var len = this.Content.length; var len = this.Content.length;
var current = null; var EmptyRun = null;
var emptyRun; var RPr = null;
var CurrPos = 0;
var currPos = 0; while(CurrPos < len)
while(currPos < len)
{ {
current = this.Content[currPos]; var Current = this.Content[CurrPos];
var bLeftRun = currPos > 0 ? this.Content[currPos-1].Type == para_Math_Run : false, var bLeftRun = CurrPos > 0 ? this.Content[CurrPos-1].Type == para_Math_Run : false,
bRightRun = currPos < len - 1 ? this.Content[currPos + 1].Type === para_Math_Run : false; bRightRun = CurrPos < len - 1 ? this.Content[CurrPos + 1].Type === para_Math_Run : false;
var bCurrComp = current.Type == para_Math_Composition, var bCurrComp = Current.Type == para_Math_Composition,
bCurrEmptyRun = current.Type == para_Math_Run && current.Is_Empty(); bCurrEmptyRun = Current.Type == para_Math_Run && Current.Is_Empty();
var bDeleteEmptyRun = bCurrEmptyRun && (bLeftRun || bRightRun); var bDeleteEmptyRun = bCurrEmptyRun && (bLeftRun || bRightRun);
if(bCurrComp && !bLeftRun) if(bCurrComp && !bLeftRun)
{ {
emptyRun = new ParaRun(null, true); EmptyRun = new ParaRun(null, true);
emptyRun.Set_RFont_ForMathRun(); EmptyRun.Set_RFont_ForMathRun();
this.Apply_TextPrForRunEmpty(emptyRun, current); //this.Apply_TextPrForRunEmpty(EmptyRun, Current);
this.Internal_Content_Add(currPos, emptyRun); RPr = Current.Get_CtrPrp(false);
currPos += 2; EmptyRun.Apply_Pr(RPr);
this.Internal_Content_Add(CurrPos, EmptyRun);
CurrPos += 2;
} }
else if(bDeleteEmptyRun && false == current.Is_CheckingNearestPos()) // если NearPosArray не нулевой длины, то это вызов происходит на Insert_Content, не удаляем пустые Run else if(bDeleteEmptyRun && false == Current.Is_CheckingNearestPos()) // если NearPosArray не нулевой длины, то это вызов происходит на Insert_Content, не удаляем пустые Run
{ {
this.Remove_FromContent(currPos, 1); this.Remove_FromContent(CurrPos, 1);
if (this.CurPos === currPos) if (this.CurPos === CurrPos)
{ {
if (bLeftRun) if (bLeftRun)
{ {
this.CurPos = currPos - 1; this.CurPos = CurrPos - 1;
this.Content[this.CurPos].Cursor_MoveToEndPos(false); this.Content[this.CurPos].Cursor_MoveToEndPos(false);
} }
else else
{ {
this.CurPos = currPos; this.CurPos = CurrPos;
this.Content[this.CurPos].Cursor_MoveToStartPos(); this.Content[this.CurPos].Cursor_MoveToStartPos();
} }
} }
} }
else else
{ {
currPos++; CurrPos++;
} }
len = this.Content.length; len = this.Content.length;
} }
if(len > 1) if(len > 1)
{ {
if(this.Content[len - 1].Type == para_Math_Composition) if(this.Content[len - 1].Type == para_Math_Composition)
{ {
emptyRun = new ParaRun(null, true); EmptyRun = new ParaRun(null, true);
emptyRun.Set_RFont_ForMathRun(); EmptyRun.Set_RFont_ForMathRun();
this.Apply_TextPrForRunEmpty(emptyRun, this.Content[len - 1]); //this.Apply_TextPrForRunEmpty(EmptyRun, this.Content[len - 1]);
this.Internal_Content_Add(currPos, emptyRun); RPr = this.Content[len - 1].Get_CtrPrp(false);
EmptyRun.Apply_Pr(RPr);
this.Internal_Content_Add(CurrPos, EmptyRun);
} }
} }
}; };
CMathContent.prototype.Apply_TextPrForRunEmpty = function(emptyRun, Composition) /*CMathContent.prototype.Apply_TextPrForRunEmpty = function(emptyRun, Composition)
{ {
var ctrPrp = Composition.Get_CtrPrp(); var ctrPrp = Composition.Get_CtrPrp();
...@@ -1222,7 +1224,7 @@ CMathContent.prototype.Apply_TextPrForRunEmpty = function(emptyRun, Composition) ...@@ -1222,7 +1224,7 @@ CMathContent.prototype.Apply_TextPrForRunEmpty = function(emptyRun, Composition)
ctrPrp.Italic = undefined; ctrPrp.Italic = undefined;
emptyRun.Set_Pr(ctrPrp); emptyRun.Set_Pr(ctrPrp);
}; };*/
CMathContent.prototype.Correct_Content = function(bInnerCorrection) CMathContent.prototype.Correct_Content = function(bInnerCorrection)
{ {
if (true === bInnerCorrection) if (true === bInnerCorrection)
...@@ -1347,12 +1349,16 @@ CMathContent.prototype.Get_TextPr = function(ContentPos, Depth) ...@@ -1347,12 +1349,16 @@ CMathContent.prototype.Get_TextPr = function(ContentPos, Depth)
var TextPr; var TextPr;
if(this.IsPlaceholder()) if(this.IsPlaceholder())
TextPr = this.Parent.Get_CtrPrp(); TextPr = this.Parent.Get_CtrPrp(true);
else else
TextPr = this.Content[pos].Get_TextPr(ContentPos, Depth + 1); TextPr = this.Content[pos].Get_TextPr(ContentPos, Depth + 1);
return TextPr; return TextPr;
}; };
CMathContent.prototype.Get_ParentCtrRunPr = function(bCopy)
{
return this.Parent.Get_CtrPrp(bCopy);
};
CMathContent.prototype.Get_CompiledTextPr = function(Copy, bAll) CMathContent.prototype.Get_CompiledTextPr = function(Copy, bAll)
{ {
var TextPr = null; var TextPr = null;
...@@ -1489,7 +1495,7 @@ CMathContent.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll, ...@@ -1489,7 +1495,7 @@ CMathContent.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll,
this.Selection.EndPos = CRunPos; this.Selection.EndPos = CRunPos;
} }
else if(bSelectOneElement && this.Content[StartPos].Type == para_Math_Composition) else if(bSelectOneElement && this.Content[StartPos].Type == para_Math_Composition) // заселекчен только один мат. объект
{ {
this.Content[StartPos].Apply_TextPr(TextPr, IncFontSize, true); this.Content[StartPos].Apply_TextPr(TextPr, IncFontSize, true);
} }
......
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