Commit 38ee0825 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Поправила баг : отображались дробные значения размера шрифта для итераторов

2. Поправила баг на Get_StartRangePos и Get_EndRangePos
3. Переделала полностью MathProperties (для текста)
4. Добавила в Run Apply_Style (для применения текстовых настроек к MathPrp)
5. Добавила перевод юникодов символов из Basic Multilingual Plane в юникодные значения из расширенной таблицы 
в зависимости от свойств style и script для шрифта Cambria Math (для остальных шрифтов символы не подменяются),
а именно Roman - Bold, Roman - Bold Italic, расширила DOUBLE STRUCK, FRAKTUR - BOLD, SANS SERIF - BOLD,
SANS SERIF - BOLD ITALIC, SANS SERIF - PLAIN, SCRIPT - BOLD
6. Поправила баг: для Normal Text подхватываем font из w:rPr, иначе всегда Cambria Math

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57166 954022d7-b5bf-4e40-9824-e11837661b57
parent 6b192f6e
...@@ -59,7 +59,6 @@ function ParaMath() ...@@ -59,7 +59,6 @@ function ParaMath()
this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1); this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1);
this.MathPr = this.MathPr =
{ {
naryLim: NARY_UndOvr, naryLim: NARY_UndOvr,
...@@ -381,7 +380,8 @@ ParaMath.prototype = ...@@ -381,7 +380,8 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Apply_TextPr // TODO: ParaMath.Apply_TextPr
this.Root.Apply_TextPr(TextPr, IncFontSize, ApplyToAll); var content = this.GetSelectContent().Content;
content.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}, },
...@@ -954,21 +954,22 @@ ParaMath.prototype = ...@@ -954,21 +954,22 @@ ParaMath.prototype =
tPrp.Merge(this.DefaultTextPr); tPrp.Merge(this.DefaultTextPr);
tPrp.Merge(oWPrp); tPrp.Merge(oWPrp);
var FSize = tPrp.FontSize; //var FSize = tPrp.FontSize;
if(argSize == -1) if(argSize == -1)
{ {
//FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26; //FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26;
FSize = 0.76*FSize; tPrp.FontSize = 0.76*tPrp.FontSize;
tPrp.FontSizeCS = 0.76*tPrp.FontSizeCS;
} }
else if(argSize == -2) else if(argSize == -2)
{ {
//FSize = -0.0004*FSize*FSize + 0.66*FSize + 0.87; //FSize = -0.0004*FSize*FSize + 0.66*FSize + 0.87;
FSize = 0.76*0.855*FSize; tPrp.FontSize = 0.76*0.855*tPrp.FontSize;
tPrp.FontSizeCS = 0.76*0.855*tPrp.FontSizeCS;
} }
tPrp.FontSize = FSize; //tPrp.FontSize = FSize;
oWPrp.Merge(tPrp); oWPrp.Merge(tPrp);
...@@ -1254,6 +1255,8 @@ ParaMath.prototype = ...@@ -1254,6 +1255,8 @@ ParaMath.prototype =
// Проверяем, попали ли мы в формулу // Проверяем, попали ли мы в формулу
if ( EndPos >= 1 )
{
var Dx = this.Root.size.width; var Dx = this.Root.size.width;
var D = SearchPos.X - SearchPos.CurX; var D = SearchPos.X - SearchPos.CurX;
...@@ -1305,6 +1308,8 @@ ParaMath.prototype = ...@@ -1305,6 +1308,8 @@ ParaMath.prototype =
} }
SearchPos.CurX = CurX + Dx; SearchPos.CurX = CurX + Dx;
}
return Result; return Result;
}, },
...@@ -1408,7 +1413,7 @@ ParaMath.prototype = ...@@ -1408,7 +1413,7 @@ ParaMath.prototype =
// Сделать для случая, когда формула будет занимать несколько строк // Сделать для случая, когда формула будет занимать несколько строк
this.Root.Get_EndPos(false, SearchPos, Depth); this.Root.Get_EndPos(false, SearchPos.Pos, Depth);
}, },
...@@ -1418,7 +1423,7 @@ ParaMath.prototype = ...@@ -1418,7 +1423,7 @@ ParaMath.prototype =
// Сделать для случая, когда формула будет занимать несколько строк, переделать // Сделать для случая, когда формула будет занимать несколько строк, переделать
this.Root.Get_StartPos(SearchPos, Depth); this.Root.Get_StartPos(SearchPos.Pos, Depth);
}, },
......
This diff is collapsed.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
var historyitem_Math_AddItem = 1; // Добавляем элемент var historyitem_Math_AddItem = 1; // Добавляем элемент
var historyitem_Math_RemoveItem = 2; // Удаляем элемент var historyitem_Math_RemoveItem = 2; // Удаляем элемент
var historyitem_Math_Style = 3; // Меняем стиль MathPr
...@@ -614,6 +615,11 @@ CMathRunPrp.prototype = ...@@ -614,6 +615,11 @@ CMathRunPrp.prototype =
function CMPrp() function CMPrp()
{ {
this.sty = STY_ITALIC;
this.scr = TXT_ROMAN;
this.nor = false;
this.aln = false; this.aln = false;
this.brk = false; this.brk = false;
this.lit = false; this.lit = false;
...@@ -627,16 +633,16 @@ function CMPrp() ...@@ -627,16 +633,16 @@ function CMPrp()
// буквы берутся обычные, не специальные для Cambria Math : то есть как для TXT_NORMAL // буквы берутся обычные, не специальные для Cambria Math : то есть как для TXT_NORMAL
// отличие от TXT_NORMAL w:rPrp в этом случае не учитываются ! // отличие от TXT_NORMAL w:rPrp в этом случае не учитываются !
this.typeText = TXT_ROMAN; //this.typeText = TXT_ROMAN;
this.italic = true; //this.italic = true;
this.bold = false; //this.bold = false;
//this.nor = false; //this.nor = false;
//this.plain = false; //this.plain = false;
} }
CMPrp.prototype = CMPrp.prototype =
{ {
Merge: function(mPrp) /*Merge: function(mPrp)
{ {
// выравнивание // выравнивание
this.aln = mPrp.aln; this.aln = mPrp.aln;
...@@ -658,8 +664,8 @@ CMPrp.prototype = ...@@ -658,8 +664,8 @@ CMPrp.prototype =
obj = true; obj = true;
else if(prp === 0 || prp === false) else if(prp === 0 || prp === false)
obj = false; obj = false;
}, },*/
getProps: function() /*getProps: function()
{ {
var props = var props =
{ {
...@@ -674,15 +680,36 @@ CMPrp.prototype = ...@@ -674,15 +680,36 @@ CMPrp.prototype =
}; };
return props; return props;
}, },*/
setMathProps: function(props) setMathProps: function(props)
{ {
this.SetBProp(this.aln, props.aln); if(props.aln === true || props.aln == false)
this.SetBProp(this.brk, props.brk); this.aln = props.aln;
this.SetBProp(this.lit, props.lit);
if(props.brk === true || props.brk == false)
this.brk = props.brk;
if(props.lit === true || props.lit == false)
this.lit = props.lit;
// если приходит несколько параметров style из xml, то запоминается последний if(props.nor === true || props.nor == false)
if(props.sty === STY_ITALIC) this.nor = props.nor;
if(props.sty !== null && props.sty !== undefined)
this.sty = props.sty;
// TXT_DOUBLE_STRUCK U+1D538 - U+1D56B
// TXT_MONOSPACE U+1D670 - U+1D6A3
// TXT_FRAKTUR U+1D504 - U+1D537
// TXT_SANS_SERIF U+1D608 - U+1D63B
// TXT_SCRIPT U+1D49C - U+1D4CF
if(props.scr !== null && props.scr !== undefined)
this.scr = props.scr;
/*if(props.sty === STY_ITALIC)
this.italic = true; this.italic = true;
else if(props.sty === STY_BI) else if(props.sty === STY_BI)
{ {
...@@ -700,11 +727,7 @@ CMPrp.prototype = ...@@ -700,11 +727,7 @@ CMPrp.prototype =
// отличие от TXT_NORMAL w:rPrp не учитываются ! // отличие от TXT_NORMAL w:rPrp не учитываются !
} }
// TXT_DOUBLE_STRUCK U+1D538 - U+1D56B
// TXT_MONOSPACE U+1D670 - U+1D6A3
// TXT_FRAKTUR U+1D504 - U+1D537
// TXT_SANS_SERIF U+1D608 - U+1D63B
// TXT_SCRIPT U+1D49C - U+1D4CF
if(typeof(props.scr)!=="undefined" && props.scr !== null) if(typeof(props.scr)!=="undefined" && props.scr !== null)
this.typeText = props.scr; this.typeText = props.scr;
...@@ -712,22 +735,29 @@ CMPrp.prototype = ...@@ -712,22 +735,29 @@ CMPrp.prototype =
if(props.nor) if(props.nor)
this.typeText = TXT_NORMAL; this.typeText = TXT_NORMAL;
*/
}, },
Apply_Pr: function(TextPr) /*Apply_Pr: function(TextPr)
{ {
if(TextPr.Bold !== null && typeof(TextPr.Bold) !== "undefined") if(TextPr.Bold !== null && typeof(TextPr.Bold) !== "undefined")
this.bold = TextPr.Bold; this.bold = TextPr.Bold;
if(TextPr.Italic !== null && typeof(TextPr.Italic) !== "undefined") if(TextPr.Italic !== null && typeof(TextPr.Italic) !== "undefined")
this.italic = TextPr.Italic; this.italic = TextPr.Italic;
},*/
},
getPropsForWrite: function() getPropsForWrite: function()
{ {
var props = {}; var props =
{
aln: this.aln,
brk: this.brk,
lit: this.lit,
nor: this.nor,
sty: this.sty,
scr: this.scr
};
var Italic = this.italic && !this.bold, /*var Italic = this.italic && !this.bold,
BoldItalic = this.italic && this.bold, BoldItalic = this.italic && this.bold,
Bold = this.bold && !this.italic, Bold = this.bold && !this.italic,
Plain = this.plain; Plain = this.plain;
...@@ -757,35 +787,16 @@ CMPrp.prototype = ...@@ -757,35 +787,16 @@ CMPrp.prototype =
if(this.lit) if(this.lit)
props.lit = 1; props.lit = 1;
props.scr = this.typeText; props.scr = this.typeText;*/
return props; return props;
}, },
getTypeText: function()
{
return this.typeText;
},
getTxtSettings: function()
{
var type = this.typeText;
if(type == TXT_ROMAN && this.italic == false) // если MATH TEXT и не курсив, то подменяем на NORMAL TEXT
type = TXT_NORMAL;
var settings =
{
type: type,
lit: this.lit
};
return settings;
},
getTxtPrp: function() getTxtPrp: function()
{ {
var textPrp = new CTextPr(); var textPrp = new CTextPr();
textPrp.Italic = this.italic; textPrp.Italic = this.sty == STY_BI || this.sty == STY_ITALIC;
textPrp.Bold = this.bold; textPrp.Bold = this.sty == STY_BI || this.sty == STY_BOLD;
return textPrp; return textPrp;
}, },
...@@ -797,10 +808,8 @@ CMPrp.prototype = ...@@ -797,10 +808,8 @@ CMPrp.prototype =
NewMPrp.brk = this.brk; NewMPrp.brk = this.brk;
NewMPrp.lit = this.lit; NewMPrp.lit = this.lit;
NewMPrp.nor = this.nor; NewMPrp.nor = this.nor;
NewMPrp.typeText = this.typeText; NewMPrp.typeText = this.sty;
NewMPrp.italic = this.italic; NewMPrp.italic = this.scr;
NewMPrp.bold = this.bold;
NewMPrp.plain = this.plain;
return NewMPrp; return NewMPrp;
} }
...@@ -4900,18 +4909,16 @@ CMathContent.prototype = ...@@ -4900,18 +4909,16 @@ CMathContent.prototype =
Get_StartPos: function(ContentPos, Depth) Get_StartPos: function(ContentPos, Depth)
{ {
ContentPos.Update( 0, Depth ); ContentPos.Update( 0, Depth );
Depth++;
this.content[0].Get_StartPos(ContentPos, Depth); this.content[0].Get_StartPos(ContentPos, Depth + 1);
}, },
Get_EndPos: function(BehindEnd, ContentPos, Depth) Get_EndPos: function(BehindEnd, ContentPos, Depth)
{ {
var len = this.content.length - 1; var len = this.content.length - 1;
ContentPos.Update(len, Depth); ContentPos.Update(len, Depth);
Depth++;
if(len > 0) if(len > 0)
this.content[len].Get_EndPos(BehindEnd, ContentPos, Depth); this.content[len].Get_EndPos(BehindEnd, ContentPos, Depth + 1);
}, },
Get_Id : function() Get_Id : function()
{ {
...@@ -5194,6 +5201,41 @@ CMathContent.prototype = ...@@ -5194,6 +5201,41 @@ CMathContent.prototype =
var StartPos = this.SelectStartPos; var StartPos = this.SelectStartPos;
var EndPos = this.SelectEndPos; var EndPos = this.SelectEndPos;
var NewRuns;
var LRun, CRun, RRun;
if(StartPos == EndPos)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, false);
LRun = NewRuns[0];
CRun = NewRuns[1];
RRun = NewRuns[2];
var CRunPos = StartPos;
var Pos;
if(LRun !== null)
{
Pos = StartPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]});
this.content.splice(Pos, 0, CRun);
CRunPos = Pos + 1;
}
if(RRun !== null)
{
Pos = CRunPos + 1;
History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [RRun]});
this.content.splice(Pos, 0, RRun);
}
this.CurPos = CRunPos;
this.SelectStartPos = CRunPos;
this.SelectEndPos = CRunPos;
}
else
{
if(StartPos > EndPos) if(StartPos > EndPos)
{ {
var temp = StartPos; var temp = StartPos;
...@@ -5210,6 +5252,9 @@ CMathContent.prototype = ...@@ -5210,6 +5252,9 @@ CMathContent.prototype =
else if(elem.Type == para_Math_Run) else if(elem.Type == para_Math_Run)
elem.Apply_TextPr( TextPr, IncFontSize, false ); elem.Apply_TextPr( TextPr, IncFontSize, false );
} }
}
/*if ( StartPos === EndPos ) /*if ( StartPos === EndPos )
{ {
......
This diff is collapsed.
...@@ -114,14 +114,16 @@ var ACCENT_TEXT = 46; ...@@ -114,14 +114,16 @@ var ACCENT_TEXT = 46;
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
var TXT_NORMAL = 0; /*var TXT_NORMAL = 0;
var TXT_PLAIN = 1; var TXT_PLAIN = 1;*/
var TXT_ROMAN = 2; // math roman
var TXT_SCRIPT = 3;
var TXT_FRAKTUR = 4; var TXT_ROMAN = 0; // math roman
var TXT_DOUBLE_STRUCK = 5; var TXT_SCRIPT = 1;
var TXT_SANS_SERIF = 6; var TXT_FRAKTUR = 2;
var TXT_MONOSPACE = 7; var TXT_DOUBLE_STRUCK = 3;
var TXT_SANS_SERIF = 4;
var TXT_MONOSPACE = 5;
var OPER_DELIMITER = 0; var OPER_DELIMITER = 0;
var OPER_SEPARATOR = 1; var OPER_SEPARATOR = 1;
......
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