Commit 31205f9b authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug #34312

parent 50faec32
......@@ -1525,7 +1525,7 @@ function CDocument(DrawingDocument, isMainLogicDocument)
this.StartTime = 0;
}
CDocument.prototype = Object.create(CDocumentContentBase.prototype);
CDocument.prototype = Object.create(CDocumentContentBase.prototype);
CDocument.prototype.constructor = CDocument;
CDocument.prototype.Init = function()
......@@ -12047,7 +12047,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
{
if (true === bOnTextAdd && type_Table === this.Content[StartPos + 1].Get_Type() && type_Table === this.Content[StartPos].Get_Type())
{
this.Internal_Content_Add(StartPos + 1, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos + 1, this.private_CreateNewParagraph());
this.CurPos.ContentPos = StartPos + 1;
this.Content[StartPos + 1].Cursor_MoveToStartPos();
}
......@@ -12075,7 +12075,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
this.Internal_Content_Remove(StartPos + 1, EndPos - StartPos - 1);
if (type_Table === this.Content[StartPos + 1].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos + 1, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos + 1, this.private_CreateNewParagraph());
// Встаем в начало параграфа
this.CurPos.ContentPos = StartPos + 1;
......@@ -12107,7 +12107,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
this.Internal_Content_Remove(StartPos, EndPos - StartPos);
if (type_Table === this.Content[StartPos].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos, this.private_CreateNewParagraph());
// Встаем в начало параграфа
this.CurPos.ContentPos = StartPos;
......@@ -12125,7 +12125,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
this.Internal_Content_Remove(StartPos, EndPos - StartPos);
if (type_Table === this.Content[StartPos].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos, this.private_CreateNewParagraph());
this.CurPos.ContentPos = StartPos;
this.Content[StartPos].Cursor_MoveToStartPos();
......@@ -12136,8 +12136,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
// При таком удалении надо убедиться, что в документе останется хотя бы один элемент
if (0 === StartPos && (EndPos - StartPos + 1) >= this.Content.length)
{
var NewPara = new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0);
this.Internal_Content_Add(0, NewPara);
this.Internal_Content_Add(0, this.private_CreateNewParagraph());
this.Internal_Content_Remove(1, this.Content.length - 1);
}
else
......@@ -12211,8 +12210,7 @@ CDocument.prototype.controller_Remove = function(Count, bOnlyText, bRemoveOnlySe
}
else if (this.Content.length === 1 && true === this.Content[0].IsEmpty() && Count > 0)
{
var NewPara = new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0);
this.Internal_Content_Add(0, NewPara);
this.Internal_Content_Add(0, this.private_CreateNewParagraph());
this.Internal_Content_Remove(1, this.Content.length - 1);
}
}
......
......@@ -151,7 +151,7 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
this.Save_StartState();
}
}
CDocumentContent.prototype = Object.create(CDocumentContentBase.prototype);
CDocumentContent.prototype = Object.create(CDocumentContentBase.prototype);
CDocumentContent.prototype.constructor = CDocumentContent;
CDocumentContent.prototype.Get_Id = function()
......@@ -2806,11 +2806,8 @@ CDocumentContent.prototype.Remove = function(Count,
{
if (true === this.ApplyToAll)
{
var oNewPara = new Paragraph(this.DrawingDocument, this, 0, this.X, this.Y, this.XLimit, this.YLimit, this.bPresentation === true);
oNewPara.Correct_Content();
this.Internal_Content_RemoveAll();
this.Internal_Content_Add(0, oNewPara);
this.Internal_Content_Add(0, this.private_CreateNewParagraph());
this.CurPos =
{
......@@ -2953,7 +2950,7 @@ CDocumentContent.prototype.Remove = function(Count,
{
if (true === bOnTextAdd && type_Table === this.Content[StartPos + 1].Get_Type() && type_Table === this.Content[StartPos].Get_Type())
{
this.Internal_Content_Add(StartPos + 1, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos + 1, this.private_CreateNewParagraph());
this.CurPos.ContentPos = StartPos + 1;
this.Content[StartPos + 1].Cursor_MoveToStartPos();
}
......@@ -2981,7 +2978,7 @@ CDocumentContent.prototype.Remove = function(Count,
this.Internal_Content_Remove(StartPos + 1, EndPos - StartPos - 1);
if (type_Table === this.Content[StartPos + 1].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos + 1, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos + 1, this.private_CreateNewParagraph());
// Встаем в начало параграфа
this.CurPos.ContentPos = StartPos + 1;
......@@ -3013,7 +3010,7 @@ CDocumentContent.prototype.Remove = function(Count,
this.Internal_Content_Remove(StartPos, EndPos - StartPos);
if (type_Table === this.Content[StartPos].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos, this.private_CreateNewParagraph());
// Встаем в начало параграфа
this.CurPos.ContentPos = StartPos;
......@@ -3031,7 +3028,7 @@ CDocumentContent.prototype.Remove = function(Count,
this.Internal_Content_Remove(StartPos, EndPos - StartPos);
if (type_Table === this.Content[StartPos].Get_Type() && true === bOnTextAdd)
this.Internal_Content_Add(StartPos, new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0));
this.Internal_Content_Add(StartPos, this.private_CreateNewParagraph());
this.CurPos.ContentPos = StartPos;
this.Content[StartPos].Cursor_MoveToStartPos();
......@@ -3042,8 +3039,7 @@ CDocumentContent.prototype.Remove = function(Count,
// При таком удалении надо убедиться, что в документе останется хотя бы один элемент
if (0 === StartPos && (EndPos - StartPos + 1) >= this.Content.length)
{
var NewPara = new Paragraph(this.DrawingDocument, this, 0, 0, 0, this.XLimit, this.YLimit, this.bPresentation === true);
this.Internal_Content_Add(0, NewPara);
this.Internal_Content_Add(0, this.private_CreateNewParagraph());
this.Internal_Content_Remove(1, this.Content.length - 1);
}
else
......@@ -3109,8 +3105,7 @@ CDocumentContent.prototype.Remove = function(Count,
}
else if (this.Content.length === 1 && true === this.Content[0].IsEmpty() && Count > 0)
{
var NewPara = new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0, this.bPresentation === true);
this.Internal_Content_Add(0, NewPara);
this.Internal_Content_Add(0, this.private_CreateNewParagraph());
this.Internal_Content_Remove(1, this.Content.length - 1);
}
}
......
......@@ -286,3 +286,10 @@ CDocumentContentBase.prototype.MoveCursorToNearestPos = function(oNearestPos)
oPara.Set_ParaContentPos(oNearestPos.ContentPos, true, -1, -1);
oPara.Document_SetThisElementCurrent(true);
};
CDocumentContentBase.prototype.private_CreateNewParagraph = function()
{
var oPara = new Paragraph(this.DrawingDocument, this, 0, 0, 0, 0, 0, this.bPresentation === true);
oPara.Correct_Content();
oPara.Cursor_MoveToStartPos(false);
return oPara;
};
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