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

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48771 954022d7-b5bf-4e40-9824-e11837661b57
parent 863a473c
...@@ -56,7 +56,8 @@ CMathBase.prototype = ...@@ -56,7 +56,8 @@ CMathBase.prototype =
{ {
this.elements[i][j] = new CMathContent(); this.elements[i][j] = new CMathContent();
this.elements[i][j].relate(this); this.elements[i][j].relate(this);
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].setReduct(this.reduct); //this.elements[i][j].setReduct(this.reduct);
//this.elements[i][j].setRunPrp(this.RunPrp); //this.elements[i][j].setRunPrp(this.RunPrp);
...@@ -89,15 +90,25 @@ CMathBase.prototype = ...@@ -89,15 +90,25 @@ CMathBase.prototype =
return txtPrp; return txtPrp;
}, },
setTxtPrp: function() getTxtPrp: function()
{
var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp);
txtPrp.Merge(this.OwnTPrp);
txtPrp.FontSize *= this.reduct;
return txtPrp ;
},
setTxtPrp: function(txtPrp)
{ {
this.TxtPrp = new CMathTextPrp(); this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp); this.TxtPrp.Merge(txtPrp);
this.TxtPrp.Merge(this.OwnTPrp); //this.TxtPrp.Merge(this.OwnTPrp);
for(var i=0; i < this.nRow; i++) for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
this.elements[i][j].setTxtPrp(TxtPrp); this.elements[i][j].setTxtPrp(this.getTxtPrp());
}, },
getOwnTPrp: function() getOwnTPrp: function()
{ {
...@@ -160,12 +171,7 @@ CMathBase.prototype = ...@@ -160,12 +171,7 @@ 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);
if(! this.elements[i][j].IsJustDraw() ) this.elements[i][j].setTxtPrp(this.getTxtPrp());
{
this.elements[i][j].setComposition(this.Composition);
//this.elements[i][j].setReduct(this.reduct);
//this.elements[i][j].setRunPrp(this.RunPrp);
}
this.elements[i][j].bMObjs = true; this.elements[i][j].bMObjs = true;
} }
} }
......
...@@ -53,6 +53,11 @@ CBarFraction.prototype.hideBar = function(flag) ...@@ -53,6 +53,11 @@ CBarFraction.prototype.hideBar = function(flag)
CBarFraction.prototype.setSimple = function(flag) CBarFraction.prototype.setSimple = function(flag)
{ {
this.bSimple = flag; this.bSimple = flag;
if(flag)
this.setReduct(DEGR_REDUCT);
else
this.setReduct(1);
} }
CBarFraction.prototype.getTxtPrp = function() CBarFraction.prototype.getTxtPrp = function()
{ {
......
...@@ -136,14 +136,7 @@ CMathContent.prototype = ...@@ -136,14 +136,7 @@ CMathContent.prototype =
for(var i = start; i < end; i++) for(var i = start; i < end; i++)
this.content[i].value.setTxtPrp(txtPrp); this.content[i].value.setTxtPrp(txtPrp);
}, },
old_setTxtPrp: function(txtPrp) // для всего контента, в случае, когда селект вышел за пределы контента, когда начинали селект + когда в коннтенте есть мат. элементы old_old_setTxtPrp: function(txtPrp, start, end) //parent properties
{
this.textPrp.Merge(txtPrp);
for(var i = 0; i < this.content.length; i++)
this.content[i].value.setTxtPrp(txtPrp);
},
setTxtPrp: function(txtPrp, start, end) //parent properties
{ {
this.TxtPrp = new CMathTextPrp(); this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp); this.TxtPrp.Merge(txtPrp);
...@@ -152,7 +145,7 @@ CMathContent.prototype = ...@@ -152,7 +145,7 @@ CMathContent.prototype =
for(var i = start; i < end; i++) for(var i = start; i < end; i++)
this.content[i].value.setTxtPrp(this.TxtPrp); this.content[i].value.setTxtPrp(this.TxtPrp);
}, },
changeTxtPrp: function(txtPrp, bAll) old_changeTxtPrp: function(txtPrp, bAll)
{ {
var start, end; var start, end;
if( this.selection.startPos != this.selection.endPos ) if( this.selection.startPos != this.selection.endPos )
...@@ -172,6 +165,62 @@ CMathContent.prototype = ...@@ -172,6 +165,62 @@ CMathContent.prototype =
else else
this.setTxtPrp(txtPrp, start, end); this.setTxtPrp(txtPrp, start, end);
}, },
old_setTxtPrp: function(txtPrp, bAll)
{
var start, end;
if( this.selection.startPos != this.selection.endPos )
{
start = this.selection.startPos;
end = this.selection.endPos;
if(start > end)
{
tmp = start;
start = end;
end = tmp;
}
}
if(bAll)
{
this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
//this.TxtPrp.Merge(this.OwnTPrp);
start = 0;
end = this.content.length;
}
for(var i = start; i < end; i++)
this.content[i].value.setTxtPrp(txtPrp);
},
setTxtPrp: function(txtPrp)
{
this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
this.changeTxtPrp(txtPrp, 0, this.content.length);
},
setTxtPrp_2: function(txtPrp)
{
var start, end;
if( this.selection.startPos != this.selection.endPos )
{
start = this.selection.startPos;
end = this.selection.endPos;
if(start > end)
{
tmp = start;
start = end;
end = tmp;
}
}
this.changeTxtPrp(txtPrp, start, end);
},
changeTxtPrp: function(txtPrp, start, end)
{
for(var i = start; i < end; i++)
this.content[i].value.setTxtPrp(txtPrp);
},
setOwnTPrp: function(txtPrp) setOwnTPrp: function(txtPrp)
{ {
this.OwnTPrp.Merge(txtPrp); this.OwnTPrp.Merge(txtPrp);
...@@ -203,7 +252,7 @@ CMathContent.prototype = ...@@ -203,7 +252,7 @@ CMathContent.prototype =
} }
else else
{ {
runPrp.Merge(this.TxtPrp); runPrp.Merge(this.getTxtPrp());
} }
return runPrp; return runPrp;
...@@ -293,7 +342,7 @@ CMathContent.prototype = ...@@ -293,7 +342,7 @@ CMathContent.prototype =
return TComp; return TComp;
}, },
setComposition: function(Compos) old_setComposition: function(Compos)
{ {
this.Composition = Compos; this.Composition = Compos;
}, },
...@@ -433,7 +482,7 @@ CMathContent.prototype = ...@@ -433,7 +482,7 @@ CMathContent.prototype =
if( mathElem !== null ) if( mathElem !== null )
{ {
mathElem.relate(this); mathElem.relate(this);
mathElem.setComposition(this.Composition); //mathElem.setComposition(this.Composition);
mathElem.setReduct(this.reduct); mathElem.setReduct(this.reduct);
var runPrp = this.getRunPrp(this.CurPos); var runPrp = this.getRunPrp(this.CurPos);
mathElem.setTxtPrp( runPrp ); mathElem.setTxtPrp( runPrp );
...@@ -479,8 +528,8 @@ CMathContent.prototype = ...@@ -479,8 +528,8 @@ CMathContent.prototype =
case 3: case 3:
var fract = this.addMComponent(0); var fract = this.addMComponent(0);
fract.init(); fract.init();
fract.fillPlaceholders();
fract.setSimple(true); fract.setSimple(true);
fract.fillPlaceholders();
break; break;
case 4: case 4:
var fract = this.addMComponent(0); var fract = this.addMComponent(0);
...@@ -2231,6 +2280,16 @@ CMathContent.prototype = ...@@ -2231,6 +2280,16 @@ CMathContent.prototype =
{ {
this.reduct = this.reduct*coeff; this.reduct = this.reduct*coeff;
}, },
getTxtPrp: function()
{
var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp);
txtPrp.Merge(this.OwnTPrp);
txtPrp.FontSize *= this.getReduct();
return txtPrp;
},
old_getTxtPrp: function() old_getTxtPrp: function()
{ {
var txtPrp; var txtPrp;
...@@ -2279,6 +2338,8 @@ CMathContent.prototype = ...@@ -2279,6 +2338,8 @@ CMathContent.prototype =
placeholder.relate(this); placeholder.relate(this);
//placeholder.addCode(StartTextElement); //placeholder.addCode(StartTextElement);
placeholder.fillPlaceholders(); placeholder.fillPlaceholders();
placeholder.setTxtPrp(this.getTxtPrp());
this.content.push( new mathElem( placeholder ) ); this.content.push( new mathElem( placeholder ) );
}, },
...@@ -2821,7 +2882,7 @@ CMathContent.prototype = ...@@ -2821,7 +2882,7 @@ CMathContent.prototype =
}, },
update_Cursor: function() update_Cursor: function()
{ {
var sizeCursor = this.TxtPrp.FontSize *g_dKoef_pt_to_mm; var sizeCursor = this.getTxtPrp().FontSize*g_dKoef_pt_to_mm;
var position = {x: this.pos.x + this.content[this.CurPos].widthToEl, y: this.pos.y + this.size.center - sizeCursor/2 }; var position = {x: this.pos.x + this.content[this.CurPos].widthToEl, y: this.pos.y + this.size.center - sizeCursor/2 };
editor.WordControl.m_oLogicDocument.DrawingDocument.SetTargetSize( sizeCursor ); editor.WordControl.m_oLogicDocument.DrawingDocument.SetTargetSize( sizeCursor );
...@@ -3258,7 +3319,7 @@ CMathContent.prototype = ...@@ -3258,7 +3319,7 @@ CMathContent.prototype =
this.content[i].value.setPosition(t); this.content[i].value.setPosition(t);
} }
}, },
old_setPosition: function( _pos ) setPosition: function( _pos )
{ {
this.pos = { x: _pos.x + this.g_mContext.left, y: _pos.y}; this.pos = { x: _pos.x + this.g_mContext.left, y: _pos.y};
var max_cent = this.size.center; var max_cent = this.size.center;
...@@ -3278,7 +3339,7 @@ CMathContent.prototype = ...@@ -3278,7 +3339,7 @@ CMathContent.prototype =
this.content[i].value.setPosition(t); this.content[i].value.setPosition(t);
} }
}, },
setPosition: function( _pos ) new_setPosition: function( _pos )
{ {
this.pos = { x: _pos.x + this.g_mContext.left, y: _pos.y}; this.pos = { x: _pos.x + this.g_mContext.left, y: _pos.y};
...@@ -3668,11 +3729,6 @@ CMathContent.prototype = ...@@ -3668,11 +3729,6 @@ CMathContent.prototype =
return result; return result;
}, },
fillPlaceholder: function()
{
this.fillMComponent(0);
this.add(StartTextElement);
},
fillText: function(txt) fillText: function(txt)
{ {
for(var i = 0; i < txt.length; i++) for(var i = 0; i < txt.length; i++)
...@@ -3939,9 +3995,9 @@ CMathComposition.prototype = ...@@ -3939,9 +3995,9 @@ CMathComposition.prototype =
this.Root = new CMathContent(); this.Root = new CMathContent();
this.Root.g_mContext = gps; this.Root.g_mContext = gps;
this.Root.setComposition(this); //this.Root.setComposition(this);
this.setDefaultPrp(); this.setDefaultPrp();
this.Root.changeTxtPrp(this.TxtPrp, false); this.Root.setTxtPrp(this.TxtPrp, true);
this.CurrentContent = this.Root; this.CurrentContent = this.Root;
this.SelectContent = this.Root; this.SelectContent = this.Root;
...@@ -4193,7 +4249,8 @@ CMathComposition.prototype = ...@@ -4193,7 +4249,8 @@ CMathComposition.prototype =
}, },
SetTxtPrp: function(txtPrp) SetTxtPrp: function(txtPrp)
{ {
this.SelectContent.changeTxtPrp(txtPrp, false); //this.SelectContent.changeTxtPrp(txtPrp, false);
this.SelectContent.setTxtPrp(txtPrp, false);
this.Resize(); this.Resize();
this.UpdatePosition(); this.UpdatePosition();
this.UpdateCursor(); this.UpdateCursor();
...@@ -4261,7 +4318,7 @@ CMathComposition.prototype = ...@@ -4261,7 +4318,7 @@ CMathComposition.prototype =
//// finished equation //// //// finished equation ////
AddMathEquation: function (ind) old_AddMathEquation: function (ind)
{ {
this.ClearSelect(); this.ClearSelect();
......
...@@ -78,7 +78,7 @@ CMathText.prototype = ...@@ -78,7 +78,7 @@ CMathText.prototype =
{ {
var code = this.value; var code = this.value;
if( this.TxtPrp.Italic ) if( this.getTxtPrp().Italic )
{ {
if(code == 0x0068) // h if(code == 0x0068) // h
code = 0x210E; code = 0x210E;
...@@ -149,7 +149,6 @@ CMathText.prototype = ...@@ -149,7 +149,6 @@ CMathText.prototype =
{ {
this.TxtPrp = new CMathTextPrp(); this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp); this.TxtPrp.Merge(txtPrp);
this.TxtPrp.Merge(this.OwnTPrp);
}, },
setLIterator: function(bIterator) setLIterator: function(bIterator)
...@@ -160,6 +159,14 @@ CMathText.prototype = ...@@ -160,6 +159,14 @@ CMathText.prototype =
{ {
return this.TxtPrp; return this.TxtPrp;
}, },
getTxtPrp: function()
{
var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp);
txtPrp.Merge(this.OwnTPrp);
return txtPrp ;
},
getOwnTPrp: function() getOwnTPrp: function()
{ {
return this.textPrp; return this.textPrp;
...@@ -174,7 +181,7 @@ CMathText.prototype = ...@@ -174,7 +181,7 @@ CMathText.prototype =
recalculateSize: function() recalculateSize: function()
{ {
var txtPrp = new CMathTextPrp(); var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp); txtPrp.Merge(this.getTxtPrp());
txtPrp.Italic = false; txtPrp.Italic = false;
g_oTextMeasurer.SetFont( txtPrp ); g_oTextMeasurer.SetFont( txtPrp );
...@@ -252,7 +259,7 @@ CMathText.prototype = ...@@ -252,7 +259,7 @@ CMathText.prototype =
draw: function() draw: function()
{ {
var txtPrp = new CMathTextPrp(); var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp); txtPrp.Merge(this.getTxtPrp());
txtPrp.Italic = false; txtPrp.Italic = false;
MathControl.pGraph.b_color1(0,0,0,255); MathControl.pGraph.b_color1(0,0,0,255);
......
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