Commit 0368504a authored by Ilya Kirillov's avatar Ilya Kirillov

Continue implementing a CBlockLevelSdt class.

parent 4dc67f23
...@@ -3632,13 +3632,13 @@ function CEditorPage(api) ...@@ -3632,13 +3632,13 @@ function CEditorPage(api)
}; };
this.onTimerScroll2 = function(is_no_timer) this.onTimerScroll2 = function(is_no_timer)
{ {
try // try
{ // {
oThis.onTimerScroll2_internal(is_no_timer); oThis.onTimerScroll2_internal(is_no_timer);
} // }
catch (err) // catch (err)
{ // {
} // }
if (true !== is_no_timer) if (true !== is_no_timer)
this.m_nPaintTimerId = setTimeout(oThis.onTimerScroll2, oThis.m_nTimerScrollInterval); this.m_nPaintTimerId = setTimeout(oThis.onTimerScroll2, oThis.m_nTimerScrollInterval);
......
...@@ -5296,8 +5296,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent) ...@@ -5296,8 +5296,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var TempLimit = Math.min(this.Selection.StartPos, this.Selection.EndPos); var TempLimit = Math.min(this.Selection.StartPos, this.Selection.EndPos);
for (var Index = OldEndPos; Index < TempLimit; Index++) for (var Index = OldEndPos; Index < TempLimit; Index++)
{ {
this.Content[Index].Selection.Use = false; this.Content[Index].RemoveSelection();
this.Content[Index].Selection.Start = false;
} }
} }
else if (OldEndPos > this.Selection.StartPos && OldEndPos > this.Selection.EndPos) else if (OldEndPos > this.Selection.StartPos && OldEndPos > this.Selection.EndPos)
...@@ -5305,8 +5304,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent) ...@@ -5305,8 +5304,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var TempLimit = Math.max(this.Selection.StartPos, this.Selection.EndPos); var TempLimit = Math.max(this.Selection.StartPos, this.Selection.EndPos);
for (var Index = TempLimit + 1; Index <= OldEndPos; Index++) for (var Index = TempLimit + 1; Index <= OldEndPos; Index++)
{ {
this.Content[Index].Selection.Use = false; this.Content[Index].RemoveSelection();
this.Content[Index].Selection.Start = false;
} }
} }
...@@ -5331,7 +5329,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent) ...@@ -5331,7 +5329,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var ElementPageIndex = this.private_GetElementPageIndexByXY(this.Selection.StartPos, X, Y, this.CurPage); var ElementPageIndex = this.private_GetElementPageIndexByXY(this.Selection.StartPos, X, Y, this.CurPage);
Item.Selection_SetEnd(X, Y, ElementPageIndex, MouseEvent); Item.Selection_SetEnd(X, Y, ElementPageIndex, MouseEvent);
if (false === Item.Selection.Use) if (false === Item.IsSelectionUse())
{ {
this.Selection.Use = false; this.Selection.Use = false;
...@@ -5367,86 +5365,29 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent) ...@@ -5367,86 +5365,29 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
// TODO: Разрулить пустой селект // TODO: Разрулить пустой селект
// Чтобы не было эффекта, когда ничего не поселекчено, а при удалении соединяются параграфы // Чтобы не было эффекта, когда ничего не поселекчено, а при удалении соединяются параграфы
for (var Index = Start; Index <= End; Index++) for (var Index = Start; Index <= End; Index++)
{ {
var Item = this.Content[Index]; var Item = this.Content[Index];
Item.Selection.Use = true; Item.SetSelectionUse(true);
var ItemType = Item.GetType();
switch (Index)
{
case Start:
if (type_Paragraph === ItemType)
{
Item.Selection_SetBegEnd(( Direction > 0 ? false : true ), false);
}
else //if ( type_Table === ItemType )
{
var Row = Item.Content.length - 1;
var Cell = Item.Content[Row].Get_CellsCount() - 1;
var Pos = {Row : Row, Cell : Cell};
if (Direction > 0)
Item.Selection.EndPos.Pos = Pos;
else
Item.Selection.StartPos.Pos = Pos;
Item.Internal_Selection_UpdateCells();
}
break;
case End:
if (type_Paragraph === ItemType)
{
Item.Selection_SetBegEnd(( Direction > 0 ? true : false ), true);
}
else //if ( type_Table === ItemType )
{
var Pos = {Row : 0, Cell : 0};
if (Direction > 0)
Item.Selection.StartPos.Pos = Pos;
else
Item.Selection.EndPos.Pos = Pos;
Item.Internal_Selection_UpdateCells();
}
break; switch (Index)
{
case Start:
default: Item.SetSelectionToBeginEnd(Direction > 0 ? false : true, false);
break;
if (type_Paragraph === ItemType) case End:
{
Item.Select_All(Direction);
}
else //if ( type_Table === ItemType )
{
var Row = Item.Content.length - 1;
var Cell = Item.Content[Row].Get_CellsCount() - 1;
var Pos0 = {Row : 0, Cell : 0};
var Pos1 = {Row : Row, Cell : Cell};
if (Direction > 0) Item.SetSelectionToBeginEnd(Direction > 0 ? true : false, true);
{ break;
Item.Selection.StartPos.Pos = Pos0;
Item.Selection.EndPos.Pos = Pos1;
}
else
{
Item.Selection.EndPos.Pos = Pos0;
Item.Selection.StartPos.Pos = Pos1;
}
Item.Internal_Selection_UpdateCells(); default:
}
break; Item.SelectAll(Direction);
} break;
} }
}
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage); var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage);
this.Content[ContentPos].Selection_SetEnd(X, Y, ElementPageIndex, MouseEvent); this.Content[ContentPos].Selection_SetEnd(X, Y, ElementPageIndex, MouseEvent);
...@@ -5454,13 +5395,13 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent) ...@@ -5454,13 +5395,13 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
// Проверяем, чтобы у нас в селект не попали элементы, в которых не выделено ничего // Проверяем, чтобы у нас в селект не попали элементы, в которых не выделено ничего
if (true === this.Content[End].Selection_IsEmpty() && true === this.CheckEmptyElementsOnSelection) if (true === this.Content[End].Selection_IsEmpty() && true === this.CheckEmptyElementsOnSelection)
{ {
this.Content[End].Selection_Remove(); this.Content[End].RemoveSelection();
End--; End--;
} }
if (Start != End && true === this.Content[Start].Selection_IsEmpty() && true === this.CheckEmptyElementsOnSelection) if (Start != End && true === this.Content[Start].Selection_IsEmpty() && true === this.CheckEmptyElementsOnSelection)
{ {
this.Content[Start].Selection_Remove(); this.Content[Start].RemoveSelection();
Start++; Start++;
} }
...@@ -14910,11 +14851,11 @@ CDocument.prototype.controller_GetCurrentTextPr = function() ...@@ -14910,11 +14851,11 @@ CDocument.prototype.controller_GetCurrentTextPr = function()
EndPos = Temp; EndPos = Temp;
} }
VisTextPr = this.Content[StartPos].Get_Paragraph_TextPr(); VisTextPr = this.Content[StartPos].GetParagraphTextPr();
for (var Index = StartPos + 1; Index <= EndPos; Index++) for (var Index = StartPos + 1; Index <= EndPos; Index++)
{ {
var CurPr = this.Content[Index].Get_Paragraph_TextPr(); var CurPr = this.Content[Index].GetParagraphTextPr();
VisTextPr = VisTextPr.Compare(CurPr); VisTextPr = VisTextPr.Compare(CurPr);
} }
...@@ -14943,7 +14884,7 @@ CDocument.prototype.controller_GetCurrentTextPr = function() ...@@ -14943,7 +14884,7 @@ CDocument.prototype.controller_GetCurrentTextPr = function()
} }
else else
{ {
Result_TextPr = this.Content[this.CurPos.ContentPos].Get_Paragraph_TextPr(); Result_TextPr = this.Content[this.CurPos.ContentPos].GetParagraphTextPr();
} }
return Result_TextPr; return Result_TextPr;
...@@ -15906,12 +15847,12 @@ CDocument.prototype.controller_CanAddHyperlink = function(bCheckInHyperlink) ...@@ -15906,12 +15847,12 @@ CDocument.prototype.controller_CanAddHyperlink = function(bCheckInHyperlink)
if (this.Selection.StartPos != this.Selection.EndPos) if (this.Selection.StartPos != this.Selection.EndPos)
return false; return false;
return this.Content[this.Selection.StartPos].Hyperlink_CanAdd(bCheckInHyperlink); return this.Content[this.Selection.StartPos].CanAddHyperlink(bCheckInHyperlink);
} }
} }
else else
{ {
return this.Content[this.CurPos.ContentPos].Hyperlink_CanAdd(bCheckInHyperlink); return this.Content[this.CurPos.ContentPos].CanAddHyperlink(bCheckInHyperlink);
} }
return false; return false;
......
This diff is collapsed.
...@@ -173,6 +173,50 @@ CDocumentContentElementBase.prototype.Document_UpdateRulersState = function(CurP ...@@ -173,6 +173,50 @@ CDocumentContentElementBase.prototype.Document_UpdateRulersState = function(CurP
{ {
this.Content.Document_UpdateRulersState(CurPage); this.Content.Document_UpdateRulersState(CurPage);
}; };
CDocumentContentElementBase.prototype.IsSelectionUse = function()
{
return this.Is_SelectionUse();
};
CDocumentContentElementBase.prototype.Is_SelectionUse = function()
{
return false;
};
CDocumentContentElementBase.prototype.Selection_Remove = function()
{
};
CDocumentContentElementBase.prototype.RemoveSelection = function()
{
this.Selection_Remove();
};
CDocumentContentElementBase.prototype.SetSelectionUse = function(isUse)
{
};
CDocumentContentElementBase.prototype.SetSelectionToBeginEnd = function(isSelectionStart, isElementStart)
{
};
CDocumentContentElementBase.prototype.Select_All = function(nDirection)
{
};
CDocumentContentElementBase.prototype.SelectAll = function(nDirection)
{
this.Select_All(nDirection);
};
CDocumentContentElementBase.prototype.Get_Paragraph_TextPr = function()
{
return new CTextPr();
};
CDocumentContentElementBase.prototype.GetParagraphTextPr = function()
{
return this.Get_Paragraph_TextPr();
};
CDocumentContentElementBase.prototype.Hyperlink_CanAdd = function(bCheckInHyperlink)
{
return false;
};
CDocumentContentElementBase.prototype.CanAddHyperlink = function(bCheckInHyperlink)
{
return this.Hyperlink_CanAdd(bCheckInHyperlink);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц // Функции для работы с номерами страниц
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
......
...@@ -6493,6 +6493,17 @@ Paragraph.prototype.Selection_SetBegEnd = function(StartSelection, StartPara) ...@@ -6493,6 +6493,17 @@ Paragraph.prototype.Selection_SetBegEnd = function(StartSelection, StartPara)
this.Set_SelectionContentPos(this.Get_ParaContentPos(true, true), ContentPos); this.Set_SelectionContentPos(this.Get_ParaContentPos(true, true), ContentPos);
} }
}; };
Paragraph.prototype.SetSelectionUse = function(isUse)
{
if (true === isUse)
this.Selection.Use = true;
else
this.RemoveSelection();
};
Paragraph.prototype.SetSelectionToBeginEnd = function(isSelectionStart, isElementStart)
{
this.Selection_SetBegEnd(isSelectionStart, isElementStart);
};
Paragraph.prototype.Select_All = function(Direction) Paragraph.prototype.Select_All = function(Direction)
{ {
var Count = this.Content.length; var Count = this.Content.length;
......
...@@ -159,6 +159,34 @@ CBlockLevelSdt.prototype.Document_UpdateRulersState = function(CurPage) ...@@ -159,6 +159,34 @@ CBlockLevelSdt.prototype.Document_UpdateRulersState = function(CurPage)
{ {
this.Content.Document_UpdateRulersState(CurPage); this.Content.Document_UpdateRulersState(CurPage);
}; };
CBlockLevelSdt.prototype.Is_SelectionUse = function()
{
return this.Content.Is_SelectionUse();
};
CBlockLevelSdt.prototype.Selection_Remove = function()
{
this.Content.Selection_Remove();
};
CBlockLevelSdt.prototype.SetSelectionUse = function(isUse)
{
this.Content.SetSelectionUse(isUse);
};
CBlockLevelSdt.prototype.SetSelectionToBeginEnd = function(isSelectionStart, isElementStart)
{
this.Content.SetSelectionToBeginEnd(isSelectionStart, isElementStart);
};
CBlockLevelSdt.prototype.Select_All = function(nDirection)
{
this.Content.Select_All(nDirection);
};
CBlockLevelSdt.prototype.Get_Paragraph_TextPr = function()
{
return this.Content.Get_Paragraph_TextPr();
};
CBlockLevelSdt.prototype.Hyperlink_CanAdd = function(bCheckInHyperlink)
{
return this.Content.Hyperlink_CanAdd(bCheckInHyperlink);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr) CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr)
{ {
......
...@@ -5165,6 +5165,38 @@ CTable.prototype.Selection_IsToEnd = function() ...@@ -5165,6 +5165,38 @@ CTable.prototype.Selection_IsToEnd = function()
else else
return false; return false;
}; };
CTable.prototype.SetSelectionUse = function(isUse)
{
if (true === isUse)
this.Selection.Use = true;
else
this.RemoveSelection();
};
CTable.prototype.SetSelectionToBeginEnd = function(isSelectionStart, isElementStart)
{
if (false === isElementStart)
{
var Row = this.Content.length - 1;
var Cell = this.Content[Row].Get_CellsCount() - 1;
var Pos = {Row : Row, Cell : Cell};
if (isSelectionStart > 0)
this.Selection.EndPos.Pos = Pos;
else
this.Selection.StartPos.Pos = Pos;
}
else
{
var Pos = {Row : 0, Cell : 0};
if (isSelectionStart > 0)
this.Selection.StartPos.Pos = Pos;
else
this.Selection.EndPos.Pos = Pos;
}
this.Internal_Selection_UpdateCells();
};
CTable.prototype.Cursor_MoveToStartPos = function(AddToSelect) CTable.prototype.Cursor_MoveToStartPos = function(AddToSelect)
{ {
if (true === AddToSelect) if (true === AddToSelect)
......
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