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