Commit c50806b1 authored by Sergey.Tsarkov's avatar Sergey.Tsarkov

добавлены случаи при удалении, когда выделяется вся формула

SetRunEmptyToContent вызывается для каждого контента
символы в виде юникода

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56878 954022d7-b5bf-4e40-9824-e11837661b57
parent d6de06ae
......@@ -225,14 +225,6 @@ ParaMath.prototype =
Remove : function(Direction, bOnAddText)
{
var oContent = this.GetSelectContent();
/*var Comp = oContent.Content.GetParent();
Comp.SetSelectAll();
Comp.SelectToParent();
this.bSelectionUse = true;*/
if (oContent.Start == oContent.End)
{
var oElem = oContent.Content.getElem(oContent.Start);
......@@ -240,7 +232,12 @@ ParaMath.prototype =
if (oElem.typeObj == MATH_COMP)
this.RemoveElem(oContent, Direction, bOnAddText);
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == false)
return;
{
var Comp = oContent.Content.GetParent();
Comp.SetSelectAll();
Comp.SelectToParent();
this.bSelectionUse = true;
}
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == true)
{
History.Create_NewPoint();
......@@ -261,11 +258,74 @@ ParaMath.prototype =
}
else //pararun
{
if ((Direction > 0 && oElem.State.ContentPos + 1 > oElem.Content.length) || (Direction < 0 && oElem.State.ContentPos - 1 < 0))
if (Direction < 0 && oElem.State.ContentPos - 1 < 0) //backspase
{
if (oContent.Content.CurPos - 1 >= 0)//слева есть элементы
{
var prevElem = oContent.Content.getElem(oContent.Start - 1);
if (prevElem.typeObj == MATH_COMP) //слева композиция
{
this.Set_Select_ToMComp(Direction);
return;
}
else //слева ран
{
History.Create_NewPoint();
prevElem.Remove(Direction, bOnAddText);
if(prevElem.Content.length == 0 && !bOnAddText) //тк pararun пустой, удаляем его
{
var Items = [];
Items.push(prevElem.Parent.content[0]);
prevElem.Parent.content.splice( 0, 1 );
History.Add(prevElem.Parent, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: 0});
prevElem.Parent.CurPos--;
}
return;
}
}
else //переходим на уровень выше и выделяем композицию
{
var Comp = oContent.Content.GetParent();
Comp.SetSelectAll();
Comp.SelectToParent();
this.bSelectionUse = true;
}
}
else if (Direction > 0 && oElem.State.ContentPos + 1 > oElem.Content.length) //delete
{
if (oContent.Content.CurPos + 1 >= oContent.Content.content.length) //переходим на уровень выше и выделяем композицию
{
var Comp = oContent.Content.GetParent();
Comp.SetSelectAll();
Comp.SelectToParent();
this.bSelectionUse = true;
}
else //справа есть элемент
{
var nextElem = oContent.Content.getElem(oContent.Start + 1);
if (nextElem.typeObj == MATH_COMP) //справа композиция
{
this.Set_Select_ToMComp(Direction);
return;
}
else //справа ран
{
History.Create_NewPoint();
nextElem.State.ContentPos = 0;
nextElem.Remove(Direction, bOnAddText);
if(nextElem.Content.length == 0 && !bOnAddText) //тк pararun пустой, удаляем его
{
var Items = [];
Items.push(nextElem.Parent.content[0]);
nextElem.Parent.content.splice( 0, 1 );
History.Add(nextElem.Parent, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: 0});
}
return;
}
}
}
History.Create_NewPoint();
oElem.Remove(Direction, bOnAddText);
if(oElem.Content.length == 0 && !bOnAddText) //тк pararun пустой, удаляем его
......@@ -274,6 +334,8 @@ ParaMath.prototype =
Items.push(oElem.Parent.content[0]);
oElem.Parent.content.splice( 0, 1 );
History.Add(oElem.Parent, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: 0});
if (Direction < 0)
oContent.Content.CurPos--;
}
}
}
......@@ -297,6 +359,7 @@ ParaMath.prototype =
{
Items.push(oContent.Content.content[i]);
oContent.Content.content.splice( i, 1 );
if (Direction < 0)
oContent.Content.CurPos--;
}
History.Add(oContent.Content, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: oContent.Start});
......
......@@ -7317,7 +7317,6 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
res = this.bcr.Read1(length, function(t, l){
return oThis.boMathr.ReadMathArg(t,l,oMathPara.Root);
});
oMathPara.Root.SetRunEmptyToContent(true);
}
else if (c_oSerParType.Hyperlink == type) {
var oHyperlinkObj = {Link: null, Anchor: null, Tooltip: null, History: null, DocLocation: null, TgtFrame: null};
......@@ -8406,6 +8405,8 @@ function Binary_oMathReader(stream)
}
else
res = c_oSerConstants.ReadUnknown;
oElem.SetRunEmptyToContent(true);
return res;
};
this.ReadMathArgPr = function(type, length, oElem)
......@@ -8441,7 +8442,7 @@ function Binary_oMathReader(stream)
var oThis = this;
if (c_oSer_OMathBottomNodesValType.Val === type)
{
props.begChr = this.stream.GetString2LE(length);
props.begChr = this.stream.GetString2LE(length).charCodeAt(0);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -8729,7 +8730,7 @@ function Binary_oMathReader(stream)
var oThis = this;
if (c_oSer_OMathBottomNodesValType.Val === type)
{
var text = this.stream.GetString2LE(length);
var text = this.stream.GetString2LE(length).charCodeAt(0);
props.chr = text;
}
else
......@@ -8941,7 +8942,7 @@ function Binary_oMathReader(stream)
var oThis = this;
if (c_oSer_OMathBottomNodesValType.Val === type)
{
props.endChr = this.stream.GetString2LE(length);
props.endChr = this.stream.GetString2LE(length).charCodeAt(0);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -9752,7 +9753,6 @@ function Binary_oMathReader(stream)
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadMathArg(t,l,oOMathPara.Root);
});
oOMathPara.Root.SetRunEmptyToContent(true);
}
else if (c_oSer_OMathContentType.OMathParaPr === type)
{
......@@ -9911,7 +9911,10 @@ function Binary_oMathReader(stream)
if (oDeg.content && length == 0 && props.degHide !== true)
oDeg.content.fillPlaceholders();
else if ( oDeg.content && length == 0 && props.degHide == true)
{
oDeg.content.degHide = true;
oDeg.content = null;
}
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadMathArg(t,l,oDeg.content);
......@@ -10005,7 +10008,7 @@ function Binary_oMathReader(stream)
var oThis = this;
if (c_oSer_OMathBottomNodesValType.Val === type)
{
props.sepChr = this.stream.GetString2LE(length);
props.sepChr = this.stream.GetString2LE(length).charCodeAt(0);
}
else
res = c_oSerConstants.ReadUnknown;
......
This diff is collapsed.
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