Commit 84cbece7 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлен баг с тем, что при переходе по стрелкам вправо/влево можно было...

Исправлен баг с тем, что при переходе по стрелкам вправо/влево можно было встать в невидимые контенты в формуле (Radical и Nary). Исправлен баг, что не копировались текстовые настройки при автозамене в формуле.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59700 954022d7-b5bf-4e40-9824-e11837661b57
parent 6275469d
...@@ -31,6 +31,7 @@ function ParaMath() ...@@ -31,6 +31,7 @@ function ParaMath()
this.Root = new CMathContent(); this.Root = new CMathContent();
this.Root.bRoot = true; this.Root.bRoot = true;
this.Root.ParentElement = this;
this.X = 0; this.X = 0;
this.Y = 0; this.Y = 0;
...@@ -1945,6 +1946,18 @@ ParaMath.prototype.Document_UpdateInterfaceState = function() ...@@ -1945,6 +1946,18 @@ ParaMath.prototype.Document_UpdateInterfaceState = function()
editor.sync_MathPropCallback(MathProps); editor.sync_MathPropCallback(MathProps);
}; };
/**
* Проверяем используется ли заданный MathContent на текущем уровне формулы
* @param MathContent
*/
ParaMath.prototype.Is_ContentUse = function(MathContent)
{
if (this.Root === MathContent)
return true;
return false;
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Классы с изменениями // Классы с изменениями
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
......
...@@ -8122,6 +8122,12 @@ ParaRun.prototype.Get_TextForAutoCorrect = function(AutoCorrectEngine, RunPos) ...@@ -8122,6 +8122,12 @@ ParaRun.prototype.Get_TextForAutoCorrect = function(AutoCorrectEngine, RunPos)
break; break;
} }
} }
if (null === AutoCorrectEngine.TextPr)
AutoCorrectEngine.TextPr = this.Pr.Copy();
if (null == AutoCorrectEngine.MathPr)
AutoCorrectEngine.MathPr = this.MathPrp.Copy();
}; };
ParaRun.prototype.Get_RangesByPos = function(Pos) ParaRun.prototype.Get_RangesByPos = function(Pos)
......
...@@ -1349,6 +1349,17 @@ CMathBase.prototype.Document_UpdateInterfaceState = function(MathProps) ...@@ -1349,6 +1349,17 @@ CMathBase.prototype.Document_UpdateInterfaceState = function(MathProps)
{ {
}; };
CMathBase.prototype.Is_ContentUse = function(MathContent)
{
for (var Pos = 0, Count = this.Content.length; Pos < Count; Pos++)
{
if (MathContent === this.Content[Pos])
return true;
}
return false;
};
function CMathBasePr() function CMathBasePr()
{ {
}; };
......
...@@ -3298,6 +3298,9 @@ CMathContent.prototype.GetSelectContent = function() ...@@ -3298,6 +3298,9 @@ CMathContent.prototype.GetSelectContent = function()
}; };
CMathContent.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos) CMathContent.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{ {
if (true !== this.ParentElement.Is_ContentUse(this))
return false;
if (false === UseContentPos && para_Math_Run === this.Content[this.Content.length - 1].Type) if (false === UseContentPos && para_Math_Run === this.Content[this.Content.length - 1].Type)
{ {
// При переходе в новый контент встаем в его конец // При переходе в новый контент встаем в его конец
...@@ -3357,6 +3360,9 @@ CMathContent.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseC ...@@ -3357,6 +3360,9 @@ CMathContent.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseC
}; };
CMathContent.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd) CMathContent.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{ {
if (true !== this.ParentElement.Is_ContentUse(this))
return false;
if (false === UseContentPos && para_Math_Run === this.Content[0].Type) if (false === UseContentPos && para_Math_Run === this.Content[0].Type)
{ {
// При переходе в новый контент встаем в его начало // При переходе в новый контент встаем в его начало
...@@ -3416,6 +3422,9 @@ CMathContent.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, Use ...@@ -3416,6 +3422,9 @@ CMathContent.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, Use
}; };
CMathContent.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos) CMathContent.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{ {
if (true !== this.ParentElement.Is_ContentUse(this))
return false;
if (false === UseContentPos && para_Math_Run === this.Content[this.Content.length - 1].Type) if (false === UseContentPos && para_Math_Run === this.Content[this.Content.length - 1].Type)
{ {
// При переходе в новый контент встаем в его конец // При переходе в новый контент встаем в его конец
...@@ -3499,6 +3508,9 @@ CMathContent.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, ...@@ -3499,6 +3508,9 @@ CMathContent.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth,
}; };
CMathContent.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd) CMathContent.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{ {
if (true !== this.ParentElement.Is_ContentUse(this))
return false;
if (false === UseContentPos && para_Math_Run === this.Content[0].Type) if (false === UseContentPos && para_Math_Run === this.Content[0].Type)
{ {
// При переходе в новый контент встаем в его начало // При переходе в новый контент встаем в его начало
...@@ -3872,6 +3884,11 @@ CMathContent.prototype.Process_AutoCorrect = function(ActionElement) ...@@ -3872,6 +3884,11 @@ CMathContent.prototype.Process_AutoCorrect = function(ActionElement)
break; break;
} }
if (null == AutoCorrectEngine.TextPr)
AutoCorrectEngine.TextPr = new CTextPr();
if (null == AutoCorrectEngine.MathPr)
AutoCorrectEngine.MathPr = new CMPrp();
// Создаем новую точку здесь, потому что если автозамену можно будет сделать классы сразу будут создаваться // Создаем новую точку здесь, потому что если автозамену можно будет сделать классы сразу будут создаваться
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -4014,6 +4031,8 @@ CMathContent.prototype.private_CanAutoCorrectText = function(AutoCorrectionEngin ...@@ -4014,6 +4031,8 @@ CMathContent.prototype.private_CanAutoCorrectText = function(AutoCorrectionEngin
if (RemoveCount > 0) if (RemoveCount > 0)
{ {
var MathRun = new ParaRun(this.ParaMath.Paragraph, true); var MathRun = new ParaRun(this.ParaMath.Paragraph, true);
MathRun.Set_Pr(AutoCorrectionEngine.TextPr.Copy());
MathRun.Set_MathPr(AutoCorrectionEngine.MathPr.Copy());
for (var Index = 0, Count = ReplaceChars.length; Index < Count; Index++) for (var Index = 0, Count = ReplaceChars.length; Index < Count; Index++)
{ {
...@@ -4144,13 +4163,15 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE ...@@ -4144,13 +4163,15 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE
{ {
if (TempElements2.length > 0) if (TempElements2.length > 0)
{ {
var Fraction = new CFraction(new CMathFractionPr()); var props = new CMathFractionPr();
props.ctrPrp = AutoCorrectionEngine.TextPr.Copy();
var Fraction = new CFraction(props);
var DenMathContent = Fraction.Content[0]; var DenMathContent = Fraction.Content[0];
var NumMathContent = Fraction.Content[1]; var NumMathContent = Fraction.Content[1];
this.PackTextToContent(DenMathContent, TempElements2); this.PackTextToContent(DenMathContent, TempElements2, AutoCorrectionEngine);
this.PackTextToContent(NumMathContent, TempElements); this.PackTextToContent(NumMathContent, TempElements, AutoCorrectionEngine);
AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1; AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1;
AutoCorrectionEngine.ReplaceContent.push(Fraction); AutoCorrectionEngine.ReplaceContent.push(Fraction);
...@@ -4163,14 +4184,15 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE ...@@ -4163,14 +4184,15 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE
//if (TempElements2.length > 0) //if (TempElements2.length > 0)
//{ //{
var props = new CMathDegreePr(); var props = new CMathDegreePr();
props.ctrPrp = AutoCorrectionEngine.TextPr.Copy();
props.type = AutoCorrectionEngine.Kind; props.type = AutoCorrectionEngine.Kind;
var oDegree = new CDegree(props) var oDegree = new CDegree(props)
var BaseContent = oDegree.Content[0]; var BaseContent = oDegree.Content[0];
var IterContent = oDegree.Content[1]; var IterContent = oDegree.Content[1];
this.PackTextToContent(BaseContent, TempElements2); this.PackTextToContent(BaseContent, TempElements2, AutoCorrectionEngine);
this.PackTextToContent(IterContent, TempElements); this.PackTextToContent(IterContent, TempElements, AutoCorrectionEngine);
AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1; AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1;
AutoCorrectionEngine.ReplaceContent.push(oDegree); AutoCorrectionEngine.ReplaceContent.push(oDegree);
...@@ -4183,6 +4205,7 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE ...@@ -4183,6 +4205,7 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE
if (TempElements2.length > 0 || TempElements3.length > 0) if (TempElements2.length > 0 || TempElements3.length > 0)
{ {
var props = new CMathDegreePr(); var props = new CMathDegreePr();
props.ctrPrp = AutoCorrectionEngine.TextPr.Copy();
props.type = AutoCorrectionEngine.Kind; props.type = AutoCorrectionEngine.Kind;
var oDegree = new CDegreeSubSup(props) var oDegree = new CDegreeSubSup(props)
...@@ -4192,16 +4215,16 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE ...@@ -4192,16 +4215,16 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE
if (TempElements.Type == DEGREE_SUPERSCRIPT) if (TempElements.Type == DEGREE_SUPERSCRIPT)
{ {
this.PackTextToContent(IterUpContent, TempElements2); this.PackTextToContent(IterUpContent, TempElements2, AutoCorrectionEngine);
this.PackTextToContent(IterDnContent, TempElements); this.PackTextToContent(IterDnContent, TempElements, AutoCorrectionEngine);
} }
else if (TempElements.Type == DEGREE_SUBSCRIPT) else if (TempElements.Type == DEGREE_SUBSCRIPT)
{ {
this.PackTextToContent(IterUpContent, TempElements); this.PackTextToContent(IterUpContent, TempElements, AutoCorrectionEngine);
this.PackTextToContent(IterDnContent, TempElements2); this.PackTextToContent(IterDnContent, TempElements2, AutoCorrectionEngine);
} }
this.PackTextToContent(BaseContent, TempElements3); this.PackTextToContent(BaseContent, TempElements3, AutoCorrectionEngine);
AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1; AutoCorrectionEngine.RemoveCount = ElementsCount - CurPos - 1;
AutoCorrectionEngine.ReplaceContent.push(oDegree); AutoCorrectionEngine.ReplaceContent.push(oDegree);
...@@ -4212,7 +4235,7 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE ...@@ -4212,7 +4235,7 @@ CMathContent.prototype.private_CanAutoCorrectEquation = function(AutoCorrectionE
return false; return false;
}; };
CMathContent.prototype.PackTextToContent = function(Element, TempElements) CMathContent.prototype.PackTextToContent = function(Element, TempElements, AutoCorrectionEngine)
{ {
var len = TempElements.length; var len = TempElements.length;
if (len > 1) if (len > 1)
...@@ -4230,6 +4253,10 @@ CMathContent.prototype.PackTextToContent = function(Element, TempElements) ...@@ -4230,6 +4253,10 @@ CMathContent.prototype.PackTextToContent = function(Element, TempElements)
else else
{ {
var MathRun = new ParaRun(this.ParaMath.Paragraph, true); var MathRun = new ParaRun(this.ParaMath.Paragraph, true);
MathRun.Set_Pr(AutoCorrectionEngine.TextPr.Copy());
MathRun.Set_MathPr(AutoCorrectionEngine.MathPr.Copy());
var MathText = new CMathText(); var MathText = new CMathText();
MathText.add(TempElements[nPos].Text.charCodeAt(0)); MathText.add(TempElements[nPos].Text.charCodeAt(0));
MathRun.Add_ToContent(nPos, MathText); MathRun.Add_ToContent(nPos, MathText);
...@@ -4249,6 +4276,9 @@ function CMathAutoCorrectEngine(Element) ...@@ -4249,6 +4276,9 @@ function CMathAutoCorrectEngine(Element)
this.RemoveCount = 0; this.RemoveCount = 0;
this.ReplaceContent = []; this.ReplaceContent = [];
this.TextPr = null;
this.MathPr = null;
} }
CMathAutoCorrectEngine.prototype.Add_Element = function(Element, ElementPos) CMathAutoCorrectEngine.prototype.Add_Element = function(Element, ElementPos)
......
...@@ -444,6 +444,19 @@ CNary.prototype.Document_UpdateInterfaceState = function(MathProps) ...@@ -444,6 +444,19 @@ CNary.prototype.Document_UpdateInterfaceState = function(MathProps)
MathProps.Type = c_oAscMathInterfaceType.LargeOperator; MathProps.Type = c_oAscMathInterfaceType.LargeOperator;
MathProps.Pr = null; MathProps.Pr = null;
}; };
CNary.prototype.Is_ContentUse = function(MathContent)
{
if (MathContent === this.getBaseMathContent())
return true;
if (true !== this.Pr.subHide && MathContent === this.getSubMathContent())
return true;
if (true !== this.Pr.supHide && MathContent === this.getSupMathContent())
return true;
return false;
};
function CNaryUnd(bInside) function CNaryUnd(bInside)
......
...@@ -656,3 +656,14 @@ CRadical.prototype.Document_UpdateInterfaceState = function(MathProps) ...@@ -656,3 +656,14 @@ CRadical.prototype.Document_UpdateInterfaceState = function(MathProps)
MathProps.Type = c_oAscMathInterfaceType.Radical; MathProps.Type = c_oAscMathInterfaceType.Radical;
MathProps.Pr = null; MathProps.Pr = null;
}; };
CRadical.prototype.Is_ContentUse = function(MathContent)
{
if (MathContent === this.Content[1])
return true;
if(DEGREE_RADICAL === this.Pr.type && MathContent === this.Content[0])
return true;
return false;
};
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