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

Свойства по формату : accent, delimiters, borderBox, bar, box, fraction,...

Свойства по формату : accent, delimiters, borderBox, bar, box, fraction, limit, nary, GroupCharacter

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56373 954022d7-b5bf-4e40-9824-e11837661b57
parent d89942bb
......@@ -786,13 +786,13 @@ ParaMath.prototype =
if(argSize == -1)
{
//FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26;
FSize = 0.77*FSize;
FSize = 0.76*FSize;
}
else if(argSize == -2)
{
//FSize = -0.0004*FSize*FSize + 0.66*FSize + 0.87;
FSize = 0.77*0.77*FSize;
FSize = 0.76*0.855*FSize;
}
tPrp.FontSize = FSize;
......
......@@ -1640,8 +1640,8 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.operator.setProperties(prp, defaultPrp);
this.chr = String.fromCharCode(this.operator.code);
this.chrType = this.operator.typeOper;
this.Pr.chr = String.fromCharCode(this.operator.code);
this.Pr.chrType = this.operator.typeOper;
}
this.operator.relate(this);
......
......@@ -976,7 +976,7 @@ CMathBase.prototype =
width += this.dW*(this.nCol - 1);
width += this.GapLeft + this.GapRight;
var ascent = this.getAscent(height, oMeasure);
var ascent = this.getAscent(oMeasure, height);
this.size = {width: width, height: height, ascent: ascent};
},
......@@ -994,7 +994,7 @@ CMathBase.prototype =
{
this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false;
this.RecalcInfo.bProps = false;
//this.RecalcInfo.bProps = false;
}
for(var i=0; i < this.nRow; i++)
......@@ -1017,12 +1017,12 @@ CMathBase.prototype =
return res;
},
getAscent: function(_height, oMeasure)
getAscent: function(oMeasure, _height)
{
var Ascent = 0;
if(this.nRow > 1)
{
Ascent = _height || this.size.height;
Ascent = _height;
Ascent /=2;
var MergedCtrPrp = this.Get_CompiledCtrPrp();
Ascent += this.ParaMath.GetShiftCenter(oMeasure, MergedCtrPrp);
......
......@@ -22,10 +22,10 @@ function CBorderBox(props)
hideRight: false,
hideTop: false,
hideBot: false,
strikeBLTR: true,
strikeTLBR: true,
strikeH: true,
strikeV: true
strikeBLTR: false,
strikeTLBR: false,
strikeH: false,
strikeV: false
};
CMathBase.call(this);
......@@ -62,35 +62,36 @@ CBorderBox.prototype.init = function(props)
}*/
this.setBorders(props);
this.setDimension(1, 1);
this.setDimension(1, 1);
this.setContent();
}
CBorderBox.prototype.setBorders = function(props)
{
if(typeof(props) !== "undefined" && props !== null)
{
if(typeof(this.Pr.hideLeft) !== "undefined" && this.Pr.hideLeft !== null)
if(typeof(props.hideLeft) !== "undefined" && props.hideLeft !== null)
this.Pr.hideLeft = props.hideLeft;
if(typeof(this.Pr.hideRight) !== "undefined" && this.Pr.hideRight !== null)
if(typeof(props.hideRight) !== "undefined" && props.hideRight !== null)
this.Pr.hideRight = props.hideRight;
if(typeof(this.Pr.hideTop) !== "undefined" && this.Pr.hideTop !== null)
if(typeof(props.hideTop) !== "undefined" && props.hideTop !== null)
this.Pr.hideTop = props.hideTop;
if(typeof(this.Pr.hideBot) !== "undefined" && this.Pr.hideBot !== null)
if(typeof(props.hideBot) !== "undefined" && props.hideBot !== null)
this.Pr.hideBot = props.hideBot;
if(typeof(this.Pr.strikeBLTR) !== "undefined" && this.Pr.strikeBLTR !== null) // right diagonal
if(typeof(props.strikeBLTR) !== "undefined" && props.strikeBLTR !== null) // right diagonal
this.Pr.strikeBLTR = props.strikeBLTR;
if(typeof(this.Pr.strikeTLBR) !== "undefined" && this.Pr.strikeTLBR !== null) // left diagonal
if(typeof(props.strikeTLBR) !== "undefined" && props.strikeTLBR !== null) // left diagonal
this.Pr.strikeTLBR = props.strikeTLBR;
if(typeof(this.Pr.strikeH) !== "undefined" && this.Pr.strikeH !== null)
if(typeof(props.strikeH) !== "undefined" && props.strikeH !== null)
this.Pr.strikeH = props.strikeH;
if(typeof(this.Pr.strikeV) !== "undefined" && this.Pr.strikeV !== null)
if(typeof(props.strikeV) !== "undefined" && props.strikeV !== null)
this.Pr.strikeV = props.strikeV;
}
......@@ -129,7 +130,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
//var penW = this.Get_CompiledCtrPrp().FontSize* 25.4/72 * 0.06 ;
var penW = this.Get_CompiledCtrPrp().FontSize*0.02;
if(this.Pr.hideTop == false)
if(!this.Pr.hideTop)
{
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW/2,
......@@ -145,7 +146,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawHorLine(0, y1 + penW, x1 + 2*25.4/96, x2 , 25.4/96);*/
}
if(this.Pr.hideBot == false)
if(!this.Pr.hideBot)
{
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW/2,
......@@ -155,7 +156,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawHorLine(0, y1, x1, x2, penW);
}
if(this.Pr.hideLeft == false)
if(!this.Pr.hideLeft)
{
var x1 = this.pos.x + x,
y1 = this.pos.y + y,
......@@ -165,7 +166,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawVerLine(0, x1, y1, y2, penW);
}
if(this.Pr.hideRight == false)
if(!this.Pr.hideRight)
{
var x1 = this.pos.x + x + this.size.width - penW/2,
y1 = this.pos.y + y,
......@@ -227,7 +228,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
}
if(this.bHor)
if(this.Pr.strikeH)
{
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW,
......@@ -237,7 +238,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawHorLine(0, y1, x1, x2, penW);
}
if(this.bVert)
if(this.Pr.strikeV)
{
var x1 = this.pos.x + x + this.size.width/2 - penW/2,
y1 = this.pos.y + y,
......@@ -247,6 +248,135 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawVerLine(0, x1, y1, y2, penW);
}
}
CBorderBox.prototype.old_draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
//var penW = this.getCtrPrp().FontSize* 25.4/96 * 0.08 ;
var penW = this.Get_CompiledCtrPrp().FontSize*0.02;
if(!this.Pr.hideTop)
{
var x1 = this.pos.x + x,
//x2 = this.pos.x + x + this.size.width - 25.4/96,
x2 = this.pos.x + x + this.size.width - penW,
y1 = this.pos.y + y;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
}
if(!this.Pr.hideBot)
{
var x1 = this.pos.x + x,
//x2 = this.pos.x + x + this.size.width - 25.4/96,
x2 = this.pos.x + x + this.size.width - penW,
y1 = this.pos.y + y + this.size.height - penW;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
}
if(!this.Pr.hideLeft)
{
var x1 = this.pos.x + x,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - penW;
//y2 = this.pos.y + y + this.size.height - 25.4/96;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
}
if(!this.Pr.hideRight)
{
var x1 = this.pos.x + x + this.size.width - penW,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - penW;
//y2 = this.pos.y + y + this.size.height - 25.4/96 ;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
}
if(this.Pr.strikeTLBR)
{
var pW = penW*0.8;
var x1 = this.pos.x + x , y1 = this.pos.y + y,
x2 = x1 + pW, y2 = y1,
//x3 = x1 + this.size.width - 25.4/96, y3 = y1 + this.size.height - pW - 25.4/96,
x3 = x1 + this.size.width - penW, y3 = y1 + this.size.height - pW - penW,
x4 = x3, y4 = y3 + pW,
x5 = x4 - pW, y5 = y4,
x6 = x1, y6 = y1 + pW,
x7 = x1, y7 = y1;
pGraphics.p_width(1000);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics._l(x3, y3);
pGraphics._l(x4, y4);
pGraphics._l(x5, y5);
pGraphics._l(x6, y6);
pGraphics._l(x7, y7);
pGraphics.df();
}
if(this.Pr.strikeBLTR)
{
var pW = penW*0.8;
var x1 = this.pos.x + x + this.size.width - pW - penW, y1 = this.pos.y + y,
//x1 = this.pos.x + x + this.size.width - pW - 25.4/96, y1 = this.pos.y + y,
x2 = x1 + pW, y2 = y1,
x3 = x2, y3 = y2 + pW,
x4 = this.pos.x + x + pW, y4 = this.pos.y + y + this.size.height - penW,
//x4 = this.pos.x + x + pW, y4 = this.pos.y + y + this.size.height - 25.4/96,
x5 = x4 - pW, y5 = y4,
x6 = x5, y6 = y5 - pW,
x7 = x1, y7 = y1;
pGraphics.p_width(1000);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics._l(x3, y3);
pGraphics._l(x4, y4);
pGraphics._l(x5, y5);
pGraphics._l(x6, y6);
pGraphics._l(x7, y7);
pGraphics.df();
}
if(this.Pr.strikeH)
{
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW,
//x2 = this.pos.x + x + this.size.width - 25.4/96,
y1 = this.pos.y + y + this.size.height/2 - penW/2;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
}
if(this.Pr.strikeV)
{
var x1 = this.pos.x + x + this.size.width/2 - penW/2,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - penW;
//y2 = this.pos.y + y + this.size.height - 25.4/96;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
}
}
CBorderBox.prototype.setPosition = function(pos)
{
......@@ -594,6 +724,20 @@ CBar.prototype.init = function(props)
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);
}
......@@ -602,14 +746,8 @@ CBar.prototype.setLocation = function(pos)
this.Pr.pos = pos;
this.RecalcInfo.bProps = true;
}
CBar.prototype.Resize = function()
CBar.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
if(this.RecalcInfo.bCtrPrp == true)
{
this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false;
}
if(this.RecalcInfo.bProps == true)
{
var prp =
......@@ -624,9 +762,10 @@ CBar.prototype.Resize = function()
};
this.setCharacter(prp, defaultProps);
this.RecalcInfo.bProps = false;
}
CBar.superclass.Resize.call(this);
CBar.superclass.Resize.call(this, Parent, ParaMath, oMeasure);
}
CBar.prototype.getAscent = function()
{
......
......@@ -3,7 +3,12 @@ function CFraction(props)
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_FRACTION;
this.type = BAR_FRACTION;
this.Pr =
{
type: BAR_FRACTION
};
//this.type = BAR_FRACTION;
this.bHideBar = false;
CMathBase.call(this);
......@@ -31,10 +36,10 @@ CFraction.prototype.setType = function(type)
bLin = type === LINEAR_FRACTION;
if(bBar || bSkew || bLin) // на всякий случай
this.type = props.type;
this.Pr.type = type;
}
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{
var num = new CNumerator();
......@@ -42,17 +47,17 @@ CFraction.prototype.setType = function(type)
this.setDimension(2, 1);
if(this.type == NO_BAR_FRACTION)
if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true;
this.addMCToContent(num, den);
}
else if(this.type == SKEWED_FRACTION)
else if(this.Pr.type == SKEWED_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
}
else if(this.type == LINEAR_FRACTION)
else if(this.Pr.type == LINEAR_FRACTION)
{
this.setDimension(1, 2);
this.setContent();
......@@ -60,15 +65,15 @@ CFraction.prototype.setType = function(type)
}
CFraction.prototype.getType = function()
{
return this.type;
return this.Pr.type;
}
CFraction.prototype.draw = function(x, y, pGraphics)
{
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
this.drawBarFraction(x, y, pGraphics);
else if(this.type == SKEWED_FRACTION)
else if(this.Pr.type == SKEWED_FRACTION)
this.drawSkewedFraction(x, y, pGraphics);
else if(this.type == LINEAR_FRACTION)
else if(this.Pr.type == LINEAR_FRACTION)
this.drawLinearFraction(x, y, pGraphics);
}
CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
......@@ -234,7 +239,7 @@ CFraction.prototype.getNumerator = function()
{
var numerator;
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
numerator = this.elements[0][0].getElement();
else
numerator = this.elements[0][0];
......@@ -245,7 +250,7 @@ CFraction.prototype.getDenominator = function()
{
var denominator;
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
denominator = this.elements[1][0].getElement();
else
denominator = this.elements[0][1];
......@@ -254,11 +259,11 @@ CFraction.prototype.getDenominator = function()
}
CFraction.prototype.recalculateSize = function(oMeasure)
{
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
this.recalculateBarFraction(oMeasure);
else if(this.type == SKEWED_FRACTION)
else if(this.Pr.type == SKEWED_FRACTION)
this.recalculateSkewed(oMeasure);
else if(this.type == LINEAR_FRACTION)
else if(this.Pr.type == LINEAR_FRACTION)
this.recalculateLinear(oMeasure);
}
CFraction.prototype.recalculateBarFraction = function(oMeasure)
......@@ -330,7 +335,7 @@ CFraction.prototype.recalculateLinear = function()
}
CFraction.prototype.setPosition = function(pos)
{
if(this.type == SKEWED_FRACTION)
if(this.Pr.type == SKEWED_FRACTION)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
......@@ -351,7 +356,7 @@ CFraction.prototype.findDisposition = function( mCoord )
{
var disposition;
if(this.type == SKEWED_FRACTION)
if(this.Pr.type == SKEWED_FRACTION)
{
var mouseCoord = {x: mCoord.x, y: mCoord.y},
posCurs = {x: null, y: null},
......@@ -416,11 +421,7 @@ CFraction.prototype.findDisposition = function( mCoord )
}
CFraction.prototype.getPropsForWrite = function()
{
var props = {
type: this.type
};
return props;
return this.Pr;
}
CFraction.prototype.Save_Changes = function(Data, Writer)
......
function CLimit(props)
{
this.Id = g_oIdCounter.Get_NewId(); this.kind = MATH_LIMIT;
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_LIMIT;
this.Pr =
{
type: LIMIT_LOW
};
this.type = LIMIT_LOW;
CMathBase.call(this);
if(props.type === LIMIT_UP || props.type === LIMIT_LOW)
this.type = props.type;
this.Pr.type = props.type;
this.setDimension(2, 1);
......@@ -15,24 +21,22 @@ function CLimit(props)
var oIter = new CMathContent();
oIter.decreaseArgSize();
if(this.type == LIMIT_LOW)
if(this.Pr.type == LIMIT_LOW)
this.addMCToContent(oBase, oIter);
else if(this.type == LIMIT_UP)
else if(this.Pr.type == LIMIT_UP)
this.addMCToContent(oIter, oBase);
this.setCtrPrp(props.ctrPrp);
/// вызов этой функции обязательно в конце
//this.WriteContentsToHistory();
g_oTableId.Add( this, this.Id );
}
extend(CLimit, CMathBase);
CLimit.prototype.getAscent = function()
{
var ascent;
if(this.type == LIMIT_LOW)
if(this.Pr.type == LIMIT_LOW)
ascent = this.elements[0][0].size.ascent;
else if(this.type == LIMIT_UP)
else if(this.Pr.type == LIMIT_UP)
ascent = this.elements[0][0].size.height + this.dH + this.elements[1][0].size.ascent;
return ascent;
......@@ -40,9 +44,9 @@ CLimit.prototype.getAscent = function()
CLimit.prototype.getFName = function()
{
var fName;
if(this.type == LIMIT_LOW)
if(this.Pr.type == LIMIT_LOW)
fName = this.elements[0][0];
else if(this.type == LIMIT_UP)
else if(this.Pr.type == LIMIT_UP)
fName = this.elements[1][0];
return fName;
......@@ -50,9 +54,9 @@ CLimit.prototype.getFName = function()
CLimit.prototype.getIterator = function()
{
var iterator;
if(this.type == LIMIT_LOW)
if(this.Pr.type == LIMIT_LOW)
iterator = this.elements[1][0];
else if(this.type == LIMIT_UP)
else if(this.Pr.type == LIMIT_UP)
iterator = this.elements[0][0];
return iterator;
......@@ -63,12 +67,7 @@ CLimit.prototype.setDistance = function()
}
CLimit.prototype.getPropsForWrite = function()
{
var props =
{
type: this.type
};
return props;
return this.Pr;
}
CLimit.prototype.Save_Changes = function(Data, Writer)
{
......@@ -106,10 +105,14 @@ CLimit.prototype.Get_Id = function()
{
return this.Id;
}
function CMathFunc(props)
{
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_FUNCTION;
this.Pr = {};
CMathBase.call(this);
this.setDimension(1, 2);
......@@ -117,8 +120,6 @@ function CMathFunc(props)
this.setCtrPrp(props.ctrPrp);
/// вызов этой функции обязательно в конце
//this.WriteContentsToHistory();
g_oTableId.Add( this, this.Id );
}
extend(CMathFunc, CMathBase);
......
......@@ -5103,7 +5103,8 @@ CMathContent.prototype =
{
if(!this.bRoot)
{
var oWPrp = this.Parent.Get_CtrPrp();
//var oWPrp = this.Parent.Get_CtrPrp();
var oWPrp = this.Parent.Get_CompiledCtrPrp();
//this.applyArgSize(oWPrp);
this.ParaMath.ApplyArgSize(oWPrp, this.argSize);
......@@ -5242,7 +5243,8 @@ CMathContent.prototype =
{
pGraphics.b_color1(0,0,0,255);
var oWPrp = this.Parent.Get_CtrPrp();
//var oWPrp = this.Parent.Get_CtrPrp();
var oWPrp = this.Parent.Get_CompiledCtrPrp();
//this.applyArgSize(oWPrp);
this.ParaMath.ApplyArgSize(oWPrp, this.argSize);
......@@ -6289,7 +6291,7 @@ CMathContent.prototype =
var TextPr;
if(this.IsPlaceholder())
TextPr = this.Parent.getCtrPrp();
TextPr = this.Parent.Get_CtrPrp();
else
TextPr = this.content[pos].Get_TextPr(ContentPos, Depth + 1);
......@@ -6301,7 +6303,7 @@ CMathContent.prototype =
if(this.IsPlaceholder())
{
TextPr = this.Parent.getCtrPrp();
TextPr = this.Parent.Get_CompiledCtrPrp();
}
else if ( true === this.bSelectionUse || bAll == true)
{
......
......@@ -11,6 +11,8 @@
var DIV_CENT = 0.1386;
var StartTextElement = 0x2B1A; // Cambria Math
// TODO
......@@ -279,6 +281,8 @@ CMathText.prototype =
var X = this.pos.x + x,
Y = this.pos.y + y;
//console.log(String.fromCharCode(this.getCode()) + ": X " + X);
/*var tx = 0;
var ty = 0;
......
......@@ -202,6 +202,3 @@ var extend = function(Child, Parent)
Child.superclass = Parent.prototype;
}
// default Txt Prp
// argSize
This diff is collapsed.
This diff is collapsed.
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