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

Math Run Properties :

1. bold, italic
2. sty: fraktur
3. sty: plain (text)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55608 954022d7-b5bf-4e40-9824-e11837661b57
parent d8888c2a
......@@ -3973,8 +3973,14 @@ ParaRun.prototype =
var oWPrp = this.Parent.Get_Default_TPrp();
TextPr.Merge(oWPrp);
TextPr.Merge( this.Pr ); // Мержим прямые настройки данного рана
this.Parent.applyArgSize(TextPr);
if(!this.MathPrp.nor) // math text, style: plain
{
var MPrp = this.MathPrp.getTxtPrp();
TextPr.Merge(MPrp); // bold, italic
}
this.Parent.applyArgSize(TextPr);
}
else
TextPr.Merge( this.Pr ); // Мержим прямые настройки данного рана
......@@ -6562,10 +6568,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
var X = x;
var Y = y + this.size.ascent;
// var oWPrp = this.Get_CompiledPr(true);
var oWPrp = this.Pr.Copy();
this.Parent.applyArgSize(oWPrp);
var oWPrp = this.Get_CompiledPr(true);
oWPrp.Italic = false;
pGraphics.SetFont(oWPrp);
......@@ -6589,37 +6592,32 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
var width = 0,
ascent = 0, descent = 0;
var oWPrp = this.Get_CompiledPr(true);
oWPrp.Italic = false;
var oWPrp = this.Pr.Copy();
this.Parent.applyArgSize(oWPrp);
oWPrp.Italic = false;
// TODO
// смержить еще с math_Run_Prp
g_oTextMeasurer.SetFont(oWPrp);
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
RecalcInfo.leftRunPrp = RecalcInfo.currRunPrp;
RecalcInfo.Left = RecalcInfo.Current;
RecalcInfo.currRunPrp = oWPrp;
RecalcInfo.Current = this.Content[Pos];
RecalcInfo.setGaps();
RecalcInfo.leftRunPrp = RecalcInfo.currRunPrp;
RecalcInfo.Left = RecalcInfo.Current;
var compiledTPrp = this.Get_CompiledPr(true);
RecalcInfo.currRunPrp = oWPrp;
RecalcInfo.Current = this.Content[Pos];
RecalcInfo.setGaps();
this.Content[Pos].Resize(g_oTextMeasurer);
this.Content[Pos].relate(this);
this.Content[Pos].Resize(g_oTextMeasurer);
var oSize = this.Content[Pos].size;
width += oSize.width;
var oSize = this.Content[Pos].size;
width += oSize.width;
ascent = ascent > oSize.ascent ? ascent : oSize.ascent;
var oDescent = oSize.height - oSize.ascent;
descent = descent < oDescent ? oDescent : descent;
ascent = ascent > oSize.ascent ? ascent : oSize.ascent;
var oDescent = oSize.height - oSize.ascent;
descent = descent < oDescent ? oDescent : descent;
}
this.size = {width: width, height: ascent + descent, ascent: ascent};
......@@ -6693,4 +6691,8 @@ ParaRun.prototype.Math_applyArgSize = function(oWPrp)
ParaRun.prototype.Set_MathPrp = function(props)
{
this.MathPrp.setMathProps(props);
}
ParaRun.prototype.Math_GetTypeText = function()
{
return this.MathPrp.getTypeText();
}
\ No newline at end of file
......@@ -10182,21 +10182,21 @@ function Binary_oMathReader(stream)
if (c_oSer_OMathContentType.MText === type)
{
var text = this.stream.GetString2LE(length);
var str = "";
for (var i = 0; i < text.length; ++i)
{
//управляющие символы
//управляющие символы
if (0x001F < text[i].charCodeAt(0))
{
var oText = new CMathText();
oText.addTxt(text[i]);
oMRun.Content.splice( i, 0, oText );
oMRun.Content.splice( i, 0, oText );
}
/*в будущем переделка под para_space
else if (text[i] == ' ')
oMRun.Content.splice(oMRun.Content.length, 0, new ParaSpace(1));
*/
oMRun.Content.splice(oMRun.Content.length, 0, new ParaSpace(1));
*/
}
oMRun.Set_MathPrp(props);
oParent.addElementToContent(oMRun);
}
......
......@@ -746,7 +746,7 @@ CMPrp.prototype =
this.SetBProp(this.aln, props.aln);
this.SetBProp(this.brk, props.brk);
this.SetBProp(this.lit, props.lit);
//this.SetBProp(this.nor, props.nor);
// если приходит несколько параметров style из xml, то запоминается последний
if(props.sty === "i")
......@@ -783,6 +783,20 @@ CMPrp.prototype =
this.typeText = TXT_NORMAL;
},
getTypeText: function()
{
var type;
if(this.plain && this.typeText == TXT_ROMAN)
type = TXT_NORMAL;
else
type = this.typeText;
if(this.nor)
type = TXT_NORMAL;
return type;
},
getTxtSettings: function()
{
var type = this.typeText;
......@@ -802,8 +816,8 @@ CMPrp.prototype =
{
var textPrp = new CTextPr();
textPrp.italic = this.italic;
textPrp.bold = this.bold;
textPrp.Italic = this.italic;
textPrp.Bold = this.bold;
if(this.typeText == TXT_ROMAN)
textPrp.Italic = false;
......
......@@ -100,16 +100,22 @@ CMathText.prototype =
{
var code = this.value;
if(this.typeObj === MATH_PLACEHOLDER)
return code;
var bCapitale = (code > 0x0040 && code < 0x005B),
bSmall = (code > 0x0060 && code < 0x007b);
if(this.type == TXT_ROMAN )
var Type = this.Parent.Math_GetTypeText();
//var Type = TXT_ROMAN;
if(Type == TXT_ROMAN )
{
var bDigit = (code > 0x002F && code < 0x003A),
bCapGreek = (code > 0x0390 && code < 0x03AA ),
bSmallGreek = (code > 0x03B0 && code < 0x03CA);
if(code == 0x0068) // h
if(code == 0x68) // h
code = 0x210E;
else if(bCapitale)
code = code + 0x1D3F3;
......@@ -125,35 +131,45 @@ CMathText.prototype =
else if(code == 0x237) // "j" without dot
code = 0x1D6A5;
}
else if(this.type == TXT_DOUBLE_STRUCK)
else if(Type == TXT_DOUBLE_STRUCK)
{
if(bCapitale)
code = code + 0x1D4F8;
else if(bSmall)
code = code + 0x1D4F2;
}
else if(this.type == TXT_MONOSPACE)
else if(Type == TXT_MONOSPACE)
{
if(bCapitale)
code = code + 0x1D630;
else if(bSmall)
code = code + 0x1D62A;
}
else if(this.type == TXT_FRAKTUR)
else if(Type == TXT_FRAKTUR)
{
if(bCapitale)
code = code + 0x1D4C4;
if(code == 0x43)
code = 0x212D;
else if(code == 0x48)
code = 0x210C;
else if(code == 0x49)
code = 0x2111;
else if(code == 0x52)
code = 0x211C;
else if(code == 0x5A)
code = 0x2128;
else if(bCapitale)
code = code + 0x1D4C3;
else if(bSmall)
code = code + 0x1D4BE;
code = code + 0x1D4BD;
}
else if(this.type == TXT_SANS_SERIF)
else if(Type == TXT_SANS_SERIF)
{
if(bCapitale)
code = code + 0x1D5CB;
else if(bSmall)
code = code + 0x1D5C5;
}
else if(this.type == TXT_SCRIPT)
else if(Type == TXT_SCRIPT)
{
if(bCapitale)
code = code + 0x1D45C;
......@@ -423,7 +439,7 @@ CMathText.prototype =
{
this.bJDraw = bJustDraw;
},
setMText: function(type)
SetTypeText: function(type)
{
this.type = type;
},
......@@ -460,7 +476,6 @@ CMathText.prototype =
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.bPlaceholder = true;
},
......
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