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

1. Поправлен баг с gaps : неправильный размер ctrPrp подхватывался на первом пересчете

2. Поправлен баг на открытие CDegree (в связи с последними правками)
3. Поправлено свойство chr для CAccent, CNary : string to Unicode


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56922 954022d7-b5bf-4e40-9824-e11837661b57
parent a633b4d9
...@@ -518,7 +518,6 @@ ParaMath.prototype = ...@@ -518,7 +518,6 @@ ParaMath.prototype =
this.Root.Resize(null, this, g_oTextMeasurer, TextPr); this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
var pos = new CMathPosition(); var pos = new CMathPosition();
pos.x = 0; pos.x = 0;
pos.y = 0; pos.y = 0;
...@@ -987,7 +986,7 @@ ParaMath.prototype = ...@@ -987,7 +986,7 @@ ParaMath.prototype =
},*/ },*/
GetFirstRPrp: function() GetFirstRPrp: function()
{ {
return this.Root.getFirstRPrp(); return this.Root.getFirstRPrp(this);
}, },
GetShiftCenter: function(oMeasure, font) GetShiftCenter: function(oMeasure, font)
{ {
......
...@@ -1099,21 +1099,23 @@ CAccent.prototype.setPosition = function(pos) ...@@ -1099,21 +1099,23 @@ CAccent.prototype.setPosition = function(pos)
} }
CAccent.prototype.getPropsForWrite = function() CAccent.prototype.getPropsForWrite = function()
{ {
var props = {}; /*var props = {};
props.chr = String.fromCharCode(this.code); props.chr = String.fromCharCode(this.code);
return props; return props;*/
return this.Pr;
} }
CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure) CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
{ {
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
if(this.RecalcInfo.bCtrPrp == true) /*if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
} }*/
if(this.RecalcInfo.bProps == true) if(this.RecalcInfo.bProps == true)
{ {
...@@ -1131,8 +1133,8 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1131,8 +1133,8 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.operator.mergeProperties(prp, defaultPrp); this.operator.mergeProperties(prp, defaultPrp);
this.Pr.chr = String.fromCharCode(this.operator.code); /*this.Pr.chr = String.fromCharCode(this.operator.code);
this.Pr.chrType = this.operator.typeOper; this.Pr.chrType = this.operator.typeOper;*/
} }
this.operator.relate(this); this.operator.relate(this);
......
...@@ -121,9 +121,9 @@ CMathBase.prototype = ...@@ -121,9 +121,9 @@ CMathBase.prototype =
{ {
return this.CtrPrp.Copy(); return this.CtrPrp.Copy();
}, },
Set_CompiledCtrPrp: function() Set_CompiledCtrPrp: function(ParaMath)
{ {
var defaultRPrp = this.ParaMath.GetFirstRPrp(); var defaultRPrp = ParaMath.GetFirstRPrp();
this.CompiledCtrPrp.Merge(defaultRPrp); this.CompiledCtrPrp.Merge(defaultRPrp);
this.CompiledCtrPrp.Merge(this.CtrPrp); this.CompiledCtrPrp.Merge(this.CtrPrp);
...@@ -139,12 +139,11 @@ CMathBase.prototype = ...@@ -139,12 +139,11 @@ CMathBase.prototype =
{ {
return this.CompiledCtrPrp.Copy(); return this.CompiledCtrPrp.Copy();
}, },
// TO DO
// пересмотреть getCtrPrpForFirst: function(ParaMath)
getCtrPrpForFirst: function()
{ {
var ctrPrp = new CTextPr(); var ctrPrp = new CTextPr();
var defaultRPrp = this.ParaMath.Get_Default_TPrp(); var defaultRPrp = ParaMath.Get_Default_TPrp();
//var gWPrp = defaultRPrp.getMergedWPrp(); //var gWPrp = defaultRPrp.getMergedWPrp();
ctrPrp.Merge(defaultRPrp); ctrPrp.Merge(defaultRPrp);
ctrPrp.Merge(this.CtrPrp); ctrPrp.Merge(this.CtrPrp);
...@@ -1001,18 +1000,20 @@ CMathBase.prototype = ...@@ -1001,18 +1000,20 @@ CMathBase.prototype =
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].Resize(this, ParaMath, oMeasure);
this.recalculateSize(oMeasure); // передаем oMeasure, для
},
CompiledCtrPrp: function()
{
if(this.RecalcInfo.bCtrPrp == true) if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
//this.RecalcInfo.bProps = false; //this.RecalcInfo.bProps = false;
} }
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].Resize(this, ParaMath, oMeasure);
this.recalculateSize(oMeasure); // передаем oMeasure, для
}, },
getAscent: function(oMeasure, _height) getAscent: function(oMeasure, _height)
{ {
......
...@@ -451,7 +451,7 @@ CDegree.prototype.IsPlhIterator = function() ...@@ -451,7 +451,7 @@ CDegree.prototype.IsPlhIterator = function()
CDegree.prototype.setProperties = function(props) CDegree.prototype.setProperties = function(props)
{ {
if(props.type === DEGREE_SUPERSCRIPT || props.type === DEGREE_SUBSCRIPT) if(props.type === DEGREE_SUPERSCRIPT || props.type === DEGREE_SUBSCRIPT)
this.Pr.type = DEGREE_SUPERSCRIPT; this.Pr.type = props.type;
else else
this.Pr.type = DEGREE_SUPERSCRIPT; this.Pr.type = DEGREE_SUPERSCRIPT;
......
...@@ -405,8 +405,10 @@ CRecalculateInfo.prototype = ...@@ -405,8 +405,10 @@ CRecalculateInfo.prototype =
} }
else else
{ {
var currCoeff = 0, var leftCoeff = 0, /// for Current Object
rightCoeff = 0; rightCoeff = 0; /// for Left Object
var leftCode;
if(this.Current.typeObj == MATH_TEXT) if(this.Current.typeObj == MATH_TEXT)
{ {
...@@ -418,14 +420,14 @@ CRecalculateInfo.prototype = ...@@ -418,14 +420,14 @@ CRecalculateInfo.prototype =
if(this.Left.typeObj == MATH_COMP) if(this.Left.typeObj == MATH_COMP)
{ {
rightCoeff = this.getGapsMComp(this.Left, 1); rightCoeff = this.getGapsMComp(this.Left, 1);
currCoeff = COEFF_GAPS.getCoeff(currCode, -1, -1); leftCoeff = COEFF_GAPS.getCoeff(currCode, -1, -1);
currCoeff -= rightCoeff; leftCoeff -= rightCoeff;
} }
else else
{ {
var leftCode = this.Left.getCodeChr(); leftCode = this.Left.getCodeChr();
currCoeff = COEFF_GAPS.getCoeff(currCode, leftCode, -1); leftCoeff = COEFF_GAPS.getCoeff(currCode, leftCode, -1);
rightCoeff = COEFF_GAPS.getCoeff(leftCode, currCode, 1); rightCoeff = COEFF_GAPS.getCoeff(leftCode, currCode, 1);
} }
...@@ -435,7 +437,7 @@ CRecalculateInfo.prototype = ...@@ -435,7 +437,7 @@ CRecalculateInfo.prototype =
} }
else else
{ {
currCoeff = this.getGapsMComp(this.Current, -1); leftCoeff = this.getGapsMComp(this.Current, -1);
if(this.Left != null) if(this.Left != null)
{ {
...@@ -443,33 +445,33 @@ CRecalculateInfo.prototype = ...@@ -443,33 +445,33 @@ CRecalculateInfo.prototype =
{ {
rightCoeff = this.getGapsMComp(this.Left, 1); rightCoeff = this.getGapsMComp(this.Left, 1);
if(rightCoeff/2 > currCoeff) if(rightCoeff/2 > leftCoeff)
rightCoeff -= currCoeff; rightCoeff -= leftCoeff;
else else
rightCoeff /= 2; rightCoeff /= 2;
if(currCoeff < rightCoeff/2) if(leftCoeff < rightCoeff/2)
{ {
currCoeff = rightCoeff/2; leftCoeff = rightCoeff/2;
} }
} }
else else
{ {
var leftCode = this.Left.getCodeChr(); leftCode = this.Left.getCodeChr();
rightCoeff = COEFF_GAPS.getCoeff(leftCode, -1, 1); rightCoeff = COEFF_GAPS.getCoeff(leftCode, -1, 1);
if(rightCoeff > currCoeff) if(rightCoeff > leftCoeff)
rightCoeff -= currCoeff; rightCoeff -= leftCoeff;
} }
} }
else else
currCoeff = 0; leftCoeff = 0;
} }
currCoeff = Math.ceil(currCoeff*10)/10; leftCoeff = Math.ceil(leftCoeff*10)/10;
rightCoeff = Math.ceil(rightCoeff*10)/10; rightCoeff = Math.ceil(rightCoeff*10)/10;
var LGapSign = 0.1513*this.currRunPrp.FontSize; var LGapSign = 0.1513*this.currRunPrp.FontSize;
this.Current.GapLeft = Math.ceil(currCoeff*LGapSign*10)/10; // если ни один случай не выполнился, выставляем "нулевые" gaps (default): необходимо, если что-то удалили и объект стал первый или последним в контенте this.Current.GapLeft = Math.ceil(leftCoeff*LGapSign*10)/10; // если ни один случай не выполнился, выставляем "нулевые" gaps (default): необходимо, если что-то удалили и объект стал первый или последним в контенте
if(this.Left != null) if(this.Left != null)
{ {
...@@ -477,8 +479,6 @@ CRecalculateInfo.prototype = ...@@ -477,8 +479,6 @@ CRecalculateInfo.prototype =
this.Left.GapRight = Math.ceil(rightCoeff*RGapSign*10)/10; this.Left.GapRight = Math.ceil(rightCoeff*RGapSign*10)/10;
} }
} }
this.bResize = true;
}, },
getGapsMComp: function(MComp, direct) getGapsMComp: function(MComp, direct)
{ {
...@@ -5039,6 +5039,7 @@ CMathContent.prototype = ...@@ -5039,6 +5039,7 @@ CMathContent.prototype =
descent = descent < oDescent ? oDescent : descent; descent = descent < oDescent ? oDescent : descent;
} }
this.size = {width: width, height: ascent + descent, ascent: ascent}; this.size = {width: width, height: ascent + descent, ascent: ascent};
}, },
Resize: function(Parent, ParaMath, oMeasure) // пересчитываем всю формулу a Resize: function(Parent, ParaMath, oMeasure) // пересчитываем всю формулу a
...@@ -5060,12 +5061,17 @@ CMathContent.prototype = ...@@ -5060,12 +5061,17 @@ CMathContent.prototype =
for(var pos = 0; pos < lng; pos++) for(var pos = 0; pos < lng; pos++)
{ {
if(this.content[pos].typeObj == MATH_COMP) if(this.content[pos].typeObj == MATH_COMP)
{
// мержим ctrPrp до того, как добавим Gaps !
this.content[pos].Set_CompiledCtrPrp(ParaMath); // без ParaMath несмержим ctrPrp
this.content[pos].SetGaps(this, ParaMath, RecalcInfo); this.content[pos].SetGaps(this, ParaMath, RecalcInfo);
else if(this.content[pos].typeObj == MATH_PARA_RUN) }
else if(this.content[pos].typeObj == MATH_PARA_RUN && !this.content[pos].Is_Empty())
this.content[pos].Math_SetGaps(this, ParaMath.Paragraph, RecalcInfo); this.content[pos].Math_SetGaps(this, ParaMath.Paragraph, RecalcInfo);
} }
if(RecalcInfo.Current !== null) if(RecalcInfo.Current !== null)
RecalcInfo.Current.GapRight = 0; RecalcInfo.Current.GapRight = 0;
...@@ -5702,11 +5708,11 @@ CMathContent.prototype = ...@@ -5702,11 +5708,11 @@ CMathContent.prototype =
this.plhHide = flag; this.plhHide = flag;
}, },
///////// RunPrp, CtrPrp ///////// RunPrp, CtrPrp
getFirstRPrp: function() getFirstRPrp: function(ParaMath)
{ {
//var rPrp = new CMathRunPrp(); //var rPrp = new CMathRunPrp();
var rPrp = new CTextPr(); var rPrp = new CTextPr();
var defaultRPrp = this.ParaMath.Get_Default_TPrp(); var defaultRPrp = ParaMath.Get_Default_TPrp();
rPrp.Merge(defaultRPrp); rPrp.Merge(defaultRPrp);
if(this.content.length > 1) if(this.content.length > 1)
...@@ -5718,7 +5724,7 @@ CMathContent.prototype = ...@@ -5718,7 +5724,7 @@ CMathContent.prototype =
} }
else if(obj.typeObj === MATH_COMP) else if(obj.typeObj === MATH_COMP)
{ {
var FirstRPrp = obj.getCtrPrpForFirst();// иначе зациклимся на getCtrPrp var FirstRPrp = obj.getCtrPrpForFirst(ParaMath);// иначе зациклимся на getCtrPrp
rPrp.Merge(FirstRPrp); rPrp.Merge(FirstRPrp);
} }
} }
......
...@@ -152,12 +152,12 @@ CNary.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -152,12 +152,12 @@ CNary.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Pr.chrType = oSign.chrType; this.Pr.chrType = oSign.chrType;
this.Pr.chr = String.fromCharCode(oSign.chrCode); this.Pr.chr = oSign.chrCode;
} }
CNary.superclass.Resize.call(this, Parent, ParaMath, oMeasure); CNary.superclass.Resize.call(this, Parent, ParaMath, oMeasure);
} }
CNary.prototype.getSign = function(chr, chrType) CNary.prototype.getSign = function(chrCode, chrType)
{ {
var result = var result =
{ {
...@@ -165,17 +165,19 @@ CNary.prototype.getSign = function(chr, chrType) ...@@ -165,17 +165,19 @@ CNary.prototype.getSign = function(chr, chrType)
chrType: null, chrType: null,
operator: null operator: null
} };
var bChr = chrCode !== null && chrCode == chrCode + 0;
var bChr = false; /*var bChr = false;
var chrCode; var chrCode;*/
if(typeof(chr) === "string") /*if(typeof(chr) === "string")
{ {
chrCode = chr.charCodeAt(0); chrCode = chr.charCodeAt(0);
bChr = true; bChr = true;
} }*/
if(chrCode == 0x222B || chrType == NARY_INTEGRAL) if(chrCode == 0x222B || chrType == NARY_INTEGRAL)
{ {
......
...@@ -3247,7 +3247,7 @@ COperator.prototype.setPosition = function(Positions) ...@@ -3247,7 +3247,7 @@ COperator.prototype.setPosition = function(Positions)
NewPos.y = this.Positions[0].y; NewPos.y = this.Positions[0].y;
var operator = this.operator; /*var operator = this.operator;
if (!operator.bJDraw) // for text if (!operator.bJDraw) // for text
{ {
operator.pos.x = NewPos.x + operator.GapLeft; operator.pos.x = NewPos.x + operator.GapLeft;
...@@ -3259,7 +3259,7 @@ COperator.prototype.setPosition = function(Positions) ...@@ -3259,7 +3259,7 @@ COperator.prototype.setPosition = function(Positions)
{ {
operator.pos.x = NewPos.x - operator.rasterOffsetX; operator.pos.x = NewPos.x - operator.rasterOffsetX;
operator.pos.y = NewPos.y - operator.rasterOffsetY; operator.pos.y = NewPos.y - operator.rasterOffsetY;
} }*/
this.operator.setPosition(NewPos); this.operator.setPosition(NewPos);
} }
...@@ -3539,11 +3539,11 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -3539,11 +3539,11 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
if(this.RecalcInfo.bCtrPrp == true) /*if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
} }*/
if(this.RecalcInfo.bProps == true) if(this.RecalcInfo.bProps == true)
{ {
...@@ -4038,11 +4038,11 @@ CCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -4038,11 +4038,11 @@ CCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
if(this.RecalcInfo.bCtrPrp == true) /*if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
} }*/
var base = this.elements[0][0]; var base = this.elements[0][0];
base.Resize(this, ParaMath, oMeasure); base.Resize(this, ParaMath, oMeasure);
......
...@@ -1009,11 +1009,11 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1009,11 +1009,11 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
if(this.RecalcInfo.bCtrPrp == true) /*if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
} }*/
if(this.RecalcInfo.bProps) if(this.RecalcInfo.bProps)
{ {
...@@ -1060,6 +1060,7 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1060,6 +1060,7 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Iterator.Resize(this, ParaMath, oMeasure); this.Iterator.Resize(this, ParaMath, oMeasure);
this.RealBase.Resize(this, ParaMath, oMeasure); this.RealBase.Resize(this, ParaMath, oMeasure);
} }
var shTop, var shTop,
height, width, ascent; height, width, ascent;
......
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