Commit 93257a44 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

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

Исправлен баг с пересчетом последней точки истории, когда после пересчета добавлялись новые изменения и вызывался пересчет. Исправлен баги с неправильным очищением меток орфографии. Доработано Undo/Redo в новом варианте параграфа.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54891 954022d7-b5bf-4e40-9824-e11837661b57
parent 889713be
......@@ -1089,7 +1089,8 @@ CDocument.prototype =
// Увеличиваем номер пересчета
this.RecalcId++;
if ( true === Debug_ParaRunMode )
// Если задан параметр _RecalcData, тогда мы не можем ориентироваться на историю
if ( true === Debug_ParaRunMode && undefined === _RecalcData )
{
// Проверяем можно ли сделать быстрый пересчет
var SimpleChanges = History.Is_SimpleChanges();
......@@ -2011,9 +2012,7 @@ CDocument.prototype =
// Сначала удаляем заселекченую часть
if ( true === this.Selection.Use )
{
this.TurnOffRecalc = true;
this.Remove( 1, true );
this.TurnOffRecalc = false;
}
// Добавляем новый параграф
......
......@@ -159,6 +159,11 @@ CHistory.prototype =
if ( this.Index < 0 )
return;
// Заглушка на случай, если у нас во время создания одной точки в истории, после нескольких изменений идет
// пересчет, потом снова добавляются изменения и снова запускается пересчет и т.д.
if ( this.RecIndex >= this.Index )
this.RecIndex = this.Index - 1;
var Binary_Pos = this.BinaryWriter.GetCurPosition();
Class.Save_Changes( Data, this.BinaryWriter );
......@@ -359,8 +364,6 @@ CHistory.prototype =
{
if ( this.Index >= 0 )
{
var LastPoint = this.RecIndex;
this.Internal_RecalcData_Clear();
for ( var Pos = this.RecIndex + 1; Pos <= this.Index; Pos++ )
......
......@@ -1558,6 +1558,29 @@ ParaHyperlink.prototype =
var Type = Data.Type;
switch(Type)
{
case historyitem_Hyperlink_AddItem :
{
this.Content.splice( Data.Pos, Data.EndPos - Data.Pos + 1 );
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
break;
}
case historyitem_Hyperlink_RemoveItem :
{
var Pos = Data.Pos;
var Array_start = this.Content.slice( 0, Pos );
var Array_end = this.Content.slice( Pos );
this.Content = Array_start.concat( Data.Items, Array_end );
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
break;
}
case historyitem_Hyperlink_Value :
{
this.Value = Data.Old;
......@@ -1577,6 +1600,29 @@ ParaHyperlink.prototype =
var Type = Data.Type;
switch(Type)
{
case historyitem_Hyperlink_AddItem :
{
var Pos = Data.Pos;
var Array_start = this.Content.slice( 0, Pos );
var Array_end = this.Content.slice( Pos );
this.Content = Array_start.concat( Data.Items, Array_end );
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
break;
}
case historyitem_Hyperlink_RemoveItem :
{
this.Content.splice( Data.Pos, Data.EndPos - Data.Pos + 1 );
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
break;
}
case historyitem_Hyperlink_Value :
{
this.Value = Data.New;
......
......@@ -587,7 +587,6 @@ Paragraph.prototype =
}
// Обновлять позиции в NearestPos не надо, потому что мы добавляем новые элементы в конец массива
this.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
}
},
......@@ -5172,7 +5171,7 @@ Paragraph.prototype =
return Pos - Counter;
}
else
return 0;
return Pos;
},
Internal_Get_RealPos : function(Pos)
......@@ -5193,7 +5192,7 @@ Paragraph.prototype =
return Counter;
}
else
return 0;
return Pos;
},
Internal_Get_ClearContentLength : function()
......@@ -9095,9 +9094,6 @@ Paragraph.prototype =
}
else
{
// Удалим все лишние пустые раны из параграфа
this.Remove_EmptyRuns();
if ( true === this.ApplyToAll )
{
// Применяем настройки ко всем элементам параграфа
......@@ -18720,63 +18716,118 @@ Paragraph.prototype =
Get_SelectionState : function()
{
var ParaState = new Object();
ParaState.CurPos =
if ( true !== Debug_ParaRunMode )
{
X : this.CurPos.X,
Y : this.CurPos.Y,
Line : this.CurPos.Line,
ContentPos : this.Internal_Get_ClearPos(this.CurPos.ContentPos),
RealX : this.CurPos.RealX,
RealY : this.CurPos.RealY,
PagesPos : this.CurPos.PagesPos
};
var ParaState = new Object();
ParaState.CurPos =
{
X : this.CurPos.X,
Y : this.CurPos.Y,
Line : this.CurPos.Line,
ContentPos : this.Internal_Get_ClearPos(this.CurPos.ContentPos),
RealX : this.CurPos.RealX,
RealY : this.CurPos.RealY,
PagesPos : this.CurPos.PagesPos
};
ParaState.Selection =
ParaState.Selection =
{
Start : this.Selection.Start,
Use : this.Selection.Use,
StartPos : this.Internal_Get_ClearPos(this.Selection.StartPos),
EndPos : this.Internal_Get_ClearPos(this.Selection.EndPos),
StartPos : this.Internal_Get_ClearPos(this.Selection.StartPos2),
EndPos : this.Internal_Get_ClearPos(this.Selection.EndPos2),
Flag : this.Selection.Flag
};
return [ ParaState ];
}
else
{
Start : this.Selection.Start,
Use : this.Selection.Use,
StartPos : this.Internal_Get_ClearPos(this.Selection.StartPos),
EndPos : this.Internal_Get_ClearPos(this.Selection.EndPos),
StartPos : this.Internal_Get_ClearPos(this.Selection.StartPos2),
EndPos : this.Internal_Get_ClearPos(this.Selection.EndPos2),
Flag : this.Selection.Flag
};
var ParaState = new Object();
ParaState.CurPos =
{
X : this.CurPos.X,
Y : this.CurPos.Y,
Line : this.CurPos.Line,
ContentPos : this.Get_ParaContentPos( false, false ),
RealX : this.CurPos.RealX,
RealY : this.CurPos.RealY,
PagesPos : this.CurPos.PagesPos
};
ParaState.Selection =
{
Start : this.Selection.Start,
Use : this.Selection.Use,
StartPos : this.Get_ParaContentPos( true, true ),
EndPos : this.Get_ParaContentPos( true, false ),
Flag : this.Selection.Flag
};
return [ ParaState ];
return [ ParaState ];
}
},
Set_SelectionState : function(State, StateIndex)
{
if ( State.length <= 0 )
return;
if ( true !== Debug_ParaRunMode )
{
if ( State.length <= 0 )
return;
var ParaState = State[StateIndex];
this.CurPos =
{
X : ParaState.CurPos.X,
Y : ParaState.CurPos.Y,
Line : ParaState.CurPos.Line,
ContentPos : this.Internal_Get_RealPos(ParaState.CurPos.ContentPos),
RealX : ParaState.CurPos.RealX,
RealY : ParaState.CurPos.RealY,
PagesPos : ParaState.CurPos.PagesPos
};
var ParaState = State[StateIndex];
this.Selection.Start = ParaState.Selection.Start;
this.Selection.Use = ParaState.Selection.Use;
this.Selection.StartPos = this.Internal_Get_RealPos(ParaState.Selection.StartPos);
this.Selection.EndPos = this.Internal_Get_RealPos(ParaState.Selection.EndPos);
this.Selection.StartPos2 = this.Internal_Get_RealPos(ParaState.Selection.StartPos2);
this.Selection.EndPos2 = this.Internal_Get_RealPos(ParaState.Selection.EndPos2);
this.CurPos =
var CursorPos_max = this.Internal_GetEndPos();
var CursorPos_min = this.Internal_GetStartPos();
this.Set_ContentPos( Math.max( CursorPos_min, Math.min( CursorPos_max, this.CurPos.ContentPos ) ) );
this.Selection.StartPos = Math.max( CursorPos_min, Math.min( CursorPos_max, this.Selection.StartPos ) );
}
else
{
X : ParaState.CurPos.X,
Y : ParaState.CurPos.Y,
Line : ParaState.CurPos.Line,
ContentPos : this.Internal_Get_RealPos(ParaState.CurPos.ContentPos),
RealX : ParaState.CurPos.RealX,
RealY : ParaState.CurPos.RealY,
PagesPos : ParaState.CurPos.PagesPos
};
if ( State.length <= 0 )
return;
this.Selection.Start = ParaState.Selection.Start;
this.Selection.Use = ParaState.Selection.Use;
this.Selection.StartPos = this.Internal_Get_RealPos(ParaState.Selection.StartPos);
this.Selection.EndPos = this.Internal_Get_RealPos(ParaState.Selection.EndPos);
this.Selection.StartPos2 = this.Internal_Get_RealPos(ParaState.Selection.StartPos2);
this.Selection.EndPos2 = this.Internal_Get_RealPos(ParaState.Selection.EndPos2);
var ParaState = State[StateIndex];
var CursorPos_max = this.Internal_GetEndPos();
var CursorPos_min = this.Internal_GetStartPos();
this.CurPos.X = ParaState.CurPos.X;
this.CurPos.Y = ParaState.CurPos.Y;
this.CurPos.Line = ParaState.CurPos.Line;
this.CurPos.RealX = ParaState.CurPos.RealX;
this.CurPos.RealY = ParaState.CurPos.RealY;
this.CurPos.PagesPos = ParaState.CurPos.PagesPos;
this.Set_ParaContentPos(ParaState.CurPos.ContentPos, true, -1, -1);
this.Set_ContentPos( Math.max( CursorPos_min, Math.min( CursorPos_max, this.CurPos.ContentPos ) ) );
this.Selection.StartPos = Math.max( CursorPos_min, Math.min( CursorPos_max, this.Selection.StartPos ) );
this.Selection.EndPos = Math.max( CursorPos_min, Math.min( CursorPos_max, this.Selection.EndPos ) );
this.Selection_Remove();
this.Selection.Start = ParaState.Selection.Start;
this.Selection.Use = ParaState.Selection.Use;
this.Selection.Flag = ParaState.Selection.Flag;
if ( true === this.Selection.Use )
this.Set_SelectionContentPos( ParaState.Selection.StartPos, ParaState.Selection.EndPos )
}
},
Get_ParentObject_or_DocumentPos : function()
......
This diff is collapsed.
......@@ -121,22 +121,25 @@ CParaSpellChecker.prototype =
{
Clear : function()
{
var Count = this.Elements.length;
for (var Index = 0; Index < Count; Index++)
if ( true === Debug_ParaRunMode )
{
var Element = this.Elements[Index];
var Count = this.Elements.length;
var Count2 = Element.ClassesS.length;
for ( var Index2 = 1; Index2 < Count2; Index2++ )
for (var Index = 0; Index < Count; Index++)
{
Element.ClassesS[Index2].Clear_SpellingMarks();
}
var Element = this.Elements[Index];
Count2 = Element.ClassesE.length;
for ( var Index2 = 1; Index2 < Count2; Index2++ )
{
Element.ClassesE[Index2].Clear_SpellingMarks();
var Count2 = Element.ClassesS.length;
for ( var Index2 = 1; Index2 < Count2; Index2++ )
{
Element.ClassesS[Index2].Clear_SpellingMarks();
}
Count2 = Element.ClassesE.length;
for ( var Index2 = 1; Index2 < Count2; Index2++ )
{
Element.ClassesE[Index2].Clear_SpellingMarks();
}
}
}
......@@ -1081,8 +1084,8 @@ Paragraph.prototype.Continue_CheckSpelling = function()
else
{
var OldElements = this.SpellChecker.Elements;
this.SpellChecker.Clear();
this.SpellChecker.Elements = new Array();
var SpellCheckerEngine = new CParagraphSpellCheckerEngine( this.SpellChecker );
var ContentLen = this.Content.length;
......@@ -1175,6 +1178,8 @@ Paragraph.prototype.Add_SpellCheckerElement = function(Element)
//----------------------------------------------------------------------------------------------------------------------
ParaRun.prototype.Check_Spelling = function(SpellCheckerEngine, Depth)
{
this.SpellingMarks = new Array();
// Пропускаем пустые раны
if ( true === this.Is_Empty() )
return;
......@@ -1268,6 +1273,8 @@ ParaRun.prototype.Clear_SpellingMarks = function()
//----------------------------------------------------------------------------------------------------------------------
ParaHyperlink.prototype.Check_Spelling = function(SpellCheckerEngine, Depth)
{
this.SpellingMarks = new Array();
var ContentLen = this.Content.length;
for ( var Pos = 0; Pos < ContentLen; Pos++ )
{
......
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