Commit 2d39ad5b authored by Ilya.Kirillov's avatar Ilya.Kirillov

Реализованы хоткеи Ctrl+L/R/E/J, когда мы находимся в неинлайн формуле (баг...

Реализованы хоткеи Ctrl+L/R/E/J, когда мы находимся в неинлайн формуле (баг 30860). Исправлен баг с неправильной работой селекта при выставлении текстовых настроек (баг 30697).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66399 954022d7-b5bf-4e40-9824-e11837661b57
parent ddab33d2
......@@ -10125,17 +10125,8 @@ CDocument.prototype =
{
if ( true !== e.AltKey ) // Ctrl + E - переключение прилегания параграфа между center и left
{
var ParaPr = this.Get_Paragraph_ParaPr();
if ( null != ParaPr )
{
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey);
this.Set_ParagraphAlign( ParaPr.Jc === align_Center ? align_Left : align_Center );
this.Document_UpdateInterfaceState();
}
bRetValue = keydownresult_PreventAll;
}
this.private_ToggleParagraphAlignByHotkey(align_Center);
bRetValue = keydownresult_PreventAll;
}
else // Ctrl + Alt + E - добавляем знак евро €
{
......@@ -10166,17 +10157,8 @@ CDocument.prototype =
}
else if ( e.KeyCode == 74 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + J переключение прилегания параграфа между justify и left
{
var ParaPr = this.Get_Paragraph_ParaPr();
if ( null != ParaPr )
{
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey2);
this.Set_ParagraphAlign( ParaPr.Jc === align_Justify ? align_Left : align_Justify );
this.Document_UpdateInterfaceState();
}
bRetValue = keydownresult_PreventAll;
}
this.private_ToggleParagraphAlignByHotkey(align_Justify);
bRetValue = keydownresult_PreventAll;
}
else if ( e.KeyCode == 75 && false === editor.isViewMode && true === e.CtrlKey && false === e.ShiftKey ) // Ctrl + K - добавление гиперссылки
{
......@@ -10199,17 +10181,8 @@ CDocument.prototype =
}
else // Ctrl + L - переключение прилегания параграфа между left и justify
{
var ParaPr = this.Get_Paragraph_ParaPr();
if ( null != ParaPr )
{
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey3);
this.Set_ParagraphAlign( ParaPr.Jc === align_Left ? align_Justify : align_Left );
this.Document_UpdateInterfaceState();
}
bRetValue = keydownresult_PreventAll;
}
this.private_ToggleParagraphAlignByHotkey(align_Left);
bRetValue = keydownresult_PreventAll;
}
}
else if ( e.KeyCode == 77 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + M + ...
......@@ -10240,17 +10213,8 @@ CDocument.prototype =
}
else if ( e.KeyCode == 82 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + R - переключение прилегания параграфа между right и left
{
var ParaPr = this.Get_Paragraph_ParaPr();
if ( null != ParaPr )
{
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey4);
this.Set_ParagraphAlign( ParaPr.Jc === align_Right ? align_Left : align_Right );
this.Document_UpdateInterfaceState();
}
bRetValue = keydownresult_PreventAll;
}
this.private_ToggleParagraphAlignByHotkey(align_Right);
bRetValue = keydownresult_PreventAll;
}
else if ( e.KeyCode == 83 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + S - save
{
......@@ -15184,6 +15148,38 @@ CDocument.prototype.private_CorrectDocumentPosition = function()
}
}
};
CDocument.prototype.private_ToggleParagraphAlignByHotkey = function(Align)
{
var SelectedInfo = this.Get_SelectedElementsInfo();
var Math = SelectedInfo.Get_Math();
if (null !== Math && true !== Math.Is_Inline())
{
var MathAlign = Math.Get_Align();
if (Align !== MathAlign)
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey);
Math.Set_Align(Align);
this.Recalculate();
this.Document_UpdateInterfaceState();
}
}
}
else
{
var ParaPr = this.Get_Paragraph_ParaPr();
if (null != ParaPr)
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Properties))
{
this.Create_NewHistoryPoint(historydescription_Document_SetParagraphAlignHotKey);
this.Set_ParagraphAlign(ParaPr.Jc === Align ? (Align === align_Left ? align_Justify : align_Left) : Align);
this.Document_UpdateInterfaceState();
}
}
}
};
//-----------------------------------------------------------------------------------
// Private
//-----------------------------------------------------------------------------------
......
......@@ -5339,15 +5339,7 @@ Paragraph.prototype =
if ( para_Run === this.Content[EndPos].Type )
{
var CenterRunPos = this.Internal_ReplaceRun( EndPos, NewElements );
// TODO: разобраться здесь получше, как правильно обновлять позицию
if ( StartPos === this.CurPos.ContentPos )
this.CurPos.ContentPos = CenterRunPos;
// Подправим селект
this.Selection.StartPos = CenterRunPos;
this.Selection.EndPos = CenterRunPos;
this.Internal_ReplaceRun( EndPos, NewElements );
}
}
else
......@@ -5395,9 +5387,7 @@ Paragraph.prototype =
if ( para_Run === Element.Type )
{
var CenterRunPos = this.Internal_ReplaceRun( Pos, NewElements );
this.CurPos.ContentPos = CenterRunPos;
this.CurPos.Line = -1;
this.Internal_ReplaceRun( Pos, NewElements );
}
if ( true === this.Cursor_IsEnd() )
......@@ -5459,7 +5449,11 @@ Paragraph.prototype =
// CRun - всегда не null
var CenterRunPos = Pos;
if ( null !== LRun )
var OldSelectionStartPos = this.Selection.StartPos;
var OldSelectionEndPos = this.Selection.EndPos;
var OldCurPos = this.CurPos.ContentPos;
if (null !== LRun)
{
this.Internal_Content_Add( Pos + 1, CRun );
CenterRunPos = Pos + 1;
......@@ -5469,8 +5463,86 @@ Paragraph.prototype =
// Если LRun - null, значит CRun - это и есть тот ран который стоит уже в позиции Pos
}
if ( null !== RRun )
this.Internal_Content_Add( CenterRunPos + 1, RRun );
if (null !== RRun)
{
this.Internal_Content_Add(CenterRunPos + 1, RRun);
}
if (OldCurPos > Pos)
{
if (null !== LRun)
this.CurPos.ContentPos++;
if (null !== RRun)
this.CurPos.ContentPos++;
}
else if (OldCurPos === Pos)
{
this.CurPos.ContentPos = CenterRunPos;
}
this.CurPos.Line = -1;
if (OldSelectionStartPos > Pos)
{
if (null !== LRun)
this.Selection.StartPos++;
if (null !== RRun)
this.Selection.StartPos++;
}
else if (OldSelectionStartPos === Pos)
{
if (OldSelectionEndPos > OldSelectionStartPos)
{
this.Selection.StartPos = Pos;
}
else if (OldSelectionEndPos < OldSelectionStartPos)
{
if (null !== LRun && null !== RRun)
this.Selection.StartPos = Pos + 2;
else if (null !== LRun || null !== RRun)
this.Selection.StartPos = Pos + 1;
else
this.Selection.StartPos = Pos;
}
else
{
// TODO: Тут надо бы выяснить направление селекта
this.Selection.StartPos = Pos;
if (null !== LRun && null !== RRun)
this.Selection.EndPos = Pos + 2;
else if (null !== LRun || null !== RRun)
this.Selection.EndPos = Pos + 1;
else
this.Selection.EndPos = Pos;
}
}
if (OldSelectionEndPos > Pos)
{
if (null !== LRun)
this.Selection.EndPos++;
if (null !== RRun)
this.Selection.EndPos++;
}
else if (OldSelectionEndPos === Pos)
{
if (OldSelectionEndPos > OldSelectionStartPos)
{
if (null !== LRun && null !== RRun)
this.Selection.EndPos = Pos + 2;
else if (null !== LRun || null !== RRun)
this.Selection.EndPos = Pos + 1;
else
this.Selection.EndPos = Pos;
}
else if (OldSelectionEndPos < OldSelectionStartPos)
{
this.Selection.EndPos = Pos;
}
}
return CenterRunPos;
},
......
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