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