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

ctrPrp и runPrp (промежуточная версия)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50740 954022d7-b5bf-4e40-9824-e11837661b57
parent 96cf2ebf
...@@ -24,7 +24,7 @@ function CMathBase() ...@@ -24,7 +24,7 @@ function CMathBase()
this.CtrPrp = this.CtrPrp =
{ {
RunPrp: null RunPrp: new CTextPr()
}; };
//this.textPrp = new CMathTextPrp(); // для рассчета размера расстояний //this.textPrp = new CMathTextPrp(); // для рассчета размера расстояний
...@@ -59,8 +59,8 @@ CMathBase.prototype = ...@@ -59,8 +59,8 @@ CMathBase.prototype =
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
{ {
this.elements[i][j] = new CMathContent(); this.elements[i][j] = new CMathContent();
this.elements[i][j].setComposition(this.Composition);
this.elements[i][j].relate(this); this.elements[i][j].relate(this);
this.elements[i][j].setComposition(this.Composition);
/*if( !this.elements[i][j].IsJustDraw()) /*if( !this.elements[i][j].IsJustDraw())
this.elements[i][j].setComposition(this.Composition);*/ this.elements[i][j].setComposition(this.Composition);*/
//this.elements[i][j].setTxtPrp(this.TxtPrp); //this.elements[i][j].setTxtPrp(this.TxtPrp);
...@@ -84,29 +84,38 @@ CMathBase.prototype = ...@@ -84,29 +84,38 @@ CMathBase.prototype =
this.alignment.wdt[u] = CENTER; this.alignment.wdt[u] = CENTER;
}, },
setCtrPrp: function(props) setCtrPrp: function(runPrp)
{ {
this.CtrPrp.RunPrp = props.RunPrp; // only runPrp for paragraph this.CtrPrp.RunPrp = runPrp; // only runPrp for paragraph
}, },
getCtrPrp: function() getCtrPrp: function()
{ {
var ctrPrp = new CTextPr(); var ctrPrp = new CTextPr();
ctrPrp.Merge(DEFAULT_RUN_PRP);
ctrPrp.Merge(this.CtrPrp.RunPrp); ctrPrp.Merge(this.CtrPrp.RunPrp);
return ctrPrp; return ctrPrp;
}, },
getPrpToControlLetter: function() getPrpToControlLetter: function()
{ {
var rPrp = new CTextPr(); var rPrp = new CTextPr();
rPrp.Merge(DEFAULT_RUN_PRP); //rPrp.Merge(DEFAULT_RUN_PRP);
this.getCtrPrp(); rPrp.Merge( this.getCtrPrp() );
ctrPrp.Merge( this.Composition.GetFirstPrp() ); rPrp.Merge( this.Composition.GetFirstPrp() );
return ctrPrp; return rPrp;
}, },
setComposition: function(composition) setComposition: function(composition)
{ {
this.Composition = composition; this.Composition = composition;
}, },
setReferenceComp: function(Comp)
{
this.Composition = Comp;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].setReferenceComp(Comp);
},
/*old_getTxtPrp: function() /*old_getTxtPrp: function()
{ {
var txtPrp = new CMathTextPrp(); var txtPrp = new CMathTextPrp();
...@@ -211,6 +220,7 @@ CMathBase.prototype = ...@@ -211,6 +220,7 @@ CMathBase.prototype =
this.setContent(); this.setContent();
} }
}, },
relate: function(parent) relate: function(parent)
{ {
this.Parent = parent; this.Parent = parent;
......
...@@ -48,7 +48,8 @@ CFraction.prototype.getCenter = function() ...@@ -48,7 +48,8 @@ CFraction.prototype.getCenter = function()
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION) if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
{ {
var penW = this.getTxtPrp().FontSize* 25.4/96 * 0.08 /2; //var penW = this.getTxtPrp().FontSize* 25.4/96 * 0.08 /2;
var penW = this.getPrpToControlLetter().FontSize* 25.4/96 * 0.08 /2;
center = this.elements[0][0].size.height + penW; center = this.elements[0][0].size.height + penW;
} }
else if(this.type == SKEWED_FRACTION) else if(this.type == SKEWED_FRACTION)
...@@ -73,7 +74,8 @@ CFraction.prototype.draw = function(pGraphics) ...@@ -73,7 +74,8 @@ CFraction.prototype.draw = function(pGraphics)
} }
CFraction.prototype.drawBarFraction = function(pGraphics) CFraction.prototype.drawBarFraction = function(pGraphics)
{ {
var penW = this.getTxtPrp().FontSize* this.reduct* 25.4/96 * 0.08; var ctrPrp = this.getPrpToControlLetter();
var penW = ctrPrp.FontSize* this.reduct* 25.4/96 * 0.08;
var x1 = this.pos.x, var x1 = this.pos.x,
x2 = this.pos.x + this.size.width, x2 = this.pos.x + this.size.width,
...@@ -81,6 +83,8 @@ CFraction.prototype.drawBarFraction = function(pGraphics) ...@@ -81,6 +83,8 @@ CFraction.prototype.drawBarFraction = function(pGraphics)
if( !this.bHideBar ) if( !this.bHideBar )
{ {
pGraphics.SetFont(ctrPrp);
pGraphics.p_color(0,0,0, 255); pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255); pGraphics.b_color1(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW); pGraphics.drawHorLine(0, y1, x1, x2, penW);
...@@ -90,11 +94,12 @@ CFraction.prototype.drawBarFraction = function(pGraphics) ...@@ -90,11 +94,12 @@ CFraction.prototype.drawBarFraction = function(pGraphics)
} }
CFraction.prototype.drawSkewedFraction = function(pGraphics) CFraction.prototype.drawSkewedFraction = function(pGraphics)
{ {
var fontSize = this.getTxtPrp().FontSize; var ctrPrp = this.getPrpToControlLetter();
var penW = fontSize/12.5*g_dKoef_pix_to_mm; //var fontSize = this.getTxtPrp().FontSize;
var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
var gap = this.gapSlash/2 - penW/7.5; var gap = this.gapSlash/2 - penW/7.5;
var plh = 9.877777777777776 * fontSize / 36; var plh = 9.877777777777776 * ctrPrp.FontSize / 36;
var minHeight = 2*this.gapSlash, var minHeight = 2*this.gapSlash,
middleHeight = plh*4/3, middleHeight = plh*4/3,
...@@ -165,6 +170,8 @@ CFraction.prototype.drawSkewedFraction = function(pGraphics) ...@@ -165,6 +170,8 @@ CFraction.prototype.drawSkewedFraction = function(pGraphics)
} }
pGraphics.SetFont(ctrPrp);
pGraphics.p_width(penW*1000); pGraphics.p_width(penW*1000);
pGraphics.p_color(0,0,0, 255); pGraphics.p_color(0,0,0, 255);
...@@ -192,8 +199,10 @@ CFraction.prototype.drawLinearFraction = function(pGraphics) ...@@ -192,8 +199,10 @@ CFraction.prototype.drawLinearFraction = function(pGraphics)
x2 = this.pos.x + this.elements[0][0].size.width + shift, x2 = this.pos.x + this.elements[0][0].size.width + shift,
y2 = this.pos.y + this.size.center + desc; y2 = this.pos.y + this.size.center + desc;
var penW = this.getTxtPrp().FontSize/12.5*g_dKoef_pix_to_mm; var ctrPrp = this.getPrpToControlLetter();
var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
pGraphics.SetFont(ctrPrp);
pGraphics.p_width(penW*1000); pGraphics.p_width(penW*1000);
pGraphics.p_color(0,0,0, 255); pGraphics.p_color(0,0,0, 255);
...@@ -239,7 +248,8 @@ CFraction.prototype.recalculateSize = function() ...@@ -239,7 +248,8 @@ CFraction.prototype.recalculateSize = function()
} }
CFraction.prototype.recalculateSkewed = function() CFraction.prototype.recalculateSkewed = function()
{ {
this.gapSlash = 5.011235894097222 * this.getTxtPrp().FontSize/36; var ctrPrp = this.getPrpToControlLetter();
this.gapSlash = 5.011235894097222 * ctrPrp.FontSize/36;
var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width; var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width;
var _height = this.elements[0][0].size.height + this.elements[0][1].size.height; var _height = this.elements[0][0].size.height + this.elements[0][1].size.height;
var _center = this.getCenter(); var _center = this.getCenter();
...@@ -249,9 +259,10 @@ CFraction.prototype.recalculateSkewed = function() ...@@ -249,9 +259,10 @@ CFraction.prototype.recalculateSkewed = function()
CFraction.prototype.recalculateLinear = function() CFraction.prototype.recalculateLinear = function()
{ {
var H = this.elements[0][0].size.center + this.elements[0][1].size.height - this.elements[0][1].size.center; var H = this.elements[0][0].size.center + this.elements[0][1].size.height - this.elements[0][1].size.center;
var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
var ctrPrp = this.getPrpToControlLetter();
var gap = 5.011235894097222*txtPrp.FontSize/36; var gap = 5.011235894097222*ctrPrp.FontSize/36;
var H3 = gap*4.942252165543792, var H3 = gap*4.942252165543792,
H4 = gap*7.913378248315688, H4 = gap*7.913378248315688,
...@@ -380,12 +391,13 @@ CNumerator.prototype.init = function() ...@@ -380,12 +391,13 @@ CNumerator.prototype.init = function()
CNumerator.prototype.recalculateSize = function() CNumerator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
txtPrp.FontSize *= this.Parent.reduct; //txtPrp.FontSize *= this.Parent.reduct;
var ctrPrp = this.getCtrPrp();
var Descent = arg.height - arg.ascent; // baseLine var Descent = arg.height - arg.ascent; // baseLine
var gap = 7.832769097222222 * txtPrp.FontSize/36, var gap = 7.832769097222222 * ctrPrp.FontSize/36,
minGap = txtPrp.FontSize* 25.4/96 * 0.16; minGap = ctrPrp.FontSize* 25.4/96 * 0.16;
// var delta = 0.65*gap - Descent; // var delta = 0.65*gap - Descent;
var delta = 0.8076354679802956*gap - Descent; var delta = 0.8076354679802956*gap - Descent;
...@@ -418,14 +430,14 @@ CNumerator.prototype.getElement = function() ...@@ -418,14 +430,14 @@ CNumerator.prototype.getElement = function()
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
CNumerator.prototype.getTxtPrp = function()
{
return this.Parent.getTxtPrp();
}
CNumerator.prototype.getReduct = function() CNumerator.prototype.getReduct = function()
{ {
return this.Parent.getReduct(); return this.Parent.getReduct();
} }
CNumerator.prototype.getCtrPrp = function()
{
return this.Parent.getCtrPrp();
}
function CDenominator() function CDenominator()
{ {
...@@ -440,12 +452,13 @@ CDenominator.prototype.init = function() ...@@ -440,12 +452,13 @@ CDenominator.prototype.init = function()
CDenominator.prototype.recalculateSize = function() CDenominator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
var txtPrp = this.getTxtPrp(); /*var txtPrp = this.getTxtPrp();
txtPrp.FontSize *= this.Parent.reduct; txtPrp.FontSize *= this.Parent.reduct;*/
var ctrPrp = this.getCtrPrp();
var gap = 7.832769097222222 * txtPrp.FontSize/36, var gap = 7.832769097222222 * ctrPrp.FontSize/36,
Ascent = arg.center - 4.938888888888888*txtPrp.FontSize/36, Ascent = arg.center - 4.938888888888888*ctrPrp.FontSize/36,
minGap = txtPrp.FontSize* 25.4/96 * 0.24; minGap = ctrPrp.FontSize* 25.4/96 * 0.24;
var delta = 0.47*gap - Ascent; var delta = 0.47*gap - Ascent;
var GapDen = delta > minGap ? delta : minGap; var GapDen = delta > minGap ? delta : minGap;
...@@ -481,14 +494,14 @@ CDenominator.prototype.getElement = function(txt) ...@@ -481,14 +494,14 @@ CDenominator.prototype.getElement = function(txt)
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
CDenominator.prototype.getTxtPrp = function()
{
return this.Parent.getTxtPrp();
}
CDenominator.prototype.getReduct = function() CDenominator.prototype.getReduct = function()
{ {
return this.Parent.getReduct(); return this.Parent.getReduct();
} }
CDenominator.prototype.getCtrPrp = function()
{
return this.Parent.getCtrPrp();
}
////////// //////////
......
This diff is collapsed.
...@@ -16,6 +16,8 @@ function CMathTextPrp() ...@@ -16,6 +16,8 @@ function CMathTextPrp()
this.FontSize = undefined; this.FontSize = undefined;
this.Bold = undefined; this.Bold = undefined;
this.Italic = undefined; this.Italic = undefined;
this.RFonts = {};
this.Lang = {};
} }
CMathTextPrp.prototype = CMathTextPrp.prototype =
{ {
...@@ -321,13 +323,17 @@ CMathText.prototype = ...@@ -321,13 +323,17 @@ CMathText.prototype =
//pGraphics.FillTextCode(xx, yy , this.value); //pGraphics.FillTextCode(xx, yy , this.value);
}, },
setPosition: function(pos) old_setPosition: function(pos)
{ {
if( ! this.bJDraw) // for text if( ! this.bJDraw) // for text
this.pos = {x : pos.x, y: pos.y }; this.pos = {x : pos.x, y: pos.y };
else // for symbol only drawing else // for symbol only drawing
this.pos = {x: pos.x , y: pos.y + this.size.center}; this.pos = {x: pos.x , y: pos.y + this.size.center};
}, },
setPosition: function(pos)
{
this.pos = {x: pos.x , y: pos.y};
},
setCoeffTransform: function(sx, shx, shy, sy) setCoeffTransform: function(sx, shx, shy, sy)
{ {
this.transform = {sx: sx, shx: shx, shy: shy, sy: sy}; this.transform = {sx: sx, shx: shx, shy: shy, sy: sy};
......
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