Commit ade2026b authored by Ilya Kirillov's avatar Ilya Kirillov

From now in filling form mode the user can't place the cursor outside the form.

parent 3f2fd7d2
......@@ -6441,6 +6441,7 @@ CDocument.prototype.OnKeyDown = function(e)
}
}
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 34) // PgDn
......@@ -6550,6 +6551,7 @@ CDocument.prototype.OnKeyDown = function(e)
}
}
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 35) // клавиша End
......@@ -6566,6 +6568,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 36) // клавиша Home
......@@ -6582,6 +6585,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 37) // Left Arrow
......@@ -6592,6 +6596,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.DrawingDocument.UpdateTargetFromPaint = true;
this.MoveCursorLeft(true === e.ShiftKey, true === e.CtrlKey);
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 38) // Top Arrow
......@@ -6603,6 +6608,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.DrawingDocument.UpdateTargetFromPaint = true;
this.MoveCursorUp(true === e.ShiftKey, true === e.CtrlKey);
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 39) // Right Arrow
......@@ -6613,6 +6619,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.DrawingDocument.UpdateTargetFromPaint = true;
this.MoveCursorRight(true === e.ShiftKey, true === e.CtrlKey);
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 40) // Bottom Arrow
......@@ -6624,6 +6631,7 @@ CDocument.prototype.OnKeyDown = function(e)
this.DrawingDocument.UpdateTargetFromPaint = true;
this.MoveCursorDown(true === e.ShiftKey, true === e.CtrlKey);
this.private_CheckCursorPosInFillingFormMode();
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 46) // Delete
......@@ -7318,6 +7326,8 @@ CDocument.prototype.OnMouseUp = function(e, X, Y, PageIndex)
}
}
this.private_CheckCursorPosInFillingFormMode();
this.private_UpdateCursorXY(true, true);
};
CDocument.prototype.OnMouseMove = function(e, X, Y, PageIndex)
......@@ -15133,9 +15143,6 @@ CDocument.prototype.IsInFormField = function()
var oInlineSdt = oSelectedInfo.GetInlineLevelSdt();
var oBlockSdt = oSelectedInfo.GetBlockLevelSdt();
if (oSelectedInfo.Is_MixedSelection())
return false;
return (oBlockSdt || oInlineSdt || (oField && fieldtype_FORMTEXT === oField.Get_FieldType())) ? true : false;
};
CDocument.prototype.IsFormFieldEditing = function()
......@@ -15267,6 +15274,15 @@ CDocument.prototype.CanEdit = function()
return true;
};
CDocument.prototype.private_CheckCursorPosInFillingFormMode = function()
{
if (this.IsFillingFormMode() && !this.IsInFormField())
{
this.MoveToFillingForm(true);
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
}
};
function CDocumentSelectionState()
{
......
......@@ -295,29 +295,25 @@ ParaField.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseCon
};
ParaField.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
if (true !== SearchPos.Found && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_StartPos(SearchPos.Pos, Depth);
SearchPos.UpdatePos = true;
SearchPos.Found = true;
return true;
}
return bResult;
};
ParaField.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
if (true !== SearchPos.Found && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_EndPos(false, SearchPos.Pos, Depth);
SearchPos.UpdatePos = true;
SearchPos.Found = true;
return true;
}
return bResult;
};
//----------------------------------------------------------------------------------------------------------------------
// Работа с данными поля
......
......@@ -276,7 +276,11 @@ CBlockLevelSdt.prototype.CanUpdateTarget = function(CurPage)
};
CBlockLevelSdt.prototype.MoveCursorLeft = function(AddToSelect, Word)
{
return this.Content.MoveCursorLeft(AddToSelect, Word);
var bResult = this.Content.MoveCursorLeft(AddToSelect, Word);
if (!bResult && this.LogicDocument.IsFillingFormMode())
return true;
return bResult;
};
CBlockLevelSdt.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
{
......@@ -284,7 +288,11 @@ CBlockLevelSdt.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
};
CBlockLevelSdt.prototype.MoveCursorRight = function(AddToSelect, Word)
{
return this.Content.MoveCursorRight(AddToSelect, Word, false);
var bResult = this.Content.MoveCursorRight(AddToSelect, Word, false);
if (!bResult && this.LogicDocument.IsFillingFormMode())
return true;
return bResult;
};
CBlockLevelSdt.prototype.MoveCursorRightWithSelectionFromStart = function(Word)
{
......
......@@ -144,7 +144,16 @@ CInlineLevelSdt.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, U
return true;
}
CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_StartPos(SearchPos.Pos, Depth);
SearchPos.Found = true;
return true;
}
return bResult;
};
CInlineLevelSdt.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
......@@ -157,7 +166,16 @@ CInlineLevelSdt.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth,
return true;
}
CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_EndPos(false, SearchPos.Pos, Depth);
SearchPos.Found = true;
return true;
}
return bResult;
};
CInlineLevelSdt.prototype.Remove = function(nDirection, bOnAddText)
{
......@@ -188,29 +206,27 @@ CInlineLevelSdt.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
};
CInlineLevelSdt.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this, SearchPos, ContentPos, Depth, UseContentPos);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument)
if (true !== SearchPos.Found && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_StartPos(SearchPos.Pos, Depth);
SearchPos.UpdatePos = true;
SearchPos.Found = true;
return true;
}
return bResult;
}
};
CInlineLevelSdt.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
var bResult = CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
if (true !== bResult && this.Paragraph && this.Paragraph.LogicDocument)
if (true !== SearchPos.Found && this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.IsFillingFormMode())
{
this.Get_EndPos(false, SearchPos.Pos, Depth);
SearchPos.UpdatePos = true;
SearchPos.Found = true;
return true;
}
return bResult;
}
};
CInlineLevelSdt.prototype.GetBoundingPolygon = function()
{
......
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