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

change text properties on select

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48440 954022d7-b5bf-4e40-9824-e11837661b57
parent 3ea8c45d
...@@ -395,6 +395,10 @@ CControlComposition.prototype = ...@@ -395,6 +395,10 @@ CControlComposition.prototype =
Top : Y_Top_Field, Top : Y_Top_Field,
Bottom : Y_Bottom_Field Bottom : Y_Bottom_Field
} } ); } } );
},
GetTxtPrp: function()
{
var txtPrp = this.Content[this.CurPos].GetPrpSelectContent();
} }
} }
var MathControl = new CControlComposition(); var MathControl = new CControlComposition();
......
...@@ -86,6 +86,10 @@ CMathBase.prototype = ...@@ -86,6 +86,10 @@ CMathBase.prototype =
return txtPrp; return txtPrp;
}, },
getOwnTPrp: function()
{
return this.txtPrp();
},
/*getTxtPrp_2: function() /*getTxtPrp_2: function()
{ {
var txtPrp = this.getTxtPrp(); var txtPrp = this.getTxtPrp();
...@@ -111,6 +115,7 @@ CMathBase.prototype = ...@@ -111,6 +115,7 @@ CMathBase.prototype =
setRunPrp: function(txtPrp) setRunPrp: function(txtPrp)
{ {
this.RunPrp.Merge(txtPrp); this.RunPrp.Merge(txtPrp);
this.setTxtPrp(txtPrp);
}, },
fillPlaceholders: function() fillPlaceholders: function()
{ {
...@@ -145,9 +150,9 @@ CMathBase.prototype = ...@@ -145,9 +150,9 @@ CMathBase.prototype =
{ {
this.elements[i][j].setComposition(this.Composition); this.elements[i][j].setComposition(this.Composition);
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].bMObjs = true; this.elements[i][j].bMObjs = true;
this.elements[i][j].setRunPrp(this.RunPrp);
} }
} }
} }
......
...@@ -704,7 +704,10 @@ CAccent.prototype.setPosition = function(pos) ...@@ -704,7 +704,10 @@ CAccent.prototype.setPosition = function(pos)
align2 = (first.widthG - second.width)/2; align2 = (first.widthG - second.width)/2;
} }
var pos1 = {x: this.pos.x + shX + align1, y: this.pos.y}, /* var pos1 = {x: this.pos.x + shX + align1, y: this.pos.y},
pos2 = {x: this.pos.x + align2, y: this.pos.y + first.height + this.dH};*/
var pos1 = {x: this.pos.x + shX + align1, y: this.pos.y + first.ascent - first.center},
pos2 = {x: this.pos.x + align2, y: this.pos.y + first.height + this.dH}; pos2 = {x: this.pos.x + align2, y: this.pos.y + first.height + this.dH};
this.elements[0][0].setPosition(pos1); this.elements[0][0].setPosition(pos1);
......
...@@ -146,9 +146,7 @@ CNumerator.prototype.findDisposition = function(mCoord) ...@@ -146,9 +146,7 @@ CNumerator.prototype.findDisposition = function(mCoord)
if(mCoord.y > arg.height) if(mCoord.y > arg.height)
mCoord.y = arg.height; mCoord.y = arg.height;
var result = CNumerator.superclass.findDisposition.call(this, mCoord); return CNumerator.superclass.findDisposition.call(this, mCoord);
return result;
} }
CNumerator.prototype.setPosition = function(pos) CNumerator.prototype.setPosition = function(pos)
{ {
...@@ -247,12 +245,12 @@ CDenominator.prototype.findDisposition = function(mCoord) ...@@ -247,12 +245,12 @@ CDenominator.prototype.findDisposition = function(mCoord)
if(mCoord.y < gap) if(mCoord.y < gap)
mCoord.y = 0; mCoord.y = 0;
else if (mCoord.y > arg.height + gap)
mCoord.y = arg.height;
else else
mCoord.y -= gap; mCoord.y -= gap;
var result = CNumerator.superclass.findDisposition.call(this, mCoord); return CDenominator.superclass.findDisposition.call(this, mCoord);
return result;
} }
CDenominator.prototype.setPosition = function(pos) CDenominator.prototype.setPosition = function(pos)
{ {
......
...@@ -152,9 +152,9 @@ CMathContent.prototype = ...@@ -152,9 +152,9 @@ CMathContent.prototype =
if(this.content.length > 1) if(this.content.length > 1)
{ {
if(pos == 1) //берем справa if(pos == 0)
{ {
var rPrp = this.content[pos].value.getRunPrp(); var rPrp = this.content[pos+1].value.getRunPrp();
runPrp.Merge(rPrp); runPrp.Merge(rPrp);
} }
else else
...@@ -163,9 +163,86 @@ CMathContent.prototype = ...@@ -163,9 +163,86 @@ CMathContent.prototype =
runPrp.Merge(rPrp); runPrp.Merge(rPrp);
} }
} }
else
{
runPrp.Merge(this.textPrp);
}
return runPrp; return runPrp;
}, },
getSelectTPrp: function()
{
var start, end;
start = this.selection.startPos;
end = this.selection.endPos;
if( this.selection.startPos != this.selection.endPos )
{
if(start > end)
{
tmp = start;
start = end;
end = tmp;
}
}
var TComp;
if(start !== end)
{
var txtPrp = this.content[start].value.getOwnTPrp();
for(var i = start + 1; i < end; i++)
{
txtPrp2 = this.content[i].value.getOwnTPrp();
if(txtPrp.FontSize !== -1)
{
if(txtPrp.FontSize !== txtPrp2.FontSize)
txtPrp.FontSize = -1;
}
if(txtPrp.Bold !== -1)
{
if(txtPrp.Bold !== txtPrp2.Bold)
txtPrp.Bold = -1;
}
if(txtPrp.Italic !== -1)
{
if(txtPrp.Italic !== txtPrp2.Italic)
txtPrp.Italic = -1;
}
if(txtPrp.FontFamily !== -1)
{
if( Common_CmpObj2 (txtPrp.FontFamily, txtPrp2.FontFamily) )
txtPrp.FontFamily = -1;
}
}
TComp = this.getTxtPrp();
TComp.Merge(txtPrp);
if(TComp.FontSize == -1)
TComp.FontSize = undefined;
if(TComp.Bold == -1)
TComp.Bold = undefined;
if(TComp.Italic == -1)
TComp.Italic = undefined;
if(TComp.FontFamily == -1)
TComp.FontFamily = undefined;
}
else
{
TComp = this.getRunPrp(start);
TComp.Merge(this.getTxtPrp());
}
return TComp;
},
setComposition: function(Compos) setComposition: function(Compos)
{ {
this.Composition = Compos; this.Composition = Compos;
...@@ -3914,6 +3991,10 @@ CMathComposition.prototype = ...@@ -3914,6 +3991,10 @@ CMathComposition.prototype =
this.CurrentContent.update_Cursor(); this.CurrentContent.update_Cursor();
this.ShowCursor(); this.ShowCursor();
}, },
GetPrpSelectContent: function()
{
return this.SelectContent.getSelectTPrp();
},
//// test function //// //// test function ////
TestSetPostion: function() TestSetPostion: function()
......
...@@ -153,6 +153,10 @@ CMathText.prototype = ...@@ -153,6 +153,10 @@ CMathText.prototype =
{ {
return this.textPrp; return this.textPrp;
}, },
getOwnTPrp: function()
{
return this.txtPrp();
},
// 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)
......
...@@ -90,7 +90,8 @@ CMathMatrix.prototype.recalculateSize = function() ...@@ -90,7 +90,8 @@ CMathMatrix.prototype.recalculateSize = function()
} }
} }
else /*this.baseJc == 0*/ else /*this.baseJc == 0*/
center = height/2; center = this.getCenter(height);
//center = height/2;
this.size = {width: width, height: height, center: center}; this.size = {width: width, height: height, center: center};
......
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