Commit 81fb1153 authored by Anna.Pavlova's avatar Anna.Pavlova

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

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50703 954022d7-b5bf-4e40-9824-e11837661b57
parent c1a95462
function CMathBase()
{
this.typeObj = MATH_COMP;
// {align: {height: alpha, width: betta}} alpha & betta коэффициенты в интервале от 0 до 1, либо CENTER
CENTER = -1;
......@@ -18,15 +19,19 @@ function CMathBase()
this.Parent = null;
this.Composition = null; // ссылка на общую формулу
/*this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();*/
this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();
this.CtrPrp =
{
RunPrp: null
};
//this.textPrp = new CMathTextPrp(); // для рассчета размера расстояний
//this.RunPrp = new CMathTextPrp(); // запоминаем, если передаются спец. настройки для контента
//todo
//переделать
// todo
// убрать !!!
this.bMObjs = false;
this.elements = null;
......@@ -42,7 +47,6 @@ function CMathBase()
return this;
}
CMathBase.prototype =
{
setContent: function()
......@@ -55,10 +59,11 @@ CMathBase.prototype =
for(var j = 0; j < this.nCol; j++)
{
this.elements[i][j] = new CMathContent();
this.elements[i][j].setComposition(this.Composition);
this.elements[i][j].relate(this);
/*if( !this.elements[i][j].IsJustDraw())
this.elements[i][j].setComposition(this.Composition);*/
this.elements[i][j].setTxtPrp(this.TxtPrp);
//this.elements[i][j].setTxtPrp(this.TxtPrp);
//this.elements[i][j].setReduct(this.reduct);
//this.elements[i][j].setRunPrp(this.RunPrp);
}
......@@ -79,14 +84,36 @@ CMathBase.prototype =
this.alignment.wdt[u] = CENTER;
},
old_getTxtPrp: function()
setCtrPrp: function(props)
{
this.CtrPrp.RunPrp = props.RunPrp; // only runPrp for paragraph
},
getCtrPrp: function()
{
var ctrPrp = new CTextPr();
ctrPrp.Merge(this.CtrPrp.RunPrp);
return ctrPrp;
},
getPrpToControlLetter: function()
{
var rPrp = new CTextPr();
rPrp.Merge(DEFAULT_RUN_PRP);
this.getCtrPrp();
ctrPrp.Merge( this.Composition.GetFirstPrp() );
return ctrPrp;
},
setComposition: function(composition)
{
this.Composition = composition;
},
/*old_getTxtPrp: function()
{
var txtPrp = new CMathTextPrp();
Common_CopyObj2(txtPrp, this.Composition.TxtPrp);
txtPrp.Merge(this.textPrp);
//txtPrp.FontSize *= this.reduct;
return txtPrp;
},
......@@ -96,14 +123,10 @@ CMathBase.prototype =
txtPrp.Merge(this.TxtPrp);
txtPrp.Merge(this.OwnTPrp);
/*if( typeof(txtPrp.FontSize) !== "undefined" )
txtPrp.FontSize *= this.reduct;*/
return txtPrp ;
},
setTxtPrp: function(txtPrp)
{
//this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
var tPrp = this.getTxtPrp();
......@@ -138,6 +161,16 @@ CMathBase.prototype =
this.RunPrp.Merge(txtPrp);
this.setTxtPrp(txtPrp);
},
old_setReduct: function(coeff)
{
this.reduct = this.reduct*coeff;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].setReduct(coeff);
}
},*/
fillPlaceholders: function()
{
for(var i=0; i < this.nRow; i++)
......@@ -145,24 +178,14 @@ CMathBase.prototype =
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].fillPlaceholders();
},
old_setReduct: function(coeff)
{
this.reduct = this.reduct*coeff;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].setReduct(coeff);
}
},
setReduct: function(coeff)
{
this.reduct = this.reduct*coeff;
},
getReduct: function()
/*getReduct: function()
{
return this.reduct;
},
},*/
addMCToContent: function()
{
if(arguments.length == this.nRow*this.nCol)
......@@ -175,17 +198,17 @@ CMathBase.prototype =
{
this.elements[i][j] = arguments[j + i*this.nCol];
this.elements[i][j].relate(this);
this.elements[i][j].setComposition(this.Composition);
/*if( !this.elements[i][j].IsJustDraw())
this.elements[i][j].setComposition(this.Composition);*/
this.elements[i][j].setTxtPrp(this.getTxtPrp());
//this.elements[i][j].setTxtPrp(this.getTxtPrp());
this.elements[i][j].bMObjs = true;
}
}
}
else
{
this.init();
this.fillPlaceholders();
this.setContent();
}
},
relate: function(parent)
......@@ -915,38 +938,5 @@ CMathBase.prototype =
var content = this.elements[pos.X][pos.Y].getContent(stack, bCurrent);
return content;
},
old_setTxtPrp: function(txtPrp)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].setTxtPrp(txtPrp);
},
old_getRealPosition: function(type)
{
var pos = this.elements[this.CurPos_X][this.CurPos_Y].getRealPosition(type);
var align = this.align(this.CurPos_X, this.CurPos_Y);
pos.X += align.x;
pos.Y += align.y;
var WH = this.getWidthsHeights();
for(var j = 0; j < this.CurPos_X; j++)
pos.Y += WH.heights[j];
for(var i = 0; i < this.CurPos_Y; i++)
pos.X += WH.widths[i];
var txtW = this.TxtPrp.FontSize*g_dKoef_pt_to_mm*0.01;
if(this.CurPos_X > 0)
pos.Y += txtW;
if(this.CurPos_Y > 0)
pos.X += txtW;
return pos;
}
}
This diff is collapsed.
......@@ -45,17 +45,21 @@ CMathTextPrp.prototype =
function CMathText()
{
this.typeObj = MATH_TEXT;
this.pos = null;
this.size = null;
this.value = null;
this.bJDraw = false;
this.SUBCONTENT = false;
this.empty = false;
this.Parent = null;
this.bMText = false;
this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();
/*this.SUBCONTENT = false;
this.empty = false;*/
//this.Parent = null;
/*this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();*/
//this.sizeSymbol = null; // размер символа без учета трансформации
......@@ -82,7 +86,7 @@ CMathText.prototype =
{
var code = this.value;
if( this.getTxtPrp().Italic )
if( this.bMText )
{
if(code == 0x0068) // h
code = 0x210E;
......@@ -135,9 +139,10 @@ CMathText.prototype =
},
fillPlaceholders: function()
{
this.typeObj = MATH_PLACEHOLDER;
this.value = StartTextElement;
},
old_getTxtPrp: function()
/*old_getTxtPrp: function()
{
var txtPrp = this.Parent.getTxtPrp();
txtPrp.Merge(this.textPrp);
......@@ -148,8 +153,8 @@ CMathText.prototype =
//txtPrp.Italic = false; // всегда отправляем "false"!!
return txtPrp;
},
setTxtPrp: function(txtPrp)
},*/
/*setTxtPrp: function(txtPrp)
{
this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
......@@ -157,12 +162,13 @@ CMathText.prototype =
setOwnTPrp: function(txtPrp)
{
this.OwnTPrp.Merge(txtPrp);
},
},*/
setLIterator: function(bIterator)
{
this.bIterator = bIterator; // символы другие , чуть толще
},
getRunPrp: function()
/*getRunPrp: function()
{
return this.TxtPrp;
},
......@@ -177,7 +183,8 @@ CMathText.prototype =
getOwnTPrp: function()
{
return this.textPrp;
},
},*/
// ascent = Symbol.Ascent // = Placeholder.Ascent (= Placeholder.Height)
// descent = FontAscent - Placeholder.Height (FontAscent = FontHeight - FontDescent)
......@@ -187,14 +194,14 @@ CMathText.prototype =
// gap = FontHeight - FontDescent - Placeholder.Height + FontDescent
recalculateSize: function()
{
var txtPrp = new CMathTextPrp();
/*var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.getTxtPrp());
txtPrp.Italic = false;
g_oTextMeasurer.SetFont( txtPrp );
g_oTextMeasurer.SetFont( txtPrp );*/
var letter = this.getCode();
//var letter = this.value;
var metricsTxt = g_oTextMeasurer.Measure2Code(letter);
var _width = metricsTxt.Width;
......@@ -266,12 +273,12 @@ CMathText.prototype =
},
draw: function(pGraphics)
{
var txtPrp = new CMathTextPrp();
/*var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.getTxtPrp());
txtPrp.Italic = false;
txtPrp.Italic = false;*/
pGraphics.b_color1(0,0,0,255);
pGraphics.SetFont(txtPrp);
//pGraphics.b_color1(0,0,0,255);
//pGraphics.SetFont(txtPrp);
var X = this.pos.x ,
Y = this.pos.y;
......@@ -314,7 +321,7 @@ CMathText.prototype =
//pGraphics.FillTextCode(xx, yy , this.value);
},
setPosition: function( pos )
setPosition: function(pos)
{
if( ! this.bJDraw) // for text
this.pos = {x : pos.x, y: pos.y };
......@@ -380,6 +387,10 @@ CMathText.prototype =
setJustDraw: function(bJustDraw)
{
this.bJDraw = bJustDraw;
},
setMText: function(flag)
{
this.bMText = flag;
}
/*draw2: function()
......
......@@ -116,7 +116,7 @@ var BASEJC_BOTTOM = 2;
var MATH_TEXT = 0;
var MATH_RUN_PRP = 1;
var MATH_OBJS = 2;
var MATH_COMP = 2;
var MATH_EMPTY = 3;
var MATH_PLACEHOLDER = 4;
......@@ -174,6 +174,7 @@
<!---->
<script type="text/javascript" src = "Math/mathTypes.js"></script>
<script type = "text/javascript" src ="Math/print.js"></script>
<script type="text/javascript" src = "Math/mathText.js"></script>
<script type="text/javascript" src = "Math/mathContent.js"></script>
......@@ -195,7 +196,7 @@
<script type="text/javascript" src = "Math/drawingUnion.js"></script>
<script type="text/javascript" src = "Math/borderBox.js"></script>
<script type="text/javascript" src = "Math/mathTypes.js"></script>
<!--for charts-->
<script type="text/javascript" src="../Excel/graphics/DrawingContextWord.js"></script>
......
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