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

1. Реализовала функцию fillMathComposition в качестве эмулятора конструктора...

1. Реализовала функцию fillMathComposition в качестве эмулятора конструктора классов (для совместного редактирования и т.п.) для accent, borderBox, bar, box, degree, degreeSubSup, limit, math function, matrix
2. Поправила баг с lineGap у матриц (не подхватывались)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56531 954022d7-b5bf-4e40-9824-e11837661b57
parent 9b531a9e
......@@ -510,10 +510,6 @@ function CAccent(props)
chrType: null
};
/*this.chr = null;
this.chrType = null;
this.loc = LOCATION_TOP;*/
/////////////////
this.operator = new COperator(OPER_ACCENT);
......@@ -532,19 +528,12 @@ function CAccent(props)
extend(CAccent, CMathBase);
CAccent.prototype.init = function(props)
{
this.Pr.chr = props.chr;
this.Pr.chrType = props.chrType;
//this.operator.init(prp, defaultPrp);
//this.operator.relate(this);
this.setProperties(props);
this.setDimension(1, 1);
this.setContent();
this.elements[0][0].SetDot(true);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CAccent.prototype.setChr = function(chr)
{
......@@ -1138,7 +1127,7 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
type: ACCENT_CIRCUMFLEX
};
this.operator.setProperties(prp, defaultPrp);
this.operator.mergeProperties(prp, defaultPrp);
this.Pr.chr = String.fromCharCode(this.operator.code);
this.Pr.chrType = this.operator.typeOper;
......@@ -1229,6 +1218,22 @@ CAccent.prototype.findDisposition = function(pos)
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CAccent.prototype.setProperties = function(props)
{
this.Pr.chr = props.chr;
this.Pr.chrType = props.chrType;
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
CAccent.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.init(props);
// Base
this.elements[0][0] = contents[0];
}
CAccent.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong( historyitem_type_acc );
......
......@@ -101,8 +101,8 @@ CMathBase.prototype =
///////// RunPrp, CtrPrp
setCtrPrp: function(txtPrp) // выставляем ctrPrp на чтение
{
if(txtPrp !== null && typeof(txtPrp) !== "undefined")
this.CtrPrp.Merge(txtPrp);
//this.RunPrp.setTxtPrp(txtPrp);
},
Get_CtrPrp: function()
{
......
......@@ -38,42 +38,16 @@ function CBorderBox(props)
extend(CBorderBox, CMathBase);
CBorderBox.prototype.init = function(props)
{
/*if(typeof(props) !== "undefined" && props !== null)
{
if(props.hideLeft === true || props.hideLeft === 1)
this.bLeft = false;
if(props.hideRight === true || props.hideRight === 1)
this.bRight = false;
if(props.hideTop === true || props.hideTop === 1)
this.bTop = false;
if(props.hideBot === true || props.hideBot === 1)
this.bBot = false;
if(props.strikeBLTR === true || props.strikeBLTR === 1)
this.bRDiag = true;
if(props.strikeTLBR === true || props.strikeTLBR === 1)
this.bLDiag = true;
if(props.strikeH === true || props.strikeH === 1)
this.bHor = true;
if(props.strikeV === true || props.strikeV === 1)
this.bVert = true;
}*/
this.setBorders(props);
this.setProperties(props);
this.fillContent();
}
CBorderBox.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CBorderBox.prototype.setBorders = function(props)
CBorderBox.prototype.setProperties = function(props)
{
if(typeof(props) !== "undefined" && props !== null)
{
if(typeof(props.hideLeft) !== "undefined" && props.hideLeft !== null)
this.Pr.hideLeft = props.hideLeft;
......@@ -97,7 +71,9 @@ CBorderBox.prototype.setBorders = function(props)
if(typeof(props.strikeV) !== "undefined" && props.strikeV !== null)
this.Pr.strikeV = props.strikeV;
}
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
......@@ -458,6 +434,14 @@ CBorderBox.prototype.getBase = function()
{
return this.elements[0][0];
}
CBorderBox.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CBorderBox.prototype.getPropsForWrite = function()
{
/*var props = {};
......@@ -572,6 +556,8 @@ CBorderBox.prototype.Get_Id = function()
return this.Id;
}
function CBox(props)
{
this.Id = g_oIdCounter.Get_NewId();
......@@ -592,6 +578,19 @@ function CBox(props)
}
extend(CBox, CMathBase);
CBox.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CBox.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
if(this.opEmu)
this.elements[0][0].decreaseArgSize();
}
CBox.prototype.setProperties = function(props)
{
if(props.opEmu === true || props.opEmu === 1)
this.opEmu = true;
......@@ -608,14 +607,17 @@ CBox.prototype.init = function(props)
if(props.aln === true || props.aln === 1)
this.aln = true;
this.setDimension(1, 1);
this.setContent();
this.setCtrPrp(props.ctrPrp);
if(this.opEmu)
this.elements[0][0].decreaseArgSize();
this.RecalcInfo.bProps = true;
}
CBox.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
// Base
this.elements[0][0] = contents[0];
}
CBox.prototype.getBase = function()
{
......@@ -732,32 +734,13 @@ function CBar(props)
extend(CBar, CCharacter);
CBar.prototype.init = function(props)
{
if(props.pos === LOCATION_TOP || props.location === LOCATION_TOP)
this.Pr.pos = LOCATION_TOP;
else if(props.pos === LOCATION_BOT || props.location === LOCATION_BOT)
this.Pr.pos = LOCATION_BOT;
var prp =
{
loc: this.Pr.pos,
type: DELIMITER_LINE
};
var defaultProps =
{
loc: LOCATION_BOT
};
this.setCharacter(prp, defaultProps);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
this.setProperties(props);
this.fillContent();
}
CBar.prototype.setLocation = function(pos)
CBar.prototype.fillContent = function()
{
this.Pr.pos = pos;
this.RecalcInfo.bProps = true;
this.setDimension(1, 1);
this.setContent();
}
CBar.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
......@@ -791,6 +774,23 @@ CBar.prototype.getAscent = function()
return ascent;
}
CBar.prototype.setProperties = function(props)
{
if(props.pos === LOCATION_TOP || props.pos === LOCATION_BOT)
this.Pr.pos = LOCATION_TOP;
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
CBar.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CBar.prototype.getPropsForWrite = function()
{
return this.Pr;
......@@ -850,30 +850,68 @@ function CPhantom(props)
this.props = null;
CMathBase.call(this);
this.init(props);
this.Pr =
{
show: true,
transp: false,
zeroAsc: false,
zeroDesc: false,
zeroWid: false
};
if(props !== null && typeof(props) !== "undefined")
this.setCtrPrp(props.ctrPrp);
this.init(props);
g_oTableId.Add( this, this.Id );
}
extend(CPhantom, CMathBase);
CPhantom.prototype.init = function(props)
{
this.props = props;
this.setProperties(props);
this.fillContent();
}
CPhantom.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
}
CPhantom.prototype.getBase = function()
{
return this.elements[0][0];
}
CPhantom.prototype.setProperties = function(props)
{
if(props.show == true || props.show == false)
this.Pr.show = props.show;
if(props.transp == false || props.transp == true)
this.Pr.transp = props.transp;
if(props.zeroAsc == false || props.zeroAsc == true)
this.Pr.zeroAsc = props.zeroAsc;
if(props.zeroDesc == false || props.zeroDesc == true)
this.Pr.zeroDesc = props.zeroDesc;
if(props.zeroWid == false || props.zeroWid == true)
this.Pr.zeroWid = props.zeroWid;
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
CPhantom.prototype.getPropsForWrite = function()
CPhantom.prototype.fillMathComposition = function(props, contents /*array*/)
{
return this.props;
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CPhantom.prototype.getBase = function()
CPhantom.prototype.getPropsForWrite = function()
{
return this.elements[0][0];
return this.props;
}
CPhantom.prototype.Save_Changes = function(Data, Writer)
{
......
......@@ -3,10 +3,8 @@ function CDegree(props)
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREE;
//this.type = DEGREE_SUPERSCRIPT;
this.upBase = 0; // отступ сверху для основания
this.upIter = 0; // отступ сверху для итератора
//this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
this.Pr =
{
......@@ -15,27 +13,26 @@ function CDegree(props)
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id );
}
extend(CDegree, CMathBase);
CDegree.prototype.init = function(props)
{
/*if(props.alnScr === true || props.alnScr === 1)
this.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0)
this.alnScr = false;*/
this.setProperties(props);
this.fillContent();
}
CDegree.prototype.fillContent = function()
{
var oBase = new CMathContent();
if(props.indef == 2) /// props include Base for CNary
{
oBase = props.oBase;
if(props.type === DEGREE_SUPERSCRIPT)
this.Pr.type = DEGREE_SUPERSCRIPT;
else if(props.type === DEGREE_SUBSCRIPT)
this.Pr.type = DEGREE_SUBSCRIPT;
oBase.setCtrPrp(props.ctrPrp);
}
this.setDimension(1, 2);
......@@ -44,20 +41,6 @@ CDegree.prototype.init = function(props)
this.addMCToContent(oBase, oDegree);
}
/*CDegree.prototype.init_2 = function(props, oBase)
{
if(props.type === DEGREE_SUPERSCRIPT)
this.type = DEGREE_SUPERSCRIPT;
else if(props.type === DEGREE_SUBSCRIPT)
this.type = DEGREE_SUBSCRIPT;
this.setDimension(1, 2);
var oDegree = new CMathContent();
oDegree.decreaseArgSize();
this.addMCToContent(oBase, oDegree);
}*/
CDegree.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type === DEGREE_SUPERSCRIPT)
......@@ -458,22 +441,35 @@ CDegree.prototype.getBase = function()
{
return this.elements[0][0];
}
/*CDegree.prototype.getPropsForWrite = function()
CDegree.prototype.IsPlhIterator = function()
{
var props = {};
return this.elements[0][1].IsPlaceholder();
}
CDegree.prototype.setProperties = function(props)
{
if(props.type === DEGREE_SUPERSCRIPT)
this.Pr.type = DEGREE_SUPERSCRIPT;
else if(props.type === DEGREE_SUBSCRIPT)
this.Pr.type = DEGREE_SUBSCRIPT;
props.type = this.type;
//props.alnScr = this.alnScr;
this.setCtrPrp(props.ctrPrp);
return props;
}*/
CDegree.prototype.getPropsForWrite = function()
this.RecalcInfo.bProps = true;
}
CDegree.prototype.fillMathComposition = function(props, contents /*array*/)
{
return this.Pr;
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
// Iterator
this.elements[0][1] = contents[1];
}
CDegree.prototype.IsPlhIterator = function()
CDegree.prototype.getPropsForWrite = function()
{
return this.elements[0][1].IsPlaceholder();
return this.Pr;
}
CDegree.prototype.Save_Changes = function(Data, Writer)
{
......@@ -643,6 +639,11 @@ CIterators.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
}
CIterators.prototype.fillMathComposition = function(upperIterator, lowerIterator)
{
this.elements[0][0] = upperIterator;
this.elements[1][0] = lowerIterator;
}
function CDegreeSubSup(props)
{
......@@ -662,25 +663,26 @@ function CDegreeSubSup(props)
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id );
}
extend(CDegreeSubSup, CMathBase);
CDegreeSubSup.prototype.init = function(props)
{
if(props.alnScr === true || props.alnScr === 1)
this.Pr.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0)
this.Pr.alnScr = false;
this.setProperties(props);
this.fillContent();
}
CDegreeSubSup.prototype.fillContent = function()
{
var oBase = new CMathContent();
if(props.indef == 2) /// props include Base for CNary
{
oBase = props.oBase;
if(props.type === DEGREE_SubSup || props.type === DEGREE_PreSubSup)
this.Pr.type = props.type;
oBase.setCtrPrp(props.ctrPrp);
}
this.setDimension(1, 2);
......@@ -702,41 +704,7 @@ CDegreeSubSup.prototype.init = function(props)
oIters.alignHor(-1, 1);
this.addMCToContent(oIters, oBase);
}
/// вызов этой функции обязательно в конце
//this.WriteContentsToHistory();
}
/*CDegreeSubSup.prototype.init_2 = function(props, oBase)
{
if(props.type === DEGREE_SubSup)
this.type = DEGREE_SubSup;
else if(props.type === DEGREE_PreSubSup)
this.type = DEGREE_PreSubSup;
this.setDimension(1, 2);
var oIters = new CIterators();
oIters.init();
oIters.decreaseArgSize();
oIters.lUp = 0;
oIters.lD = 0;
if(this.type == DEGREE_SubSup)
{
oIters.alignHor(-1, 0);
this.addMCToContent(oBase, oIters);
}
else if(this.type == DEGREE_PreSubSup)
{
oIters.alignHor(-1, 1);
this.addMCToContent(oIters, oBase);
}
/// вызов этой функции обязательно в конце
this.WriteContentsToHistory();
}*/
CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.Get_CompiledCtrPrp();
......@@ -1130,15 +1098,44 @@ CDegreeSubSup.prototype.getLowerIterator = function()
return iter;
}
CDegreeSubSup.prototype.getPropsForWrite = function()
CDegreeSubSup.prototype.setProperties = function(props)
{
if(props.alnScr === true || props.alnScr === 1)
this.Pr.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0)
this.Pr.alnScr = false;
if(props.type === DEGREE_SubSup || props.type === DEGREE_PreSubSup)
this.Pr.type = props.type;
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
CDegreeSubSup.prototype.fillMathComposition = function(props, contents /*array*/)
{
/*var props = {};
this.setProperties(props);
this.fillContent();
props.type = this.type;
props.alnScr = this.alnScr;
if(this.Pr.type == DEGREE_SubSup)
{
// Base
this.elements[0][0] = contents[0];
return props;*/
// Iterators
this.elements[0][1].fillMathComposition(contents[1]/*upper iterator*/, contents[2]/*lower iterator*/);
}
else
{
// Base
this.elements[0][1] = contents[0];
// Iterators
this.elements[0][0].fillMathComposition(contents[1]/*upper iterator*/, contents[2]/*lower iterator*/);
}
}
CDegreeSubSup.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CDegreeSubSup.prototype.Save_Changes = function(Data, Writer)
......@@ -1198,16 +1195,3 @@ CDegreeSubSup.prototype.Get_Id = function()
{
return this.Id;
}
//выяcнить: почему и с этой ф-ией и без нее работает всё ok...
//всё ok, т.к. в контенте 2 элемента, и их center сравниваем
/*CDegreeSubSup.prototype.getCenter = function()
{
var center = 0;
if(this.type == 0)
center = this.elements[0][1].size.center;
else
center = this.elements[0][0].size.center;
return center;
}*/
......@@ -13,6 +13,7 @@ function CFraction(props)
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
......@@ -20,48 +21,8 @@ function CFraction(props)
extend(CFraction, CMathBase);
CFraction.prototype.init = function(props)
{
this.setType(props.type);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CFraction.prototype.setType = function(type)
{
var bValid = typeof(type) !== "undefined" && type !== null;
if(bValid)
{
var bBar = type === BAR_FRACTION || type === NO_BAR_FRACTION,
bSkew = type === SKEWED_FRACTION,
bLin = type === LINEAR_FRACTION;
if(bBar || bSkew || bLin) // на всякий случай
this.Pr.type = type;
}
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{
var num = new CNumerator();
var den = new CDenominator();
this.setDimension(2, 1);
if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true;
this.addMCToContent(num, den);
}
else if(this.Pr.type == SKEWED_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
}
else if(this.Pr.type == LINEAR_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
}
this.setProperties(props);
this.fillContent();
}
CFraction.prototype.getType = function()
{
......@@ -424,11 +385,71 @@ CFraction.prototype.findDisposition = function( mCoord )
return disposition;
}
CFraction.prototype.setProperties = function(props)
{
var bBar = props.type === BAR_FRACTION || props.type === NO_BAR_FRACTION,
bSkew = props.type === SKEWED_FRACTION,
bLin = props.type === LINEAR_FRACTION;
if(bBar || bSkew || bLin)
this.Pr.type = props.type;
this.setCtrPrp(props.ctrPrp);
}
CFraction.prototype.fillContent = function()
{
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{
var num = new CNumerator();
var den = new CDenominator();
this.setDimension(2, 1);
if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true;
this.addMCToContent(num, den);
}
else if(this.Pr.type == SKEWED_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
}
else if(this.Pr.type == LINEAR_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
}
}
CFraction.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{
// Numerator
this.elements[0][0].fillMathComposition(contents[0]);
// Denominator
this.elements[1][0].fillMathComposition(contents[1]);
}
else
{
// Numerator
this.elements[0][0] = contents[0];
// Denominator
this.elements[0][1] = contents[1];
}
}
CFraction.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CFraction.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong( historyitem_type_frac );
......@@ -587,6 +608,10 @@ CNumerator.prototype.getElement = function()
{
return this.elements[0][0];
}
CNumerator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CNumerator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
......@@ -664,6 +689,10 @@ CDenominator.prototype.getElement = function(txt)
{
return this.elements[0][0];
}
CDenominator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CDenominator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
......
......@@ -11,26 +11,17 @@ function CLimit(props)
CMathBase.call(this);
if(props.type === LIMIT_UP || props.type === LIMIT_LOW)
this.Pr.type = props.type;
this.setDimension(2, 1);
var oBase = new CMathContent();
var oIter = new CMathContent();
oIter.decreaseArgSize();
if(this.Pr.type == LIMIT_LOW)
this.addMCToContent(oBase, oIter);
else if(this.Pr.type == LIMIT_UP)
this.addMCToContent(oIter, oBase);
this.setCtrPrp(props.ctrPrp);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
extend(CLimit, CMathBase);
CLimit.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CLimit.prototype.getAscent = function()
{
var ascent;
......@@ -65,6 +56,50 @@ CLimit.prototype.setDistance = function()
{
this.dH = 0.03674768518518519*this.Get_CompiledCtrPrp().FontSize;
}
CLimit.prototype.setProperties = function(props)
{
if(props.type === LIMIT_UP || props.type === LIMIT_LOW)
this.Pr.type = props.type;
this.setCtrPrp(props.ctrPrp);
}
CLimit.prototype.fillContent = function()
{
this.setDimension(2, 1);
var oBase = new CMathContent();
var oIter = new CMathContent();
oIter.decreaseArgSize();
if(this.Pr.type == LIMIT_LOW)
this.addMCToContent(oBase, oIter);
else if(this.Pr.type == LIMIT_UP)
this.addMCToContent(oIter, oBase);
}
CLimit.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
if(this.Pr.type == LIMIT_LOW)
{
// Base
this.elements[0][0] = contents[0];
// Iterator
this.elements[1][0] = contents[1];
}
else
{
// Iterator
this.elements[0][0] = contents[1];
// Base
this.elements[1][0] = contents[0];
}
}
CLimit.prototype.getPropsForWrite = function()
{
return this.Pr;
......@@ -115,14 +150,17 @@ function CMathFunc(props)
CMathBase.call(this);
this.setDimension(1, 2);
this.setContent();
this.setCtrPrp(props.ctrPrp);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
extend(CMathFunc, CMathBase);
CMathFunc.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.Get_CompiledCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
......@@ -135,6 +173,27 @@ CMathFunc.prototype.getArgument = function()
{
return this.elements[0][1];
}
CMathFunc.prototype.setProperties = function(props)
{
this.setCtrPrp(props.ctrPrp);
}
CMathFunc.prototype.fillContent = function()
{
this.setDimension(1, 2);
this.setContent();
}
CMathFunc.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// FName
this.elements[0][0] = contents[0];
// Argument
this.element[0][1] = contents[1];
}
CMathFunc.prototype.getPropsForWrite = function()
{
var props = {};
......
This diff is collapsed.
......@@ -18,24 +18,17 @@ function CNary(props)
limLoc: null
};
//this.limLoc = null;
//this.type = null;
//this.code = null; // for "read"
//this.grow = false;
//this.supHide = false;
//this.subHide = false;
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
//this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id );
}
extend(CNary, CMathBase);
CNary.prototype.init = function(props)
{
if(props.ctrPrp !== null && typeof(props.ctrPrp)!== "undefined")
this.setCtrPrp(props.ctrPrp);
if(props.supHide === true || props.supHide === 1)
......@@ -51,8 +44,6 @@ CNary.prototype.init = function(props)
var oSign = this.getSign(props.chr, props.signType);
//this.Pr.chrType = oSign.chrType;
//this.Pr.chr = String.fromCharCode(oSign.chrCode);
this.Pr.chrType = props.chrType;
this.Pr.chr = props.chr;
......@@ -65,8 +56,6 @@ CNary.prototype.init = function(props)
{
var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231;
//var MPrp = this.Parent.Composition.GetMathPr();
if(bIntegral)
this.Pr.limLoc = g_oMathSettings.intLim;
else
......@@ -106,19 +95,20 @@ CNary.prototype.init = function(props)
}
else
{
var prp;
if( this.Pr.supHide && !this.Pr.subHide )
{
var prp = {type: DEGREE_SUBSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy() };
prp = {type: DEGREE_SUBSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy() };
base = new CDegree(prp);
}
else if( !this.Pr.supHide && this.Pr.subHide )
{
var prp = {type: DEGREE_SUPERSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
prp = {type: DEGREE_SUPERSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
base = new CDegree(prp);
}
else
{
var prp = {type: DEGREE_SubSup, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
prp = {type: DEGREE_SubSup, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
base = new CDegreeSubSup(prp);
}
}
......@@ -283,14 +273,7 @@ CNary.prototype.getLowerIterator = function()
}
CNary.prototype.getPropsForWrite = function()
{
var props = {
chr: String.fromCharCode(this.code),
grow: this.grow,
limLoc: this.limLoc,
subHide: this.subHide,
supHide: this.supHide
};
return props;
return this.Pr;
}
CNary.prototype.Save_Changes = function(Data, Writer)
{
......
......@@ -2267,7 +2267,7 @@ function COperator(type)
this.shiftAccent = 0;
}
COperator.prototype.setProperties = function(properties, defaultProps) // props (chr, type, location), defaultProps (chr, location)
COperator.prototype.mergeProperties = function(properties, defaultProps) // props (chr, type, location), defaultProps (chr, location)
{
var props = this.getProps(properties, defaultProps);
......@@ -3522,7 +3522,7 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
type: PARENTHESIS_LEFT
};
this.begOper.setProperties(begPrp, begDefaultPrp);
this.begOper.mergeProperties(begPrp, begDefaultPrp);
this.begOper.relate(this);
var endPrp =
......@@ -3536,7 +3536,7 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
type: PARENTHESIS_RIGHT
};
this.endOper.setProperties(endPrp, endDefaultPrp);
this.endOper.mergeProperties(endPrp, endDefaultPrp);
this.endOper.relate(this);
var sepPrp =
......@@ -3553,7 +3553,7 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
if(this.nCol == 1 )
sepPrp.type = OPERATOR_EMPTY;
this.sepOper.setProperties(sepPrp, sepDefaultPrp);
this.sepOper.mergeProperties(sepPrp, sepDefaultPrp);
this.sepOper.relate(this);
......@@ -3983,11 +3983,11 @@ function CCharacter()
extend(CCharacter, CMathBase);
CCharacter.prototype.setCharacter = function(props, defaultProps)
{
this.operator.setProperties(props, defaultProps);
this.operator.mergeProperties(props, defaultProps);
this.operator.relate(this);
this.setDimension(1, 1);
this.setContent();
//this.setDimension(1, 1);
//this.setContent();
}
CCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
......
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