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

1. Сделала выравнивание итератора в CLimit по бейзлайну

2. Учитываем знак параграфа для выравнивания с помощью амперсандов в EqArray

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58450 954022d7-b5bf-4e40-9824-e11837661b57
parent d87dc694
...@@ -2803,7 +2803,14 @@ ParaRun.prototype.Refresh_RecalcData = function(Data) ...@@ -2803,7 +2803,14 @@ ParaRun.prototype.Refresh_RecalcData = function(Data)
{ {
var Para = this.Paragraph; var Para = this.Paragraph;
if ( -1 !== this.StartLine && undefined !== Para ) if(this.Type == para_Math_Run)
{
if(this.Parent !== null && this.Parent !== undefined)
{
this.Parent.Refresh_RecalcData();
}
}
else if ( -1 !== this.StartLine && undefined !== Para )
{ {
var CurLine = this.StartLine; var CurLine = this.StartLine;
...@@ -7853,8 +7860,8 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI, ...@@ -7853,8 +7860,8 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
this.protected_AddRange(0, 0); this.protected_AddRange(0, 0);
this.protected_FillRange(0, 0, RangeStartPos, RangeEndPos); this.protected_FillRange(0, 0, RangeStartPos, RangeEndPos);
var oWPrp = this.Get_CompiledPr(true); var oWPrp = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(oWPrp, ArgSize.value); this.Parent.ParaMath.ApplyArgSize(oWPrp, ArgSize.value);
if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам
...@@ -7871,6 +7878,7 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI, ...@@ -7871,6 +7878,7 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
g_oTextMeasurer.SetFont(oWPrp); g_oTextMeasurer.SetFont(oWPrp);
this.bEqqArray = RPI.bEqqArray; this.bEqqArray = RPI.bEqqArray;
......
...@@ -345,7 +345,7 @@ CMathBase.prototype = ...@@ -345,7 +345,7 @@ CMathBase.prototype =
{ {
return this.Parent.remove(order); return this.Parent.remove(order);
}, },
recalculateSize: function(oMeasure) recalculateSize: function(oMeasure, RPI)
{ {
var width = 0; var width = 0;
var height = 0; var height = 0;
...@@ -367,7 +367,7 @@ CMathBase.prototype = ...@@ -367,7 +367,7 @@ CMathBase.prototype =
width += this.dW*(this.nCol - 1) + this.GapLeft + this.GapRight; width += this.dW*(this.nCol - 1) + this.GapLeft + this.GapRight;
var ascent = this.getAscent(oMeasure, height); var ascent = this.getAscent(oMeasure, height, RPI);
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
}, },
......
...@@ -390,7 +390,6 @@ CFraction.prototype.fillMathComposition = function(props, contents /*array*/) ...@@ -390,7 +390,6 @@ CFraction.prototype.fillMathComposition = function(props, contents /*array*/)
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION) if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{ {
// Numerator // Numerator
...@@ -481,6 +480,17 @@ CNumerator.prototype.init = function() ...@@ -481,6 +480,17 @@ CNumerator.prototype.init = function()
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
} }
CNumerator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.ArgSize = ArgSize.Copy();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize();
}
CNumerator.prototype.recalculateSize = function() CNumerator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
...@@ -525,9 +535,10 @@ CNumerator.prototype.getPropsForWrite = function() ...@@ -525,9 +535,10 @@ CNumerator.prototype.getPropsForWrite = function()
return props; return props;
} }
function CDenominator() function CDenominator(bLimit)
{ {
this.gap = 0; this.gap = 0;
this.bLimit = bLimit == true;
CMathBase.call(this, true); CMathBase.call(this, true);
...@@ -539,17 +550,33 @@ CDenominator.prototype.init = function() ...@@ -539,17 +550,33 @@ CDenominator.prototype.init = function()
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
} }
CDenominator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.ArgSize = ArgSize.Copy();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize();
}
CDenominator.prototype.recalculateSize = function() CDenominator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
var mgCtrPrp = this.Get_CompiledCtrPrp(); var mgCtrPrp = this.Get_CompiledCtrPrp();
var gapDen = 7.325682539682539 * mgCtrPrp.FontSize/36, var gapDen = 7.325682539682539 * mgCtrPrp.FontSize/36,
Ascent = arg.ascent - 4.938888888888888*mgCtrPrp.FontSize/36, Ascent = arg.ascent - 4.938888888888888*mgCtrPrp.FontSize/36,
minGap = gapDen/3; minGap = gapDen/3;
if(this.bLimit)
{
gapDen /= 1.5;
minGap /= 1.5;
}
var delta = gapDen - Ascent; var delta = gapDen - Ascent;
this.gap = delta > minGap ? delta : minGap; this.gap = delta > minGap ? delta : minGap;
......
...@@ -6,8 +6,8 @@ function CLimit(props) ...@@ -6,8 +6,8 @@ function CLimit(props)
this.kind = MATH_LIMIT; this.kind = MATH_LIMIT;
this.FName = new CMathContent(); this.ContentFName = new CMathContent();
this.Iterator = new CMathContent(); this.ContentIterator = new CMathContent();
this.Pr = this.Pr =
{ {
...@@ -29,15 +29,13 @@ CLimit.prototype.init = function(props) ...@@ -29,15 +29,13 @@ CLimit.prototype.init = function(props)
} }
CLimit.prototype.getFName = function() CLimit.prototype.getFName = function()
{ {
return this.FName; //return this.FName;
return this.ContentFName;
} }
CLimit.prototype.getIterator = function() CLimit.prototype.getIterator = function()
{ {
return this.Iterator; //return this.Iterator;
} return this.ContentIterator;
CLimit.prototype.setDistance = function()
{
this.dH = 0.03674768518518519*this.Get_CompiledCtrPrp().FontSize;
} }
CLimit.prototype.setProperties = function(props) CLimit.prototype.setProperties = function(props)
{ {
...@@ -50,8 +48,11 @@ CLimit.prototype.fillMathComposition = function(props, contents /*array*/) ...@@ -50,8 +48,11 @@ CLimit.prototype.fillMathComposition = function(props, contents /*array*/)
{ {
this.setProperties(props); this.setProperties(props);
this.FName = contents[0]; this.FName = null;
this.Iterator = contents[1]; this.Iterator = null;
this.ContentFName = contents[0];
this.ContentIterator = contents[1];
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
} }
...@@ -88,7 +89,10 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -88,7 +89,10 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
} }
this.elements[0][0] = new CDegree(null, true); this.elements[0][0] = new CDegree(null, true);
this.elements[0][0].fillMathComposition(props, [this.FName, this.Iterator]); this.elements[0][0].fillMathComposition(props, [this.ContentFName, this.ContentIterator]);
this.FName = this.ContentFName;
this.Iterator = this.ContentIterator;
} }
else else
{ {
...@@ -96,11 +100,20 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -96,11 +100,20 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
if(this.Pr.type == LIMIT_LOW) if(this.Pr.type == LIMIT_LOW)
{ {
this.FName = this.ContentFName;
//this.elements[1][0] = this.Iterator;
this.Iterator = new CDenominator(true);
this.Iterator.fillMathComposition(this.ContentIterator);
this.elements[0][0] = this.FName; this.elements[0][0] = this.FName;
this.elements[1][0] = this.Iterator; this.elements[1][0] = this.Iterator;
} }
else else
{ {
this.FName = this.ContentFName;
this.Iterator = this.ContentIterator;
this.elements[0][0] = this.Iterator; this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName; this.elements[1][0] = this.FName;
} }
...@@ -131,18 +144,21 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -131,18 +144,21 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Iterator.Resize(oMeasure, this, ParaMath, RPI, ArgSzIter); this.Iterator.Resize(oMeasure, this, ParaMath, RPI, ArgSzIter);
var SizeFName = this.FName.size, var SizeFName = this.FName.size,
SizeIter = this.Iterator.size; SizeIter = this.Iterator.size;
var width = SizeFName.width > SizeIter.width ? SizeFName.width : SizeIter.width, var width = SizeFName.width > SizeIter.width ? SizeFName.width : SizeIter.width,
height = SizeFName.height + SizeIter.height + this.dH, height = SizeFName.height + SizeIter.height,
ascent; ascent;
if(this.Pr.type == LIMIT_LOW) if(this.Pr.type == LIMIT_LOW)
{
ascent = SizeFName.ascent; ascent = SizeFName.ascent;
}
else if(this.Pr.type == LIMIT_UP) else if(this.Pr.type == LIMIT_UP)
{
ascent = SizeIter.height + this.dH + SizeFName.ascent; ascent = SizeIter.height + this.dH + SizeFName.ascent;
}
width += this.GapLeft + this.GapRight; width += this.GapLeft + this.GapRight;
......
...@@ -763,7 +763,7 @@ CMathAmp.prototype = ...@@ -763,7 +763,7 @@ CMathAmp.prototype =
{ {
if(this.bEqqArray==false) if(this.bEqqArray==false)
this.AmpText.draw(x, y, pGraphics); this.AmpText.draw(x, y, pGraphics);
else else if(editor.ShowParaMarks) // показать метки выравнивания, если включена отметка о знаках параграфа
{ {
var X = x + this.pos.x, var X = x + this.pos.x,
Y = y + this.pos.y, Y = y + this.pos.y,
......
...@@ -614,7 +614,6 @@ CNaryUndOvr.prototype.recalculateSize = function() ...@@ -614,7 +614,6 @@ CNaryUndOvr.prototype.recalculateSize = function()
var FontSize = this.Get_CompiledCtrPrp().FontSize; var FontSize = this.Get_CompiledCtrPrp().FontSize;
var zetta = FontSize*25.4/96; var zetta = FontSize*25.4/96;
this.gapTop = zetta*0.25; this.gapTop = zetta*0.25;
//this.gapBottom = zetta*0.1;
var minGapBottom = zetta*0.1, var minGapBottom = zetta*0.1,
DownBaseline = FontSize*0.23; DownBaseline = FontSize*0.23;
......
...@@ -4059,7 +4059,6 @@ CCharacter.prototype.getBase = function() ...@@ -4059,7 +4059,6 @@ CCharacter.prototype.getBase = function()
return this.elements[0][0]; return this.elements[0][0];
} }
function CGroupCharacter(props) function CGroupCharacter(props)
{ {
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
...@@ -4414,3 +4413,359 @@ CGroupCharacter.prototype.Get_Id = function() ...@@ -4414,3 +4413,359 @@ CGroupCharacter.prototype.Get_Id = function()
{ {
return this.Id; return this.Id;
} }
function new_CGroupCharacter(props)
{
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_GROUP_CHARACTER;
this.Content = new CMathContent();
this.Pr =
{
chr: null,
chrType: null,
vertJc: VJUST_TOP,
pos: LOCATION_BOT
};
CCharacter.call(this);
if(props !== null && typeof(props)!== "undefined")
this.init(props);
/// вызов этой функции обязательно в конце
g_oTableId.Add( this, this.Id );
}
Asc.extendClass(new_CGroupCharacter, CCharacter);
new_CGroupCharacter.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
new_CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
if(this.RecalcInfo.bProps == true)
{
var operDefaultPrp =
{
type: BRACKET_CURLY_BOTTOM,
loc: LOCATION_BOT
};
var operProps =
{
type: this.Pr.chrType,
chr: this.Pr.chr,
loc: this.Pr.pos
};
this.setCharacter(operProps, operDefaultPrp);
this.RecalcInfo.bProps = false;
}
var ArgSz = ArgSize.Copy();
if(this.Pr.pos == this.Pr.vertJc)
{
ArgSz.decrease();
if(this.Pr.pos == LOCATION_TOP)
{
var Iterator = new CDenominator(true);
Iterator.fillMathComposition(this.Content);
this.elements[0][0] = Iterator;
}
else
{
var Iterator = new CNumerator();
Iterator.fillMathComposition(this.Content);
this.elements[0][0] = Iterator;
}
}
else
this.elements[0][0] = this.Content;
new_CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSz);
}
new_CGroupCharacter.prototype.getBase = function()
{
return this.Content;
}
new_CGroupCharacter.prototype.setProperties = function(props)
{
if(props.vertJc === VJUST_TOP || props.vertJc === VJUST_BOT)
this.Pr.vertJc = props.vertJc;
if(props.pos === LOCATION_TOP || props.pos === LOCATION_BOT)
this.Pr.pos = props.pos;
this.Pr.chr = props.chr;
this.Pr.chrType = props.chrType;
this.setCtrPrp(props.ctrPrp);
}
new_CGroupCharacter.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
}
new_CGroupCharacter.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
//this.elements[0][0] = contents[0];
this.Content = contents[0];
}
new_CGroupCharacter.prototype.getAscent = function(oMeasure)
{
var ascent;
//var shCent = DIV_CENT*this.getCtrPrp().FontSize;
var ctrPrp = this.Get_CompiledCtrPrp();
var shCent = this.ParaMath.GetShiftCenter(oMeasure, ctrPrp);
if(this.Pr.vertJc === VJUST_TOP && this.Pr.pos === LOCATION_TOP)
ascent = this.operator.size.ascent + shCent;
else if(this.Pr.vertJc === VJUST_BOT && this.Pr.pos === LOCATION_TOP )
ascent = this.operator.size.height + this.elements[0][0].size.ascent;
else if(this.Pr.vertJc === VJUST_TOP && this.Pr.pos === LOCATION_BOT )
ascent = this.elements[0][0].size.ascent;
else if(this.Pr.vertJc === VJUST_BOT && this.Pr.pos === LOCATION_BOT )
ascent = this.elements[0][0].size.height + shCent + this.operator.size.height - this.operator.size.ascent;
//ascent = this.operator.size.height/2 + shCent + this.elements[0][0].size.height;
return ascent;
}
new_CGroupCharacter.prototype.old_getGlyph = function(code, type)
{
var operator, props, accent;
if(code === 0x23DE || type == BRACKET_CURLY_TOP)
{
operator = new COperatorBracket();
props =
{
location: this.loc,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x23DF || type === BRACKET_CURLY_BOTTOM )
{
operator = new COperatorBracket();
props =
{
location: this.loc,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else if(code === 0x2190 || type === ARROW_LEFT)
{
operator = new CSingleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x2192 || type === ARROW_RIGHT)
{
operator = new CSingleArrow();
props =
{
location: this.loc,
turn: TURN_180
};
operator.init(props);
}
else if(code === 0x2194 || type === ARROW_LR)
{
operator = new CLeftRightArrow();
props =
{
location: this.loc,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x21D0 || type === DOUBLE_LEFT_ARROW)
{
operator = new CDoubleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x21D2 || type === DOUBLE_RIGHT_ARROW)
{
operator = new CDoubleArrow();
props =
{
location: this.loc,
turn: TURN_180
};
operator.init(props);
}
else if(code === 0x21D4 || type === DOUBLE_ARROW_LR)
{
operator = new CLR_DoubleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
operator.init(props);
}
///// accents /////
else if(code === 0x20D6 || type === ACCENT_ARROW_LEFT)
{
operator = new CCombiningArrow();
props =
{
location: LOCATION_TOP,
turn: TURN_0
};
operator.init(props);
accent = new COperator(operator);
}
else if(code === 0x20D7 || type === ACCENT_ARROW_RIGHT)
{
operator = new CCombiningArrow();
props =
{
location: LOCATION_TOP,
turn: TURN_180
};
operator.init(props);
accent = new COperator(operator);
}
else if(code === 0x20E1 || type === ACCENT_ARROW_LR)
{
operator = new CCombining_LR_Arrow();
props =
{
location: LOCATION_TOP,
turn: TURN_0
};
operator.init(props);
accent = new COperator(operator);
}
else if(code === 0x20D0 || type === ACCENT_HALF_ARROW_LEFT)
{
operator = new CCombiningHalfArrow();
props =
{
location: LOCATION_TOP,
turn: TURN_0
};
operator.init(props);
accent = new COperator(operator);
}
else if(code === 0x20D1 || type === ACCENT_HALF_ARROW_RIGHT)
{
operator = new CCombiningHalfArrow();
props =
{
location: LOCATION_TOP,
turn: TURN_180
};
operator.init(props);
accent = new COperator(operator);
}
/////
else if(typeof(code) !=="undefined" && code !== null)
{
operator = new CMathText(true);
operator.add(code);
}
else
{
operator = new COperatorBracket();
props =
{
location: LOCATION_BOT,
turn: TURN_MIRROR_0
};
operator.init(props);
}
return operator;
}
new_CGroupCharacter.prototype.getPropsForWrite = function()
{
return this.Pr;
}
new_CGroupCharacter.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong( historyitem_type_groupChr );
}
new_CGroupCharacter.prototype.Load_Changes = function(Reader)
{
}
new_CGroupCharacter.prototype.Refresh_RecalcData = function(Data)
{
}
new_CGroupCharacter.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_groupChr );
Writer.WriteString2( this.getBase().Id );
this.CtrPrp.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.chr )
{
Writer.WriteLong(this.Pr.chr);
Flags |= 1;
}
if ( undefined != this.Pr.pos )
{
Writer.WriteLong(this.Pr.pos);
Flags |= 2;
}
if ( undefined != this.Pr.vertJc )
{
Writer.WriteLong(this.Pr.vertJc);
Flags |= 4;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
}
new_CGroupCharacter.prototype.Read_FromBinary2 = function( Reader )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
props.ctrPrp.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.chr = Reader.GetLong();
if ( Flags & 2 )
props.pos = Reader.GetLong();
if ( Flags & 4 )
props.vertJc = Reader.GetLong();
this.fillMathComposition (props, arrElems);
}
new_CGroupCharacter.prototype.Get_Id = function()
{
return this.Id;
}
\ No newline at end of file
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