Commit 326c1166 authored by Anna.Pavlova's avatar Anna.Pavlova

1. Поправила Apply_TextPr для ситуации, когда ApplyToAll = true, а в Root...

1. Поправила Apply_TextPr для ситуации, когда ApplyToAll = true, а в Root формулы при этом позиции селекта не проставлены (например, когда происходит селект ячеек в таблице (переход из одной ячейки с другую) Set_SelectionContentPos не вызывается  для каждого элемента ячейки)
2. Поправила Cursor_MoveToEndPos
3. Добавила проверку в Selction_Remove на то, чтобы start и end позиции селекта были всегда в рамках кол-ва элементов контента

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57273 954022d7-b5bf-4e40-9824-e11837661b57
parent 769fcf8c
......@@ -381,8 +381,15 @@ ParaMath.prototype =
{
// TODO: ParaMath.Apply_TextPr
var content = this.GetSelectContent().Content;
content.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
if(ApplyToAll == true) // для ситуации, когда ApplyToAll = true, в Root формулы при этом позиции селекта не проставлены
{
this.Root.Apply_TextPr(TextPr, IncFontSize, true);
}
else
{
var content = this.GetSelectContent().Content;
content.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
},
......@@ -1242,7 +1249,7 @@ ParaMath.prototype =
{
// TODO: ParaMath.Cursor_MoveToEndPos
this.Root.Cursor_MoveToEndPos();
this.Root.Cursor_MoveToEndPos(SelectFromEnd);
},
Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
......
......@@ -681,23 +681,11 @@ CMathBase.prototype =
this.elements[i][j].hidePlaceholder(flag);
}
},
// ф-ия используется, для того чтобы добавить в контент элемента текст/др формулы
getElement: function(x, y)
{
return this.elements[x][y];
},
getContent: function(stack, bCurrent)
{
var pos = stack.pop();
if(bCurrent)
{
this.CurPos_X = pos.X;
this.CurPos_Y = pos.Y;
}
var content = this.elements[pos.X][pos.Y].getContent(stack, bCurrent);
return content;
},
//// For Edit /////
/*selection_Start: function(x, y)
{
......
......@@ -521,86 +521,6 @@ CRecalculateInfo.prototype =
}
// TO DO
// убрать
/*function CMathRunPrp()
{
this.typeObj = MATH_RUN_PRP;
this.textPrp = new CTextPr();
this.mathPrp = new CMPrp();
this.size = {width: 0, height: 0, center: 0, ascent: 0};
}
CMathRunPrp.prototype =
{
Merge: function(MRunPrp)
{
// only For object of CMathRunPrp
var checkTxtPrp = MRunPrp.textPrp !== null && typeof(MRunPrp.textPrp)!== "undefined",
checkMPrp = MRunPrp.mathPrp !== null && typeof(MRunPrp.mathPrp)!== "undefined";
if(checkTxtPrp && checkMPrp)
{
this.textPrp.Merge(MRunPrp.textPrp);
this.mathPrp.Merge(MRunPrp.mathPrp);
}
},
old_Merge: function(oWPrp)
{
this.textPrp.Merge(oWPrp);
},
*//*getWRunPrp: function()
{
// смержить c MRunPrp
return this.textPrp;
},*//*
getMergedWPrp: function()
{
var oWPrp = new CTextPr();
if(!this.mathPrp.nor) // math text, style: plain
{
oWPrp.Merge(this.textPrp); // FontFamily, FontSize etc
var mPrp = this.mathPrp.getTxtPrp();
oWPrp.Merge(mPrp); // bold, italic
}
else
{
oWPrp.Merge(this.textPrp);
}
return oWPrp;
},
getTxtPrp: function()
{
return this.textPrp;
},
setTxtPrp: function(oWPrp)
{
this.textPrp.Merge(oWPrp);
},
setMathRunPrp: function(oMPrp)
{
this.mathPrp.setMathProps(oMPrp);
},
draw: function() {},
setPosition: function() {},
relate: function() {},
getPropsForWrite: function()
{
var props = {};
props.textPrp = this.textPrp;
props.mathRunPrp = this.mathPrp.getPropsForWrite();
return props;
},
getTxtSettings: function()
{
return this.mathPrp.getTxtSettings();
}
}*/
function CMPrp()
{
this.sty = STY_ITALIC;
......@@ -630,45 +550,6 @@ function CMPrp()
}
CMPrp.prototype =
{
/*Merge: function(mPrp)
{
// выравнивание
this.aln = mPrp.aln;
this.brk = mPrp.brk;
// настройки для букв в контенте
this.lit = mPrp.lit;
this.nor = mPrp.nor;
this.typeText = mPrp.typeText;
// настройки bold, italic
this.italic = mPrp.italic;
this.bold = mPrp.bold;
this.plain = mPrp.plain;
},
SetBProp: function(obj, prp)
{
if(prp === 1 || prp === true)
obj = true;
else if(prp === 0 || prp === false)
obj = false;
},*/
/*getProps: function()
{
var props =
{
align: this.aln,
brk: this.brk,
literal: this.lit,
script: this.src,
italic: this.italic,
bold: this.bold,
plain: this.plain,
typeText: this.typeText
};
return props;
},*/
setMathProps: function(props)
{
if(props.aln === true || props.aln == false)
......@@ -696,43 +577,7 @@ CMPrp.prototype =
if(props.scr !== null && props.scr !== undefined)
this.scr = props.scr;
/*if(props.sty === STY_ITALIC)
this.italic = true;
else if(props.sty === STY_BI)
{
this.italic = true;
this.bold = true;
}
else if(props.sty === STY_BOLD)
{
this.italic = false;
this.bold = true;
}
else if(props.sty === STY_PLAIN )
{
this.typeText = TXT_PLAIN; // буквы берутся обычные, не специальные для Cambria Math : то есть как для TXT_NORMAL
// отличие от TXT_NORMAL w:rPrp не учитываются !
}
if(typeof(props.scr)!=="undefined" && props.scr !== null)
this.typeText = props.scr;
if(props.nor)
this.typeText = TXT_NORMAL;
*/
},
/*Apply_Pr: function(TextPr)
{
if(TextPr.Bold !== null && typeof(TextPr.Bold) !== "undefined")
this.bold = TextPr.Bold;
if(TextPr.Italic !== null && typeof(TextPr.Italic) !== "undefined")
this.italic = TextPr.Italic;
},*/
getPropsForWrite: function()
{
var props =
......@@ -745,38 +590,6 @@ CMPrp.prototype =
scr: this.scr
};
/*var Italic = this.italic && !this.bold,
BoldItalic = this.italic && this.bold,
Bold = this.bold && !this.italic,
Plain = this.plain;
if(this.typeText == TXT_NORMAL)
{
props.nor = 1;
}
else
{
if(BoldItalic)
props.sty = STY_BI;
else if(Bold)
props.sty = STY_BOLD;
else if(Italic)
props.sty = STY_ITALIC;
else if(Plain)
props.sty = STY_PLAIN;
}
if(this.aln)
props.aln = 1;
if(this.brk)
props.brk = 1;
if(this.lit)
props.lit = 1;
props.scr = this.typeText;*/
return props;
},
getTxtPrp: function()
......@@ -4019,6 +3832,7 @@ CMathContent.prototype =
var gaps = {left: 0, right: 0};
var bFirstComp = false,
bLastComp = false;
bLastComp = false;
var len = this.content.length;
......@@ -4511,12 +4325,21 @@ CMathContent.prototype =
left = current;
/*if(this.CurPos <= i)
this.CurPos++;*/
}
else if(!bDeleteEmptyRun )
{
NewContent.push(this.content[i]);
left = current;
}
else
{
/*if(this.CurPos <= i )
this.CurPos--;*/
}
if(bCurrComp && bAll == true)
......@@ -4605,32 +4428,29 @@ CMathContent.prototype =
},
Cursor_MoveToStartPos: function()
{
if(!this.IsEmpty())
if(!this.Is_Empty())
{
this.CurPos = 0;
this.Selection.Start = 0;
this.Selection.End = 0;
this.content[0].Cursor_MoveToStartPos();
}
},
Cursor_MoveToEndPos: function()
Cursor_MoveToEndPos: function(SelectFromEnd)
{
if(!this.IsEmpty())
if(!this.Is_Empty())
{
var len = this.content.length - 1;
this.CurPos = len;
this.Selection.Start = len;
this.Selection.End = len;
this.content[len].Cursor_MoveToEndPos();
this.content[len].Cursor_MoveToEndPos(SelectFromEnd);
}
},
Cursor_Is_Start: function()
{
var result = false;
if( !this.IsEmpty() )
if( !this.Is_Empty() )
{
if(this.CurPos == 0)
result = this.content[0].Cursor_Is_Start();
......@@ -4642,7 +4462,7 @@ CMathContent.prototype =
{
var result = false;
if(!this.IsEmpty())
if(!this.Is_Empty())
{
var len = this.content.length - 1;
if(this.CurPos == len)
......@@ -4810,17 +4630,11 @@ CMathContent.prototype =
EndPos = temp;
}
//var lng = this.content.length - 1;
for(var i = StartPos + 1; i < EndPos; i++)
this.content[i].Apply_TextPr(TextPr, IncFontSize, true );
var bDirect = this.Selection.Start < this.Selection.End;
if(this.content[EndPos].Type == para_Math_Run)
{
NewRuns = this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, false);
......@@ -4832,9 +4646,6 @@ CMathContent.prototype =
if(RRun !== null)
{
this.Internal_Content_Add(EndPos+1, RRun);
//if(bDirect && true === this.content[this.Selection.Start].Selection_IsEmpty(true))
}
}
......@@ -4884,9 +4695,6 @@ CMathContent.prototype =
}
}
if(this.bRoot)
console.log("ApplyToAll " + ApplyToAll + " Start " + this.Selection.Start + " End " + this.Selection.End);
},
Internal_Content_Add : function(Pos, Item)
{
......@@ -5108,25 +4916,9 @@ CMathContent.prototype =
}
},
/////////////////////////
getContent: function(stack, bCurrent)
Is_Empty: function()
{
var content = null;
var pos = stack.pop();
if(bCurrent)
this.CurPos = pos.X;
if(stack.length > 0)
content = this.content[pos.X].value.getContent(stack, bCurrent);
else
content = this;
return content;
},
IsEmpty: function()
{
return this.content.length == 1;
return this.content.length == 0;
},
Copy: function(Selected)
{
......@@ -5174,18 +4966,21 @@ CMathContent.prototype =
var start = this.Selection.Start,
end = this.Selection.End;
//if(this.content[start].typeObj !== MATH_PLACEHOLDER)
this.content[start].Selection_Remove();
var lng = this.content.length;
if(start !== end)
if(start >= 0 && start < lng && end >=0 && end < lng)
{
//if(this.content[end].typeObj !== MATH_PLACEHOLDER)
this.content[start].Selection_Remove();
if(start !== end)
this.content[end].Selection_Remove();
}
/*else
console.log("True");*/
this.Selection.Start = this.CurPos;
this.Selection.End = this.CurPos;
/*this.Selection.Start = this.CurPos;
this.Selection.End = this.CurPos;*/
this.Selection.Use = false;
},
......
......@@ -187,12 +187,9 @@
<script type="text/javascript" src="Editor/SerializeCommon.js"></script>
<script type="text/javascript" src="Math/mathTypes.js"></script>
<!--<script type="text/javascript" src="Math/print.js"></script>-->
<script type="text/javascript" src="Math/mathText.js"></script>
<script type="text/javascript" src="Math/mathContent.js"></script>
<!--<script type="text/javascript" src="Math/actions.js"></script>-->
<script type="text/javascript" src="Math/base.js"></script>
<!--<script type="text/javascript" src="Math/subBase.js"></script>-->
<script type="text/javascript" src="Math/fraction.js"></script>
<script type="text/javascript" src="Math/degree.js"></script>
<script type="text/javascript" src="Math/matrix.js"></script>
......@@ -204,7 +201,6 @@
<!--<script type="text/javascript" src="Math/drawingUnion.js"></script>-->
<script type="text/javascript" src="Math/borderBox.js"></script>
<!--<script type="text/javascript" src="Math/TEST_BUG_2.js"></script>-->
<!--script type="text/javascript" src="Math/test_composition.js"></script>-->
<!--for copy/paste from excel-->
<script type="text/javascript" src="../Excel/utils/utils.js"></script>
......
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