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