Commit 36d2da39 authored by Ilya Kirillov's avatar Ilya Kirillov

Test variant of restricted moving cursor in filling forms mode.

parent 817629d2
...@@ -4334,13 +4334,21 @@ CDocument.prototype.Cursor_MoveUp = function(AddToSelect) ...@@ -4334,13 +4334,21 @@ CDocument.prototype.Cursor_MoveUp = function(AddToSelect)
{ {
this.Reset_WordSelection(); this.Reset_WordSelection();
this.private_UpdateTargetForCollaboration(); this.private_UpdateTargetForCollaboration();
this.Controller.MoveCursorUp(AddToSelect);
if (true === this.IsFillingFormMode())
this.MoveToFillingForm(false);
else
this.Controller.MoveCursorUp(AddToSelect);
}; };
CDocument.prototype.Cursor_MoveDown = function(AddToSelect) CDocument.prototype.Cursor_MoveDown = function(AddToSelect)
{ {
this.Reset_WordSelection(); this.Reset_WordSelection();
this.private_UpdateTargetForCollaboration(); this.private_UpdateTargetForCollaboration();
this.Controller.MoveCursorDown(AddToSelect);
if (true === this.IsFillingFormMode())
this.MoveToFillingForm(true);
else
this.Controller.MoveCursorDown(AddToSelect);
}; };
CDocument.prototype.Cursor_MoveEndOfLine = function(AddToSelect) CDocument.prototype.Cursor_MoveEndOfLine = function(AddToSelect)
{ {
...@@ -16079,6 +16087,57 @@ CDocument.prototype.IsFormFieldEditing = function() ...@@ -16079,6 +16087,57 @@ CDocument.prototype.IsFormFieldEditing = function()
return false; return false;
}; };
CDocument.prototype.MoveToFillingForm = function(bNext)
{
var arrAllFields = this.GetAllFormTextFields();
if (arrAllFields.length <= 0)
return;
this.Selection_Remove();
var oInfo = this.Get_SelectedElementsInfo();
var oField = oInfo.Get_Field();
var oForm = null;
if (!oField || !oField.IsFillingForm())
{
oForm = arrAllFields[0];
}
else
{
for (var nIndex = 0, nCount = arrAllFields.length; nIndex < nCount; ++nIndex)
{
if (oField === arrAllFields[nIndex])
{
if (bNext)
{
if (nIndex < nCount - 1)
oForm = arrAllFields[nIndex + 1];
else
oForm = arrAllFields[0];
}
else
{
if (nIndex > 0)
oForm = arrAllFields[0];
else
oForm = arrAllFields[nCount - 1];
}
break;
}
}
}
if (oForm)
{
oForm.Cursor_MoveToStartPos();
if (oForm.Content.length >= 0 && para_Run === oForm.Content[0].Type)
oForm.Content[0].Make_ThisElementCurrent();
this.Document_UpdateInterfaceState();
this.Document_UpdateSelectionState();
}
};
function CDocumentSelectionState() function CDocumentSelectionState()
{ {
......
...@@ -325,6 +325,58 @@ ParaField.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange) ...@@ -325,6 +325,58 @@ ParaField.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
oRangeBounds.Y1 += Dy; oRangeBounds.Y1 += Dy;
} }
}; };
ParaField.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
var bResult = ParaField.superclass.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;
};
ParaField.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
var bResult = ParaField.superclass.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;
};
ParaField.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
var bResult = ParaField.superclass.Get_WordStartPos.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;
};
ParaField.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
var bResult = ParaField.superclass.Get_WordEndPos.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;
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Работа с данными поля // Работа с данными поля
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
...@@ -486,6 +538,13 @@ ParaField.prototype.SetValue = function(sValue) ...@@ -486,6 +538,13 @@ ParaField.prototype.SetValue = function(sValue)
this.Add_ToContent(0, oRun); this.Add_ToContent(0, oRun);
this.Cursor_MoveToStartPos(); this.Cursor_MoveToStartPos();
}; };
ParaField.prototype.IsFillingForm = function()
{
if (fieldtype_FORMTEXT === this.Get_FieldType())
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