Commit a1397636 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented moving cursor right/left in the new class CBlockLevelSdt.

parent 269b40de
This diff is collapsed.
This diff is collapsed.
......@@ -181,6 +181,10 @@ CDocumentContentElementBase.prototype.Is_SelectionUse = function()
{
return false;
};
CDocumentContentElementBase.prototype.IsSelectionToEnd = function()
{
return false;
};
CDocumentContentElementBase.prototype.Selection_Remove = function()
{
};
......@@ -284,6 +288,51 @@ CDocumentContentElementBase.prototype.GetNearestPos = function(CurPage, X, Y, bA
CDocumentContentElementBase.prototype.CanUpdateTarget = function(CurPage)
{
return false;
};
CDocumentContentElementBase.prototype.Cursor_MoveLeft = function(Count, AddToSelect, Word)
{
return false;
};
CDocumentContentElementBase.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
{
};
CDocumentContentElementBase.prototype.MoveCursorLeft = function(AddToSelect, Word)
{
return this.Cursor_MoveLeft(1, AddToSelect, Word);
};
CDocumentContentElementBase.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word)
{
return false;
};
CDocumentContentElementBase.prototype.MoveCursorRight = function(AddToSelect, Word)
{
return this.Cursor_MoveRight(1, AddToSelect, Word);
};
CDocumentContentElementBase.prototype.MoveCursorRightWithSelectionFromStart = function(Word)
{
};
CDocumentContentElementBase.prototype.Cursor_MoveToStartPos = function(AddToSelect)
{
};
CDocumentContentElementBase.prototype.MoveCursorToStartPos = function(AddToSelect)
{
return this.Cursor_MoveToStartPos(AddToSelect);
};
CDocumentContentElementBase.prototype.Cursor_MoveToEndPos = function(AddToSelect, StartSelectFromEnd)
{
};
CDocumentContentElementBase.prototype.MoveCursorToEndPos = function(AddToSelect, StartSelectFromEnd)
{
return this.Cursor_MoveToEndPos(AddToSelect, StartSelectFromEnd);
};
CDocumentContentElementBase.prototype.Get_SelectionState = function()
{
return [];
};
CDocumentContentElementBase.prototype.Set_SelectionState = function(State, StateIndex)
{
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
......
......@@ -364,7 +364,7 @@ CDocumentControllerBase.prototype.MoveCursorLeft = function(AddToSelect, Word){r
* @param {boolean} FromPaste Пришла ли данная комнда после "вставки"
* @returns {boolean} Получилось ли перемещение, или мы достигли предела.
*/
CDocumentControllerBase.prototype.MoveCursorRight = function(AddToSelect, Word, FromPaste){return false;};
CDocumentControllerBase.prototype.MoveCursorRight = function(AddToSelect, Word){return false;};
/**
* Смещаем курсор вверх.
* @param AddToSelect Добавлять ли к селекту смещение
......
......@@ -82,9 +82,9 @@ CLogicDocumentController.prototype.MoveCursorLeft = function(AddToSelect, Word)
{
return this.LogicDocument.controller_MoveCursorLeft(AddToSelect, Word);
};
CLogicDocumentController.prototype.MoveCursorRight = function(AddToSelect, Word, FromPaste)
CLogicDocumentController.prototype.MoveCursorRight = function(AddToSelect, Word)
{
return this.LogicDocument.controller_MoveCursorRight(AddToSelect, Word, FromPaste);
return this.LogicDocument.controller_MoveCursorRight(AddToSelect, Word);
};
CLogicDocumentController.prototype.MoveCursorUp = function(AddToSelect)
{
......
......@@ -4106,6 +4106,11 @@ Paragraph.prototype.Cursor_MoveLeft = function(Count, AddToSelect, Word)
return true;
};
Paragraph.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
{
this.MoveCursorToEndPos(true, true);
this.MoveCursorLeft(true, Word);
};
Paragraph.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word)
{
if (true === this.Selection.Use)
......@@ -4210,6 +4215,11 @@ Paragraph.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word)
return true;
};
Paragraph.prototype.MoveCursorRightWithSelectionFromStart = function(Word)
{
this.MoveCursorToStartPos(false);
this.MoveCursorRight(true, Word);
};
Paragraph.prototype.Cursor_MoveAt = function(X, Y, bLine, bDontChangeRealPos, CurPage)
{
var SearchPosXY = this.Get_ParaContentPosByXY(X, Y, CurPage, bLine, false);
......@@ -5188,6 +5198,10 @@ Paragraph.prototype.Is_SelectionUse = function()
{
return this.Selection.Use;
};
Paragraph.prototype.IsSelectionToEnd = function()
{
return this.Selection_CheckParaEnd();
};
/**
* Функция определяет начальную позицию курсора в параграфе
*/
......
......@@ -163,6 +163,10 @@ CBlockLevelSdt.prototype.Is_SelectionUse = function()
{
return this.Content.Is_SelectionUse();
};
CBlockLevelSdt.prototype.IsSelectionToEnd = function()
{
return this.Content.IsSelectionToEnd();
};
CBlockLevelSdt.prototype.Selection_Remove = function()
{
this.Content.Selection_Remove();
......@@ -219,6 +223,38 @@ CBlockLevelSdt.prototype.CanUpdateTarget = function(CurPage)
{
return this.Content.CanUpdateTatget(CurPage);
};
CBlockLevelSdt.prototype.Cursor_MoveLeft = function(Count, AddToSelect, Word)
{
return this.Content.Cursor_MoveLeft(AddToSelect, Word);
};
CBlockLevelSdt.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
{
return this.Content.MoveCursorLeftWithSelectionFromEnd(Word);
};
CBlockLevelSdt.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word)
{
return this.Content.Cursor_MoveRight(AddToSelect, Word, false);
};
CBlockLevelSdt.prototype.MoveCursorRightWithSelectionFromStart = function(Word)
{
return this.Content.MoveCursorRightWithSelectionFromStart(Word);
};
CBlockLevelSdt.prototype.Cursor_MoveToStartPos = function(AddToSelect)
{
return this.Content.Cursor_MoveToStartPos(AddToSelect);
};
CBlockLevelSdt.prototype.Cursor_MoveToEndPos = function(AddToSelect, StartSelectFromEnd)
{
return this.Content.Cursor_MoveToEndPos(AddToSelect, StartSelectFromEnd);
};
CBlockLevelSdt.prototype.Get_SelectionState = function()
{
return this.Content.Get_SelectionState();
};
CBlockLevelSdt.prototype.Set_SelectionState = function(State, StateIndex)
{
return this.Content.Set_SelectionState(State, StateIndex);
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr)
{
......@@ -294,6 +330,14 @@ CBlockLevelSdt.prototype.Get_ParentTextTransform = function()
{
return this.Parent.Get_ParentTextTransform();
};
CBlockLevelSdt.prototype.Set_CurrentElement = function(bUpdateStates, PageAbs, oDocContent)
{
if (oDocContent === this.Content)
{
this.Parent.Update_ContentIndexing();
this.Parent.Set_CurrentElement(this.Index, bUpdateStates);
}
};
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CBlockLevelSdt = CBlockLevelSdt;
......
......@@ -5146,7 +5146,7 @@ CTable.prototype.Select_All = function(nDirection)
/**
* В данной функции проверяется идет ли выделение таблицы до конца таблицы.
*/
CTable.prototype.Selection_IsToEnd = function()
CTable.prototype.IsSelectionToEnd = function()
{
if (true === this.ApplyToAll || (true === this.Selection.Use && table_Selection_Cell === this.Selection.Type && this.Selection.Data.length > 0))
{
......@@ -5615,6 +5615,36 @@ CTable.prototype.Cursor_MoveLeft = function(Count, AddToSelect, Word)
}
}
};
CTable.prototype.MoveCursorLeftWithSelectionFromEnd = function(Word)
{
if (true === this.IsSelectionUse())
this.RemoveSelection();
if (this.Content.length <= 0)
return;
var LastRow = this.Content[this.Content.length - 1];
// Нам нужно выделить последний ряд таблицы
this.Selection.Use = true;
this.Selection.Type = table_Selection_Cell;
this.Selection.StartPos.Pos = {
Row : LastRow.Index,
Cell : LastRow.Get_CellsCount() - 1
};
this.Selection.EndPos.Pos = {
Row : LastRow.Index,
Cell : 0
};
this.CurCell = LastRow.Get_Cell(0);
this.Selection.Data = [];
for (var CellIndex = 0; CellIndex < LastRow.Get_CellsCount(); CellIndex++)
{
this.Selection.Data.push({Cell : CellIndex, Row : LastRow.Index});
}
};
CTable.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word, FromPaste)
{
if (true === this.Selection.Use && this.Selection.Type === table_Selection_Cell)
......@@ -5746,6 +5776,35 @@ CTable.prototype.Cursor_MoveRight = function(Count, AddToSelect, Word, FromPaste
}
}
};
CTable.prototype.MoveCursorRightWithSelectionFromStart = function(Word)
{
if (true === this.IsSelectionUse())
this.RemoveSelection();
if (this.Content.length <= 0)
return;
var FirstRow = this.Content[0];
// Нам нужно выделить первый ряд таблицы
this.Selection.Use = true;
this.Selection.Type = table_Selection_Cell;
this.Selection.StartPos.Pos = {
Row : 0,
Cell : 0
};
this.Selection.EndPos.Pos = {
Row : 0,
Cell : FirstRow.Get_CellsCount() - 1
};
this.CurCell = FirstRow.Get_Cell(FirstRow.Get_CellsCount() - 1);
this.Selection.Data = [];
for (var CellIndex = 0; CellIndex < FirstRow.Get_CellsCount(); CellIndex++)
{
this.Selection.Data.push({Cell : CellIndex, Row : 0});
}
};
CTable.prototype.Cursor_MoveUp = function(Count, AddToSelect)
{
if (true === this.Selection.Use && table_Selection_Cell === this.Selection.Type)
......
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