Commit 7ff713e8 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

поправила remove: теперь когда заселекчен не весь Run(вместе с RunPrp),...

поправила remove: теперь когда заселекчен не весь Run(вместе с RunPrp), добавляются в контент RunPrp для оставшейся части Run

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53090 954022d7-b5bf-4e40-9824-e11837661b57
parent 6c193d99
...@@ -7691,13 +7691,6 @@ ParaMath.prototype = ...@@ -7691,13 +7691,6 @@ ParaMath.prototype =
this.Math.AddLetter( 0x0020 ); this.Math.AddLetter( 0x0020 );
else if ( para_Math === Type ) else if ( para_Math === Type )
{ {
/*var oCurContent = this.Math.CurrentContent;
var rPr = oCurContent.getCurrRunPrp();
Item.Math.Root.setRPrp(rPr);
oCurContent.addToContent_2(Item.Math.Root);
//Item.Measure(g_oTextMeasurer, rPr);
oCurContent.verifyRPrp_MC_2(rPr);*/
var rPr = this.Math.GetCurrentRPrp(); var rPr = this.Math.GetCurrentRPrp();
Item.Math.Root.setRPrp(rPr); Item.Math.Root.setRPrp(rPr);
this.Math.AddToComposition(Item.Math.Root); this.Math.AddToComposition(Item.Math.Root);
...@@ -7846,11 +7839,13 @@ ParaMath.prototype = ...@@ -7846,11 +7839,13 @@ ParaMath.prototype =
Selection_IsEmpty : function() Selection_IsEmpty : function()
{ {
console.log("Selection_IsEmpty " + this.Math.Selection_IsEmpty());
return this.Math.Selection_IsEmpty(); return this.Math.Selection_IsEmpty();
}, },
Selection_IsUse : function() Selection_IsUse : function()
{ {
console.log("Selection_IsUse " + ( true === this.Math.Selection_IsEmpty() ? false : true ));
return ( true === this.Math.Selection_IsEmpty() ? false : true ); return ( true === this.Math.Selection_IsEmpty() ? false : true );
}, },
......
...@@ -659,7 +659,7 @@ CMathContent.prototype = ...@@ -659,7 +659,7 @@ CMathContent.prototype =
middleContent = subContent.slice(subStart), middleContent = subContent.slice(subStart),
endContent = this.content.slice(curEnd + 1); endContent = this.content.slice(curEnd + 1);
this.content = []; this.content.length = 0;
this.content = this.content.concat(startContent); this.content = this.content.concat(startContent);
this.content = this.content.concat(middleContent); this.content = this.content.concat(middleContent);
this.content = this.content.concat(endContent); this.content = this.content.concat(endContent);
...@@ -4775,7 +4775,8 @@ CMathContent.prototype = ...@@ -4775,7 +4775,8 @@ CMathContent.prototype =
{ {
bDelete: false, /* нужно ли пересчитывать позицию или нет, работает при backspace */ bDelete: false, /* нужно ли пересчитывать позицию или нет, работает при backspace */
bBegin: false, /* в начале контента или нет */ bBegin: false, /* в начале контента или нет */
bEnd: false /* в конце */ bEnd: false, /* в конце */
bAddRPrp: false
}; };
var CurrContent = SelectContent = null, var CurrContent = SelectContent = null,
...@@ -4821,12 +4822,12 @@ CMathContent.prototype = ...@@ -4821,12 +4822,12 @@ CMathContent.prototype =
result = this.remove_internal(order); result = this.remove_internal(order);
items = result.items; items = result.items;
state.bDelete = result.bDelete; state.bDelete = result.bDelete;
state.bAddRPrp = result.bAddRPrp;
SelectContent = this; SelectContent = this;
CurrContent = this; CurrContent = this;
} }
else if(order == -2) else if(order == -2)
{ {
this.removeFormula(this.CurPos); this.removeFormula(this.CurPos);
SelectContent = this; SelectContent = this;
...@@ -4840,6 +4841,7 @@ CMathContent.prototype = ...@@ -4840,6 +4841,7 @@ CMathContent.prototype =
{ {
var items = null; var items = null;
var bDelete = false; var bDelete = false;
var bAddRPrp = false;
var bSelect = this.selectUse(); var bSelect = this.selectUse();
var currType = this.content[this.CurPos].value.typeObj, var currType = this.content[this.CurPos].value.typeObj,
...@@ -4909,8 +4911,36 @@ CMathContent.prototype = ...@@ -4909,8 +4911,36 @@ CMathContent.prototype =
var bStartCurrRPrp = startCurType == MATH_RUN_PRP, // проверка на то, чтобы добавить RunPrp к селекту var bStartCurrRPrp = startCurType == MATH_RUN_PRP, // проверка на то, чтобы добавить RunPrp к селекту
bStartPrevRPrp = startPrevType == MATH_RUN_PRP; // проверка на то, чтобы убрать RunPrp из селекта bStartPrevRPrp = startPrevType == MATH_RUN_PRP; // проверка на то, чтобы убрать RunPrp из селекта
if(endCurType == MATH_RUN_PRP) if(endCurType == MATH_RUN_PRP)
end--; end--;
else if(endCurType == MATH_TEXT && endNextType == MATH_TEXT) // слева справа текст, в середине Run
{
// добавляем RunPrp, когда не весь Run заселектили // начали селектить вне Run заселектили текущие RunPrp или начали не в конце Run и вышли за его пределы (заселектили RunPrp) //
for(var i = end - 1; i--; i > start - 1)
{
if(this.content[i].value.typeObj == MATH_RUN_PRP)
{
bAddRPrp = true;
var rPrp = new CMathRunPrp();
rPrp.Merge( this.getRPrpByPosition(end - 1) );
var element = new mathElem(rPrp);
var startContent = this.content.splice(0, end);
var endContent = this.content.splice(0, this.content.length);
this.content.length = 0;
this.content = this.content.concat(startContent);
this.content = this.content.concat(element);
this.content = this.content.concat(endContent);
break;
}
}
}
if(bStartCurrRPrp || bStartPrevRPrp) // check RunPrp if(bStartCurrRPrp || bStartPrevRPrp) // check RunPrp
{ {
...@@ -4937,9 +4967,6 @@ CMathContent.prototype = ...@@ -4937,9 +4967,6 @@ CMathContent.prototype =
else if(bSelectRunPrp && bStartPrevRPrp) else if(bSelectRunPrp && bStartPrevRPrp)
start--; start--;
// TODO
// добавить RunPrp, когда не весь Run заселектили, но при этом начали селектить вне Run (и следовательно заселектили RunPrp)
// на Undo сделать флаг, что были добавлены RunPrp при удалении
} }
} }
...@@ -4979,7 +5006,7 @@ CMathContent.prototype = ...@@ -4979,7 +5006,7 @@ CMathContent.prototype =
bDelete = true; bDelete = true;
} }
return {bDelete: bDelete, items: items}; return {bDelete: bDelete, bAddRPrp: bAddRPrp, items: items};
}, },
old_remove_internal: function(order) old_remove_internal: function(order)
{ {
...@@ -5422,6 +5449,10 @@ CMathContent.prototype = ...@@ -5422,6 +5449,10 @@ CMathContent.prototype =
return result; return result;
}, },
getCurrRunPrp: function() getCurrRunPrp: function()
{
return this.getRPrpByPosition(this.CurPos);
},
getRPrpByPosition: function(position)
{ {
var runPrp = new CTextPr(); var runPrp = new CTextPr();
...@@ -5431,13 +5462,13 @@ CMathContent.prototype = ...@@ -5431,13 +5462,13 @@ CMathContent.prototype =
{ {
runPrp.Merge(this.Parent.getCtrPrp()); runPrp.Merge(this.Parent.getCtrPrp());
} }
else if(this.CurPos == 0 && this.content[1].value.typeObj == MATH_COMP) else if(position == 0 && this.content[1].value.typeObj == MATH_COMP)
{ {
runPrp.Merge(this.content[1].value.getCtrPrp()); runPrp.Merge(this.content[1].value.getCtrPrp());
} }
else else
{ {
for(var i = this.CurPos; i > 0; i--) for(var i = position; i > 0; i--)
{ {
var obj = this.content[i].value; var obj = this.content[i].value;
...@@ -6900,11 +6931,12 @@ CMathComposition.prototype = ...@@ -6900,11 +6931,12 @@ CMathComposition.prototype =
var result = this.SelectContent.remove(order); var result = this.SelectContent.remove(order);
var bRoot = this.SelectContent.bRoot === true, var bRoot = this.SelectContent.bRoot === true,
bToUpper = result.state.bBegin || result.state.bEnd; // наверх нужно ли прокидовать bToUpper = result.state.bBegin || result.state.bEnd, // наверх нужно ли прокидовать
bAddRPrp = result.state.bAddRPrp;
if( result.state.bDelete ) if( result.state.bDelete )
History.Add(this.CurrentContent, {Type: historyitem_Math_RemoveItem, Items: result.items, Pos: Pos}); History.Add(this.CurrentContent, {Type: historyitem_Math_RemoveItem, Items: result.items, Pos: Pos, bAddRPrp: bAddRPrp});
this.CurrentContent = result.CurrContent; this.CurrentContent = result.CurrContent;
......
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