Commit a53d2eba authored by Ilya.Kirillov's avatar Ilya.Kirillov

Сделано, чтобы при создании нового стиля он сразу применялся к выделенному...

Сделано, чтобы при создании нового стиля он сразу применялся к выделенному фрагменту. Исправлен баг с выставлением селекта при выставлении текстовых настроек.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66472 954022d7-b5bf-4e40-9824-e11837661b57
parent 9e2c2b2b
......@@ -13,6 +13,63 @@ if(typeof CDocument !== "undefined")
CollaborativeEditing.OnStart_CheckLock();
this.private_DocumentIsSelectionLocked(CheckType);
if ( "undefined" != typeof(AdditionalData) && null != AdditionalData )
{
if ( changestype_2_InlineObjectMove === AdditionalData.Type )
{
var PageNum = AdditionalData.PageNum;
var X = AdditionalData.X;
var Y = AdditionalData.Y;
var NearestPara = this.Get_NearestPos(PageNum, X, Y).Paragraph;
NearestPara.Document_Is_SelectionLocked(changestype_Document_Content);
}
else if ( changestype_2_HdrFtr === AdditionalData.Type )
{
this.HdrFtr.Document_Is_SelectionLocked(changestype_HdrFtr);
}
else if ( changestype_2_Comment === AdditionalData.Type )
{
this.Comments.Document_Is_SelectionLocked( AdditionalData.Id );
}
else if ( changestype_2_Element_and_Type === AdditionalData.Type )
{
AdditionalData.Element.Document_Is_SelectionLocked( AdditionalData.CheckType, false );
}
else if ( changestype_2_ElementsArray_and_Type === AdditionalData.Type )
{
var Count = AdditionalData.Elements.length;
for ( var Index = 0; Index < Count; Index++ )
{
AdditionalData.Elements[Index].Document_Is_SelectionLocked( AdditionalData.CheckType, false );
}
}
else if (changestype_2_AdditionalTypes === AdditionalData.Type)
{
var Count = AdditionalData.Types.length;
for (var Index = 0; Index < Count; ++Index)
{
this.private_DocumentIsSelectionLocked(AdditionalData.Types[Index]);
}
}
}
var bResult = CollaborativeEditing.OnEnd_CheckLock(DontLockInFastMode);
if ( true === bResult )
{
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
//this.Document_UpdateRulersState();
}
return bResult;
};
CDocument.prototype.private_DocumentIsSelectionLocked = function(CheckType)
{
if ( changestype_None != CheckType )
{
if ( changestype_Document_SectPr === CheckType )
......@@ -83,50 +140,6 @@ if(typeof CDocument !== "undefined")
}
}
}
if ( "undefined" != typeof(AdditionalData) && null != AdditionalData )
{
if ( changestype_2_InlineObjectMove === AdditionalData.Type )
{
var PageNum = AdditionalData.PageNum;
var X = AdditionalData.X;
var Y = AdditionalData.Y;
var NearestPara = this.Get_NearestPos(PageNum, X, Y).Paragraph;
NearestPara.Document_Is_SelectionLocked(changestype_Document_Content);
}
else if ( changestype_2_HdrFtr === AdditionalData.Type )
{
this.HdrFtr.Document_Is_SelectionLocked(changestype_HdrFtr);
}
else if ( changestype_2_Comment === AdditionalData.Type )
{
this.Comments.Document_Is_SelectionLocked( AdditionalData.Id );
}
else if ( changestype_2_Element_and_Type === AdditionalData.Type )
{
AdditionalData.Element.Document_Is_SelectionLocked( AdditionalData.CheckType, false );
}
else if ( changestype_2_ElementsArray_and_Type === AdditionalData.Type )
{
var Count = AdditionalData.Elements.length;
for ( var Index = 0; Index < Count; Index++ )
{
AdditionalData.Elements[Index].Document_Is_SelectionLocked( AdditionalData.CheckType, false );
}
}
}
var bResult = CollaborativeEditing.OnEnd_CheckLock(DontLockInFastMode);
if ( true === bResult )
{
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
//this.Document_UpdateRulersState();
}
return bResult;
};
}
......
......@@ -736,6 +736,7 @@ var changestype_2_HdrFtr = 2; // Изменения с коло
var changestype_2_Comment = 3; // Работает с комментариями
var changestype_2_Element_and_Type = 4; // Проверяем возможно ли сделать изменение заданного типа с заданным элементом(а не с текущим)
var changestype_2_ElementsArray_and_Type = 5; // Аналогично предыдущему, только идет массив элементов
var changestype_2_AdditionalTypes = 6; // Дополнительные проверки типа 1
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
......
......@@ -5482,11 +5482,10 @@ Paragraph.prototype =
if (OldCurPos > Pos)
{
if (null !== LRun)
this.CurPos.ContentPos++;
if (null !== RRun)
this.CurPos.ContentPos++;
if (null !== LRun && null !== RRun)
this.CurPos.ContentPos = OldCurPos + 2;
else if (null !== RRun || null !== RRun)
this.CurPos.ContentPos = OldCurPos + 1;
}
else if (OldCurPos === Pos)
{
......@@ -5496,11 +5495,10 @@ Paragraph.prototype =
if (OldSelectionStartPos > Pos)
{
if (null !== LRun)
this.Selection.StartPos++;
if (null !== RRun)
this.Selection.StartPos++;
if (null !== LRun && null !== RRun)
this.Selection.StartPos = OldSelectionStartPos + 2;
else if (null !== RRun || null !== RRun)
this.Selection.StartPos = OldSelectionStartPos + 1;
}
else if (OldSelectionStartPos === Pos)
{
......@@ -5533,11 +5531,10 @@ Paragraph.prototype =
if (OldSelectionEndPos > Pos)
{
if (null !== LRun)
this.Selection.EndPos++;
if (null !== RRun)
this.Selection.EndPos++;
if (null !== LRun && null !== RRun)
this.Selection.EndPos = OldSelectionEndPos + 2;
else if (null !== RRun || null !== RRun)
this.Selection.EndPos = OldSelectionEndPos + 1;
}
else if (OldSelectionEndPos === Pos)
{
......@@ -13184,10 +13181,23 @@ Paragraph.prototype.Get_StyleFromFormatting = function()
{
// Получим настройки первого рана попавшего в выделение
var TextPr = null;
var CurPos = 0;
if (true === this.Selection.Use)
TextPr = this.Content[this.Selection.StartPos > this.Selection.EndPos? this.Selection.EndPos : this.Selection.StartPos].Get_FirstTextPr();
{
var StartPos = this.Selection.StartPos > this.Selection.EndPos ? this.Selection.EndPos : this.Selection.StartPos;
var EndPos = this.Selection.StartPos > this.Selection.EndPos ? this.Selection.StartPos : this.Selection.EndPos;
for (CurPos = StartPos; CurPos < EndPos; ++CurPos)
{
if (true !== this.Content[CurPos].Selection_IsEmpty())
break;
}
}
else
TextPr = this.Content[this.CurPos.ContentPos].Get_FirstTextPr();
{
CurPos = this.CurPos.ContentPos;
}
TextPr = this.Content[CurPos].Get_FirstTextPr();
// В стиль не добавляется HightLight
if (undefined !== TextPr.HighLight)
......
......@@ -65,13 +65,15 @@ CDocument.prototype.Get_StyleFromFormatting = function()
};
/**
* Добавляем новый стиль (или заменяем старый с таким же названием).
* И сразу применяем его к выделенному фрагменту.
*/
CDocument.prototype.Add_NewStyle = function(oStyle)
{
if (false === this.Document_Is_SelectionLocked(changestype_Document_Styles))
if (false === this.Document_Is_SelectionLocked(changestype_Document_Styles, {Type : changestype_2_AdditionalTypes, Types : [changestype_Paragraph_Properties]}))
{
History.Create_NewPoint(historydescription_Document_AddNewStyle);
this.Styles.Create_StyleFromInterface(oStyle);
var NewStyle = this.Styles.Create_StyleFromInterface(oStyle);
this.Set_ParagraphStyle(NewStyle.Get_Name());
this.Recalculate();
this.Document_UpdateInterfaceState();
}
......
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