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

1. к заливке 58950 : для итераторов свойство (DecreaseComposition) внутренних...

1. к заливке 58950 : для итераторов свойство (DecreaseComposition) внутренних мат объектов также прокидывается, как и для числителя и знаменателя дроби (т.е. мат объекты наподобии инлайновых)
2. Реализовала свойство Set_MathTextPr2 : прокидываются MathPr и TextPr для Run и для CtrPr мат объекта при добавлении готовой формулы из меню

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58974 954022d7-b5bf-4e40-9824-e11837661b57
parent 5cf4ca9f
......@@ -62,17 +62,6 @@ function ParaMath()
this.DefaultTextPr.FontFamily = {Name : "Cambria Math", Index : -1 };
this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1);
/*this.MathPr =
{
naryLim: NARY_UndOvr,
intLim: NARY_SubSup,
brkBin: BREAK_BEFORE,
brkSubBin: BREAK_MIN_MIN,
wrapIndent: 0,
smallFrac: false,
wrapRight: false
};*/
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
}
......@@ -189,12 +178,27 @@ ParaMath.prototype.Add = function(Item)
}
else if (para_Math === Type)
{
var ContentPos = new CParagraphContentPos();
if(this.bSelectionUse == true)
this.Get_ParaContentPos(true, true, ContentPos);
else
this.Get_ParaContentPos(false, false, ContentPos);
var MathTxtPr = this.Root.GetMathTextPr(ContentPos, 0);
var lng = oContent.content.length;
// Нам нужно разделить данный Run на 2 части
var RightRun = Run.Split2(Run.State.ContentPos);
oContent.Internal_Content_Add(StartPos + 1, RightRun, false);
oContent.CurPos = StartPos;
oContent.Load_FromMenu(Item.Menu, this.Paragraph);
var lng2 = oContent.content.length;
oContent.Set_MathTextPr2(MathTxtPr.TextPr, MathTxtPr.MathPr, false, StartPos, lng2 - lng + 1);
oContent.CurPos = StartPos + 2; // позиция RightRun
RightRun.Cursor_MoveToStartPos();
}
......
......@@ -7991,7 +7991,12 @@ ParaRun.prototype.Set_MathPr = function(MPrp)
History.Add( this, { Type : historyitem_ParaRun_MathPrp, New : MPrp, Old : OldValue } );
this.Recalc_CompiledPr(true);
//this.UpdateMathPr = true;
}
ParaRun.prototype.Set_MathTextPr2 = function(TextPr, MathPr)
{
this.Set_Pr(TextPr);
this.Set_MathPr(MathPr);
}
ParaRun.prototype.IsAccent = function()
{
......@@ -8017,10 +8022,21 @@ ParaRun.prototype.Math_GetInfoLetter = function(Info)
else
Info.Result = false;
}
ParaRun.IsNormalText = function()
ParaRun.prototype.IsNormalText = function()
{
return this.MathPrp.nor === true;
}
ParaRun.prototype.GetMathTextPr = function()
{
var TextPr = new CTextPr();
if(this.IsPlaceholder())
TextPr.Merge(this.Parent.GetCtrPrp());
TextPr.Merge(this.Pr);
return {TextPr: TextPr, MathPr: this.MathPrp.Copy()};
}
function CParaRunStartState(Run)
{
......
......@@ -175,47 +175,6 @@ CAccentDoubleLine.prototype.calcSize = function(stretch)
return {width: width, height: height};
}
CAccentDoubleLine.prototype.old_calcCoord = function(stretch)
{
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var X = [],
Y = [];
X[0] = 0; Y[0] = 0;
X[1] = stretch; Y[1] = 0;
X[2] = stretch; Y[2] = 0.011*fontSize;
X[3] = 0; Y[3] = Y[2];
X[4] = 0; Y[4] = 0;
X[5] = 0; Y[5] = 0.039486*fontSize;
X[6] = stretch; Y[6] = Y[5];
X[7] = stretch; Y[7] = 0.0503*fontSize;
X[8] = 0; Y[8] = Y[7];
X[9] = 0; Y[9] = Y[5];
var W = X[7],
H = Y[7];
return {XX: X, YY: Y, W: W, H: H};
}
CAccentDoubleLine.prototype.old_drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
pGraphics._l(XX[1], YY[1]);
pGraphics._l(XX[2], YY[2]);
pGraphics._l(XX[3], YY[3]);
pGraphics._l(XX[4], YY[4]);
pGraphics.df();
pGraphics._s();
pGraphics._m(XX[5], YY[5]);
pGraphics._l(XX[6], YY[6]);
pGraphics._l(XX[7], YY[7]);
pGraphics._l(XX[8], YY[8]);
pGraphics._l(XX[9], YY[9]);
}
CAccentDoubleLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
......@@ -508,11 +467,11 @@ CAccent.prototype.fillContent = function()
this.setDimension(1, 1);
this.elements[0][0] = this.getBase();
this.elements[0][0].SetDot(true);
}
};
CAccent.prototype.IsAccent = function()
{
return true;
}
};
CAccent.prototype.setPosition = function(pos, PosInfo)
{
this.pos.x = pos.x;
......@@ -538,7 +497,7 @@ CAccent.prototype.setPosition = function(pos, PosInfo)
PosBase.y = this.pos.y + this.operator.size.height;
this.elements[0][0].setPosition(PosBase, PosInfo);
}
};
CAccent.prototype.ApplyProperties = function(RPI)
{
if(this.RecalcInfo.bProps == true)
......@@ -556,14 +515,14 @@ CAccent.prototype.ApplyProperties = function(RPI)
this.RecalcInfo.bProps = false;
}
}
};
CAccent.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.ApplyProperties(RPI);
this.operator.PreRecalc(this, ParaMath);
CAccent.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
}
};
CAccent.prototype.Resize = function(oMeasure, RPI)
{
var base = this.getBase();
......@@ -578,7 +537,7 @@ CAccent.prototype.Resize = function(oMeasure, RPI)
width += this.GapLeft + this.GapRight;
this.size = {height: height, width: width, ascent: ascent};
}
};
CAccent.prototype.draw = function(x, y, pGraphics)
{
var base = this.elements[0][0];
......@@ -612,4 +571,4 @@ CAccent.prototype.draw = function(x, y, pGraphics)
}
this.operator.draw(x, y, pGraphics);
}
\ No newline at end of file
};
\ No newline at end of file
......@@ -466,16 +466,6 @@ CMathBase.prototype =
return this.TextPrControlLetter;
},
old_Set_CompiledCtrPrp: function(ParaMath)
{
if(this.RecalcInfo.bCtrPrp == true)
{
this.CompiledCtrPrp = ParaMath.GetFirstRPrp();
this.CompiledCtrPrp.Merge(this.CtrPrp);
this.RecalcInfo.bCtrPrp = false;
}
},
getAscent: function(oMeasure, _height)
{
var Ascent = 0;
......@@ -590,11 +580,9 @@ CMathBase.prototype =
},
Get_TextPr: function(ContentPos, Depth)
{
var row = ContentPos.Get(Depth),
col = ContentPos.Get(Depth+1);
var pos = ContentPos.Get(Depth);
return this.elements[row][col].Get_TextPr(ContentPos, Depth + 2);
return this.Content[pos].Get_TextPr(ContentPos, Depth+1);
},
Get_CompiledTextPr : function(Copy)
{
......@@ -665,6 +653,19 @@ CMathBase.prototype =
}
}
},
GetMathTextPr: function(ContentPos, Depth)
{
var pos = ContentPos.Get(Depth);
return this.Content[pos].GetMathTextPr(ContentPos, Depth+1);
},
Set_MathTextPr2: function(TextPr, MathPr, bAll)
{
this.Set_FontSizeCtrPrp(TextPr.FontSize);
for(var i = 0; i < this.Content.length; i++)
this.Content[i].Set_MathTextPr2(TextPr, MathPr, bAll);
},
Set_FontSizeCtrPrp: function(Value)
{
History.Add(this, new CChangesMathFontSize(Value, this.CtrPrp.FontSize));
......
......@@ -359,7 +359,7 @@ function CMathBoxPr()
this.diff = false;
this.noBreak = false;
this.opEmu = false;
};
}
CMathBoxPr.prototype.Set_FromObject = function(Obj)
{
......
......@@ -430,37 +430,6 @@ CDegreeSubSupBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI,
CDegreeSubSupBase.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
};
/*CDegreeSubSupBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(Parent, ParaMath);
var ArgSzIters = ArgSize.Copy();
ArgSzIters.decrease();
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
this.baseContent.PreRecalc(this, ParaMath, ArgSize, RPI);
this.iters.PreRecalc(this, ParaMath, ArgSzIters, RPI);
};*/
/*CDegreeSubSupBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
var ArgSzIters = ArgSize.Copy();
ArgSzIters.decrease();
this.baseContent.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.iters.Resize(oMeasure, this, ParaMath, RPI, ArgSzIters);
this.recalculateSize(oMeasure, RPI);
};*/
CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure, RPI)
{
//var mgCtrPrp = this.GetTPrpToControlLetter();
......
......@@ -281,45 +281,6 @@ CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInf
this.Numerator.PreRecalc(this, ParaMath, ArgSzNumDen, NewRPI);
this.Denominator.PreRecalc(this, ParaMath, ArgSzNumDen, NewRPI);
}
/*CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
var ArgSzFr = ArgSize.Copy();
if(RPI.bInline == true && this.Pr.type === BAR_FRACTION)
{
ArgSzFr.decrease(); // для контентов числителя и знаменателя
this.ArgSize.SetValue(-1); // для CtrPrp
}
else if(RPI.bInsideFraction == true)
{
this.ArgSize.SetValue(-1); // для CtrPrp
}
else
{
this.ArgSize.SetValue(0);
}
// ??!!
if(this.Pr.type == NO_BAR_FRACTION)
{
ArgSzFr.decrease();
this.ArgSize.SetValue(-1);
}
// компилируем CtrPrp после того, как выставим ArgSize
// т.к. при компиляции CtrPrp для дроби важен this.Argsize (NO_BAR_FRACTION)
// на Set_CompiledCtrPrp компилярются ctrPrp без учета ArgSize
// поэтому необязательно вызывать ее на Resize
//this.Set_CompiledCtrPrp(ParaMath);
var NewRPI = RPI.Copy();
if(this.Pr.type !== LINEAR_FRACTION)
NewRPI.bInsideFraction = true;
CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, NewRPI, ArgSzFr);
}*/
CFraction.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
......@@ -463,17 +424,6 @@ CFractionBase.prototype.init = function(MathContent)
this.setDimension(1, 1);
this.elements[0][0] = MathContent;
}
/*CFractionBase.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();
}*/
CFractionBase.prototype.getElement = function()
{
return this.elements[0][0];
......
......@@ -61,7 +61,7 @@ CLimitPrimary.prototype.init = function(FName, Iterator)
this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName;
}
}
};
CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
......@@ -81,7 +81,7 @@ CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, Gap
NewRPI.bDecreasedComp = true;
this.Iterator.PreRecalc(this, ParaMath, ArgSzIter, NewRPI);
}
};
CLimitPrimary.prototype.Resize = function(oMeasure, RPI)
{
if(this.Type == LIMIT_LOW)
......@@ -109,7 +109,7 @@ CLimitPrimary.prototype.Resize = function(oMeasure, RPI)
width += this.GapLeft + this.GapRight;
this.size = {width: width, height: height, ascent: ascent};
}
};
function CLimit(props)
{
......@@ -136,18 +136,18 @@ CLimit.prototype.init = function(props)
// посмотреть GetAllFonts
this.setProperties(props);
this.fillContent();
}
};
CLimit.prototype.fillContent = function()
{
};
CLimit.prototype.getFName = function()
{
return this.Content[0];
}
};
CLimit.prototype.getIterator = function()
{
return this.Content[1];
}
};
CLimit.prototype.ApplyProperties = function(RPI)
{
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
......@@ -176,7 +176,7 @@ CLimit.prototype.ApplyProperties = function(RPI)
this.RecalcInfo.bProps = false;
}
}
};
function CMathFunc(props)
{
CMathFunc.superclass.constructor.call(this);
......@@ -201,30 +201,30 @@ CMathFunc.prototype.init = function(props)
this.setProperties(props);
this.fillContent();
}
};
CMathFunc.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
var NewRPI = RPI.Copy();
NewRPI.bMathFunc = true;
CMathFunc.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, NewRPI, GapsInfo);
}
};
CMathFunc.prototype.setDistance = function()
{
this.dW = this.GetTPrpToControlLetter().FontSize/6*g_dKoef_pt_to_mm;
}
};
CMathFunc.prototype.getFName = function()
{
return this.Content[0];
}
};
CMathFunc.prototype.getArgument = function()
{
return this.Content[1];
}
};
CMathFunc.prototype.fillContent = function()
{
this.setDimension(1, 2);
this.elements[0][0] = this.getFName();
this.elements[0][1] = this.getArgument();
}
};
......@@ -773,80 +773,6 @@ CMathContent.prototype =
this.size = {width: width, height: ascent + descent, ascent: ascent};
},*/
old_Resize: function(oMeasure, Parent, ParaMath, ArgSize, RPI) // пересчитываем всю формулу
{
if(ArgSize !== null && ArgSize !== undefined)
{
this.Compiled_ArgSz.value = this.ArgSize.value;
this.Compiled_ArgSz.Merge(ArgSize);
}
this.ParaMath = ParaMath;
if(Parent !== null)
{
this.bRoot = false;
this.Parent = Parent;
}
this.WidthToElement.length = 0;
var GapsInfo = new CMathGapsInfo(oMeasure, this, this.Compiled_ArgSz.value);
this.RecalcInfo.bEqqArray = RPI.bEqqArray;
var lng = this.content.length;
this.size.SetZero();
this.InfoPoints.SetDefault();
for(var pos = 0; pos < lng; pos++)
{
this.content[pos].ParaMath = ParaMath;
if(this.content[pos].Type == para_Math_Composition)
{
this.content[pos].SetGaps(GapsInfo);
}
else if(this.content[pos].Type == para_Math_Run)
this.content[pos].Math_SetGaps(GapsInfo);
}
if(GapsInfo.Current !== null)
GapsInfo.Current.GapRight = 0;
for(var pos = 0; pos < lng; pos++)
{
if(this.content[pos].Type == para_Math_Composition)
{
var NewRPI = RPI.Copy();
NewRPI.bEqqArray = false;
this.content[pos].Resize(oMeasure, this, ParaMath, NewRPI, this.Compiled_ArgSz);
if(RPI.bEqqArray)
this.InfoPoints.ContentPoints.UpdatePoint(this.content[pos].size.width);
}
else if(this.content[pos].Type == para_Math_Run)
{
//this.content[pos].Recalculate_Range();
this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz, this.InfoPoints.ContentPoints);
}
this.WidthToElement[pos] = this.size.width;
var oSize = this.content[pos].size;
this.size.width += oSize.width;
var oDescent = oSize.height - oSize.ascent,
SizeDescent = this.size.height - this.size.ascent;
this.size.ascent = this.size.ascent > oSize.ascent ? this.size.ascent : oSize.ascent;
this.size.height = SizeDescent < oDescent ? oDescent + this.size.ascent : SizeDescent + this.size.ascent;
}
},
PreRecalc: function(Parent, ParaMath, ArgSize, RPI)
{
if(ArgSize !== null && ArgSize !== undefined)
......@@ -1464,6 +1390,12 @@ CMathContent.prototype =
return TextPr;
},
GetMathTextPr: function(ContentPos, Depth)
{
var pos = ContentPos.Get(Depth);
return this.content[pos].GetMathTextPr(ContentPos, Depth + 1);
},
Apply_TextPr: function(TextPr, IncFontSize, ApplyToAll)
{
if ( true === ApplyToAll )
......@@ -1593,6 +1525,21 @@ CMathContent.prototype =
}
}
},
Set_MathTextPr2: function(TextPr, MathPr, bAll, StartPos, Count)
{
if(bAll)
{
StartPos = 0;
Count = this.content.length - 1;
}
if(Count < 0 || StartPos + Count > this.content.length - 1)
return;
for(var pos = StartPos; pos <= StartPos + Count; pos++)
this.content[pos].Set_MathTextPr2(TextPr, MathPr, true);
},
IsNormalTextInRuns: function()
{
......@@ -3867,7 +3814,6 @@ CMathContent.prototype =
}
};
CMathContent.prototype.Recalculate_Reset = function(StartRange, StartLine)
{
for(var nPos = 0, nCount = this.content.length; nPos < nCount; nPos++)
......
......@@ -293,64 +293,6 @@ CNary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
CNary.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, NewRPI, GapsInfo);
}
/*CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps || RPI.bChangeInline == true)
{
var oSign = this.getSign(this.Pr.chr, this.Pr.chrType);
this.Sign = oSign.operator;
var limLoc = this.Pr.limLoc;
if(RPI.bInline == true || RPI.bInsideFraction == true)
{
limLoc = NARY_SubSup;
this.Sign = new CMathText(true);
this.Sign.add(oSign.chrCode);
}
if(limLoc == null || typeof(limLoc) == "undefined")
{
var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231;
if(bIntegral)
limLoc = g_oMathSettings.intLim;
else
limLoc = g_oMathSettings.naryLim;
}
var PropsInfo =
{
limLoc : limLoc,
sign: this.Sign,
supHide: this.Pr.supHide,
subHide: this.Pr.subHide
};
// пока оставим так, chrType сейчас нигде не используется
this.Pr.chrType = oSign.chrType;
this.fillBase(PropsInfo);
this.RecalcInfo.bProps = false;
}
var NewRPI = RPI.Copy();
if(RPI.bInline || RPI.bInsideFraction)
NewRPI.bNaryInline = true;
this.Base.Resize(oMeasure, this, ParaMath, NewRPI, ArgSize);
this.Arg.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize(oMeasure);
}*/
CNary.prototype.getSign = function(chrCode, chrType)
{
var result =
......@@ -523,13 +465,6 @@ CNaryUnd.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
this.elements[0][0].PreRecalc(this, ParaMath, ArgSzUnd, RPIUnd);
this.elements[1][0].PreRecalc(this, ParaMath, ArgSize, RPI);
}
/*CNaryUnd.prototype.Resize = function(oMeasure, RPI)
{
this.elements[0][0].Resize(oMeasure, RPI);
this.elements[1][0].Resize(oMeasure, RPI);
this.recalculateSize(oMeasure);
}*/
CNaryUnd.prototype.setBase = function(base)
{
this.elements[1][0] = base;
......@@ -568,19 +503,6 @@ CNaryOvr.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
this.elements[0][0].PreRecalc(this, ParaMath, ArgSize, RPI);
this.elements[1][0].PreRecalc(this, ParaMath, ArgSzOvr, RPIOvr);
}
/*CNaryOvr.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
var ArgSzOvr = ArgSize.Copy();
ArgSzOvr.decrease();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[1][0].Resize(oMeasure, this, ParaMath, RPI, ArgSzOvr);
this.recalculateSize(oMeasure);
}*/
CNaryOvr.prototype.recalculateSize = function()
{
var FontSize = this.GetTPrpToControlLetter().FontSize;
......@@ -646,23 +568,6 @@ CNaryUndOvr.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
this.elements[1][0].PreRecalc(this, ParaMath, ArgSize, RPI);
this.elements[2][0].PreRecalc(this, ParaMath, ArgSzIter, RPI_Iter);
}
/*CNaryUndOvr.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
var ArgSzUnd = ArgSize.Copy();
ArgSzUnd.decrease();
var ArgSzOvr = ArgSize.Copy();
ArgSzOvr.decrease();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSzUnd);
this.elements[1][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[2][0].Resize(oMeasure, this, ParaMath, RPI, ArgSzOvr);
this.recalculateSize(oMeasure);
}*/
CNaryUndOvr.prototype.recalculateSize = function()
{
var FontSize = this.GetTPrpToControlLetter().FontSize;
......
......@@ -657,4 +657,4 @@ CRadical.prototype.getBase = function()
CRadical.prototype.getDegree = function()
{
return this.Content[0];
}
\ 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