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