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

Реализовала функции fillMathComposition для классов CGroupCharacter,...

Реализовала функции fillMathComposition для классов CGroupCharacter, CDelimiters, CNary, CRadical, CDegree, CDegreeSubSup


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56552 954022d7-b5bf-4e40-9824-e11837661b57
parent 45a63b6f
......@@ -184,7 +184,7 @@ CMathBase.prototype =
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if( !this.elements[i][j].IsJustDraw())
if( !this.elements[i][j].IsJustDraw() )
this.elements[i][j].setArgSize(argSize);
},
// TO DO
......@@ -328,8 +328,7 @@ CMathBase.prototype =
bUpperLevel = true;
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() );
//из цикла вышли если bJustDraw = false or bUpperLevel = true
......@@ -366,8 +365,7 @@ CMathBase.prototype =
bUpperLevel = true;
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() );
var content;
if( bUpperLevel )
......
......@@ -28,11 +28,11 @@ CDegree.prototype.fillContent = function()
{
var oBase = new CMathContent();
if(props.indef == 2) /// props include Base for CNary
/*if(props.indef == 2) /// props include Base for CNary
{
oBase = props.oBase;
oBase.setCtrPrp(props.ctrPrp);
}
}*/
this.setDimension(1, 2);
......@@ -467,6 +467,18 @@ CDegree.prototype.fillMathComposition = function(props, contents /*array*/)
// Iterator
this.elements[0][1] = contents[1];
}
CDegree.prototype.changeBase = function(base)
{
this.elements[0][0] = base;
}
CDegree.prototype.changeUpperIterator = function(iterator)
{
this.elements[0][1] = iterator;
}
CDegree.prototype.changeLowerIterator = function(iterator)
{
this.elements[0][1] = iterator;
}
CDegree.prototype.getPropsForWrite = function()
{
return this.Pr;
......@@ -635,6 +647,14 @@ CIterators.prototype.getLowerIterator = function()
{
return this.elements[1][0];
}
CIterators.prototype.changeUpperIterator = function(iterator)
{
this.elements[0][0] = iterator;
}
CIterators.prototype.changeLowerIterator = function(iterator)
{
this.elements[1][0] = iterator;
}
CIterators.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
......@@ -678,12 +698,6 @@ CDegreeSubSup.prototype.fillContent = function()
{
var oBase = new CMathContent();
if(props.indef == 2) /// props include Base for CNary
{
oBase = props.oBase;
oBase.setCtrPrp(props.ctrPrp);
}
this.setDimension(1, 2);
var oIters = new CIterators();
......@@ -1098,6 +1112,20 @@ CDegreeSubSup.prototype.getLowerIterator = function()
return iter;
}
CDegreeSubSup.prototype.changeUpperIterator = function(iterator)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][1].changeUpperIterator(iterator);
else
this.elements[0][0].changeUpperIterator(iterator);
}
CDegreeSubSup.prototype.changeLowerIterator = function(iterator)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][1].changeLowerIterator(iterator);
else
this.elements[0][0].changeLowerIterator(iterator);
}
CDegreeSubSup.prototype.setProperties = function(props)
{
if(props.alnScr === true || props.alnScr === 1)
......@@ -1134,6 +1162,13 @@ CDegreeSubSup.prototype.fillMathComposition = function(props, contents /*array*/
this.elements[0][0].fillMathComposition(contents[1]/*upper iterator*/, contents[2]/*lower iterator*/);
}
}
CDegreeSubSup.prototype.changeBase = function(base)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][0] = base;
else
this.elements[0][1] = base;
}
CDegreeSubSup.prototype.getPropsForWrite = function()
{
return this.Pr;
......
......@@ -18,7 +18,6 @@ function CNary(props)
limLoc: null
};
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
......@@ -28,6 +27,11 @@ function CNary(props)
}
extend(CNary, CMathBase);
CNary.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CNary.prototype.setProperties = function(props)
{
this.setCtrPrp(props.ctrPrp);
......@@ -40,81 +44,92 @@ CNary.prototype.init = function(props)
if(props.grow === true || props.grow === 1)
this.Pr.grow = true;
this.setDimension(1, 2);
var oSign = this.getSign(props.chr, props.signType);
this.Pr.chrType = props.chrType;
this.Pr.chr = props.chr;
if(props.limLoc == NARY_UndOvr)
this.Pr.limLoc = NARY_UndOvr;
else if(props.limLoc == NARY_SubSup)
this.Pr.limLoc = NARY_SubSup;
else
{
var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231;
if(bIntegral)
this.Pr.limLoc = g_oMathSettings.intLim;
else
this.Pr.limLoc = g_oMathSettings.naryLim;
}
if(props.limLoc == NARY_UndOvr || props.limLoc == NARY_SubSup)
this.Pr.limLoc = props.limLoc;
}
CNary.prototype.fillContent = function()
{
this.setDimension(1, 2);
var arg = new CMathContent(),
base;
var ctrPrp = this.CtrPrp.Copy();
if(this.Pr.limLoc === NARY_UndOvr)
{
if(this.Pr.supHide && this.Pr.subHide)
{
base = oSign.operator;
base = new CMathText(true);
}
else if( this.Pr.supHide && !this.Pr.subHide )
{
base = new CNaryOvr();
base.init(oSign.operator);
//base.init(oBase);
base.setCtrPrp(this.CtrPrp.Copy());
base.setCtrPrp(ctrPrp);
}
else if( !this.Pr.supHide && this.Pr.subHide )
{
base = new CNaryUnd();
base.init(oSign.operator);
base.setCtrPrp(this.CtrPrp.Copy());
//base.init(oBase);
base.setCtrPrp(ctrPrp);
}
else
{
base = new CNaryUndOvr();
base.init(oSign.operator);
base.setCtrPrp(this.CtrPrp.Copy());
//base.init(oBase);
base.setCtrPrp(ctrPrp);
}
}
else
{
var prp;
if( this.Pr.supHide && !this.Pr.subHide )
{
prp = {type: DEGREE_SUBSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy() };
prp = {type: DEGREE_SUBSCRIPT, ctrPrp: ctrPrp };
base = new CDegree(prp);
}
else if( !this.Pr.supHide && this.Pr.subHide )
{
prp = {type: DEGREE_SUPERSCRIPT, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
prp = {type: DEGREE_SUPERSCRIPT, ctrPrp: ctrPrp};
base = new CDegree(prp);
}
else
{
prp = {type: DEGREE_SubSup, indef: 2, oBase: oSign.operator, ctrPrp: this.CtrPrp.Copy()};
prp = {type: DEGREE_SubSup, ctrPrp: ctrPrp};
base = new CDegreeSubSup(prp);
}
}
this.addMCToContent(base, arg);
}
CNary.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][1] = contents[0];
// Upper iterator
if(!this.Pr.subHide)
this.elements[0][0].changeUpperIterator(contents[1]);
// Lower iterator
if(!this.Pr.subHide)
this.elements[0][0].changeLowerIterator(contents[2]);
}
CNary.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
......@@ -122,6 +137,22 @@ CNary.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
var oSign = this.getSign(this.Pr.chr, this.Pr.chrType);
if(this.Pr.limLoc == null || typeof(this.Pr.limLoc) == "undefined")
{
var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231;
if(bIntegral)
this.Pr.limLoc = g_oMathSettings.intLim;
else
this.Pr.limLoc = g_oMathSettings.naryLim;
}
if(this.Pr.supHide && this.Pr.subHide)
this.elements[0][0] = oSign.operator;
else
this.elements[0][0].changeBase(oSign.operator);
this.Pr.chrType = oSign.chrType;
this.Pr.chr = String.fromCharCode(oSign.chrCode);
}
......@@ -354,16 +385,28 @@ function CNaryUnd()
CMathBase.call(this);
}
extend(CNaryUnd, CMathBase);
CNaryUnd.prototype.init = function(sign)
CNaryUnd.prototype.init = function()
{
this.setDimension(2,1);
this.setDimension(2, 1);
var iter = new CMathContent();
iter.decreaseArgSize();
//sign.relate(this);
var base = new CMathContent();
this.addMCToContent(iter, base);
}
CNaryUnd.prototype.old_init = function(sign)
{
this.setDimension(2,1);
var iter = new CMathContent();
iter.decreaseArgSize();
this.addMCToContent(iter, sign);
}
CNaryUnd.prototype.changeBase = function(base)
{
this.elements[1][0] = base;
}
CNaryUnd.prototype.setDistance = function()
{
var zetta = this.Get_CompiledCtrPrp().FontSize* 25.4/96;
......@@ -377,6 +420,10 @@ CNaryUnd.prototype.getUpperIterator = function()
{
return this.elements[0][0];
}
CNaryUnd.prototype.changeUpperIterator = function(iterator)
{
this.elements[0][0] = iterator;
}
function CNaryOvr()
......@@ -384,7 +431,17 @@ function CNaryOvr()
CMathBase.call(this);
}
extend(CNaryOvr, CMathBase);
CNaryOvr.prototype.init = function(sign)
CNaryOvr.prototype.init = function()
{
this.setDimension(2, 1);
var iter = new CMathContent();
iter.decreaseArgSize();
var base = new CMathContent();
this.addMCToContent(base, iter);
}
CNaryOvr.prototype.old_init = function(sign)
{
this.setDimension(2,1);
var iter = new CMathContent();
......@@ -394,6 +451,10 @@ CNaryOvr.prototype.init = function(sign)
this.addMCToContent(sign, iter);
}
CNaryOvr.prototype.changeBase = function(base)
{
this.elements[0][0] = base;
}
CNaryOvr.prototype.old_setDistance = function()
{
var zetta = this.Get_CompiledCtrPrp().FontSize* 25.4/96;
......@@ -424,10 +485,14 @@ CNaryOvr.prototype.old_getAscent = function()
{
return this.elements[0][0].size.ascent;
}
CNaryOvr.prototype.getLowerIterator= function()
CNaryOvr.prototype.getLowerIterator = function()
{
return this.elements[1][0];
}
CNaryOvr.prototype.changeLowerIterator = function(iterator)
{
this.elements[1][0] = iterator;
}
function CNaryUndOvr()
{
......@@ -436,7 +501,7 @@ function CNaryUndOvr()
CMathBase.call(this);
}
extend(CNaryUndOvr, CMathBase);
CNaryUndOvr.prototype.init = function(sign)
CNaryUndOvr.prototype.init = function()
{
this.setDimension(3,1);
......@@ -446,7 +511,13 @@ CNaryUndOvr.prototype.init = function(sign)
var iter2 = new CMathContent();
iter2.decreaseArgSize();
this.addMCToContent(iter1, sign, iter2);
var base = new CMathContent();
this.addMCToContent(iter1, base, iter2);
}
CNaryUndOvr.prototype.changeBase = function(base)
{
this.elements[1][0] = base;
}
CNaryUndOvr.prototype.recalculateSize = function()
{
......@@ -558,6 +629,14 @@ CNaryUndOvr.prototype.findDisposition = function(mCoord)
return {pos: {x: pos_x, y: pos_y}, mCoord: {x: X, y: Y}, inside_flag: inside_flag};
}
CNaryUndOvr.prototype.changeUpperIterator = function(iterator)
{
this.elements[0][0] = iterator;
}
CNaryUndOvr.prototype.changeLowerIterator = function(iterator)
{
this.elements[2][0] = iterator;
}
CNaryUndOvr.prototype.getLowerIterator = function()
{
return this.elements[2][0];
......
......@@ -3309,8 +3309,6 @@ function CDelimiter(props)
sepChr: null,
sepChrType: null,
//// special for "read" ////
column: 0,
shp: DELIMITER_SHAPE_CENTERED,
......@@ -3321,14 +3319,23 @@ function CDelimiter(props)
//this.grow = true;
//// special for "read" ////
this.column = 0;
CMathBase.call(this);
this.init(props);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
extend(CDelimiter, CMathBase);
CDelimiter.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CDelimiter.prototype.setProperties = function(props)
{
if(props.grow == true || props.grow == 1)
this.Pr.grow = true;
......@@ -3344,21 +3351,30 @@ CDelimiter.prototype.init = function(props)
this.Pr.sepChr = props.sepChr;
this.Pr.sepChrType = props.sepChrType;
if(props.column !== null || typeof(props.column) !== "undefined")
this.Pr.column = props.column;
else
this.Pr.column = 1;
if(props.shape == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_MATH)
this.Pr.shp = DELIMITER_SHAPE_MATH;
else if(props.shape == DELIMITER_SHAPE_CENTERED || props.shp == DELIMITER_SHAPE_CENTERED)
this.Pr.shp = DELIMITER_SHAPE_CENTERED;
if(props.column === null || typeof(props.column) === "undefined")
props.column = 1;
if(props.shp == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_CENTERED)
this.Pr.shp = props.shp;
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
this.setDimension(1, props.column);
}
CDelimiter.prototype.fillContent = function()
{
this.setDimension(1, this.Pr.column);
this.setContent();
}
CDelimiter.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
for(var j = 0; j < this.nCol; j++)
this.elements[0][j] = contents[j];
}
CDelimiter.prototype.old_recalculateSize = function()
{
var height = 0,
......@@ -4150,23 +4166,20 @@ function CGroupCharacter(props)
CCharacter.call(this);
this.init(props);
if(props !== null && typeof(props)!== "undefined")
this.init(props);
/// вызов этой функции обязательно в конце
g_oTableId.Add( this, this.Id );
}
extend(CGroupCharacter, CCharacter);
CGroupCharacter.prototype.init = 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.setProperties(props);
this.fillContent();
var operDefaultPrp =
/*var operDefaultPrp =
{
type: BRACKET_CURLY_BOTTOM,
loc: LOCATION_BOT
......@@ -4182,16 +4195,8 @@ CGroupCharacter.prototype.init = function(props)
this.setCharacter(operProps, operDefaultPrp);
this.Pr.chrType = this.operator.typeOper;
this.Pr.chr = String.fromCharCode(this.operator.code);
this.Pr.chr = String.fromCharCode(this.operator.code);*/
//////////////////////////////////////////////////////////////////
if(props.ctrPrp !== null && typeof(props.ctrPrp)!== "undefined")
this.setCtrPrp(props.ctrPrp);
/// вызов этой функции обязательно в конце
g_oTableId.Add( this, this.Id );
}
CGroupCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
......@@ -4220,6 +4225,31 @@ CGroupCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
CGroupCharacter.superclass.Resize.call(this, Parent, ParaMath, oMeasure);
}
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);
}
CGroupCharacter.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
}
CGroupCharacter.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
this.elements[0][0] = contents[0];
}
CGroupCharacter.prototype.getAscent = function(oMeasure)
{
var ascent;
......
......@@ -902,12 +902,19 @@ function CRadical(props)
CMathBase.call(this);
this.init(props);
this.setCtrPrp(props.ctrPrp);
if(props !== null && typeof(props)!== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
extend(CRadical, CMathBase);
CRadical.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CRadical.prototype.setProperties = function(props)
{
if(props.type === SQUARE_RADICAL || props.type === DEGREE_RADICAL)
this.Pr.type = props.type;
......@@ -917,9 +924,10 @@ CRadical.prototype.init = function(props)
else if(props.degHide == false || props.degHide === 0)
this.Pr.type = DEGREE_RADICAL;
this.setDimension(1, 1);
this.setContent();
this.setCtrPrp(props.ctrPrp);
}
CRadical.prototype.fillContent = function()
{
this.signRadical = new CSignRadical();
this.signRadical.relate(this);
......@@ -933,14 +941,23 @@ CRadical.prototype.init = function(props)
this.setDimension(1, 2);
var oBase = new CMathContent();
var oDegree = new CMathContent();
//oDegree.decreaseArgSize();
oDegree.setArgSize(-2);
this.addMCToContent(oDegree, oBase);
}
}
CRadical.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
if(this.Pr.type == SQUARE_RADICAL)
this.elements[0][0] = contents[0];
else if(this.Pr.type == DEGREE_RADICAL)
this.elements[0][1] = contents[0];
/// вызов этой функции обязательно в конце
// this.WriteContentsToHistory();
if(this.Pr.degHide == false)
this.elements[0][0] = contents[1];
}
CRadical.prototype.recalculateSize = function(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