diff --git a/Word/Editor/Document.js b/Word/Editor/Document.js index f8f08a2506f095757054983a6170f9609ca0e153..f357b550fa3799872cc377bfe4d61683d2e3a36c 100644 --- a/Word/Editor/Document.js +++ b/Word/Editor/Document.js @@ -5999,70 +5999,58 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + + if (true === this.UseTextShd && StartPos === EndPos && type_Paragraph === this.Content[StartPos].GetType() && false === this.Content[StartPos].Selection_CheckParaEnd() && selectionflag_Common === this.Selection.Flag) { - case selectionflag_Common: + this.Paragraph_Add( new ParaTextPr( { Shd : Shd } ) ); + this.Recalculate(); + } + else + { + if ( EndPos < StartPos ) { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - - if (true === this.UseTextShd && StartPos === EndPos && type_Paragraph === this.Content[StartPos].GetType() && false === this.Content[StartPos].Selection_CheckParaEnd() ) + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } + + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; + if ( type_Paragraph == Item.GetType() ) + Item.Set_Shd( Shd ); + else if ( type_Table == Item.GetType() ) { - this.Paragraph_Add( new ParaTextPr( { Shd : Shd } ) ); - this.Recalculate(); + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphShd( Shd ); + Item.TurnOn_RecalcEvent(); } - else - { - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - if ( type_Paragraph == Item.GetType() ) - Item.Set_Shd( Shd ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphShd( Shd ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам надо определить какие Ñтраницы мы должны перериÑовать - var PageStart = -1; - var PageEnd = -1; - for ( var Index = 0; Index < this.Pages.length - 1; Index++ ) - { - if ( PageStart == -1 && StartPos <= this.Pages[Index + 1].Pos ) - PageStart = Index; + } - if ( PageEnd == -1 && EndPos < this.Pages[Index + 1].Pos ) - PageEnd = Index; - } + // Ðам надо определить какие Ñтраницы мы должны перериÑовать + var PageStart = -1; + var PageEnd = -1; + for ( var Index = 0; Index < this.Pages.length - 1; Index++ ) + { + if ( PageStart == -1 && StartPos <= this.Pages[Index + 1].Pos ) + PageStart = Index; - if ( -1 === PageStart ) - PageStart = this.Pages.length - 1; - if ( -1 === PageEnd ) - PageEnd = this.Pages.length - 1; + if ( PageEnd == -1 && EndPos < this.Pages[Index + 1].Pos ) + PageEnd = Index; + } - for ( var Index = PageStart; Index <= PageEnd; Index++ ) - this.DrawingDocument.OnRecalculatePage( Index, this.Pages[Index] ); + if ( -1 === PageStart ) + PageStart = this.Pages.length - 1; + if ( -1 === PageEnd ) + PageEnd = this.Pages.length - 1; - this.DrawingDocument.OnEndRecalculate(false, true); - } + for ( var Index = PageStart; Index <= PageEnd; Index++ ) + this.DrawingDocument.OnRecalculatePage( Index, this.Pages[Index] ); - break; - } - case selectionflag_Numbering: - { - break; - } + this.DrawingDocument.OnEndRecalculate(false, true); } this.Document_UpdateSelectionState(); @@ -6134,11 +6122,8 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - if ( selectionflag_Numbering === this.Selection.Flag ) - { - this.Document_UpdateInterfaceState(); - return false; - } + if (selectionflag_Numbering === this.Selection.Flag) + this.Remove_NumberingSelection(); var StartPos = this.Selection.StartPos; var EndPos = this.Selection.EndPos; @@ -6224,50 +6209,38 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - if ( type_Paragraph == Item.GetType() ) - Item.Set_ContextualSpacing( Value ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphContextualSpacing( Value ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); - - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - return; - } - case selectionflag_Numbering: + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; + if ( type_Paragraph == Item.GetType() ) + Item.Set_ContextualSpacing( Value ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphContextualSpacing( Value ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6308,56 +6281,43 @@ CDocument.prototype = } else //if ( docpostype_Content === this.CurPos.Type ) { - if ( this.CurPos.ContentPos < 0 ) return false; if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - if ( type_Paragraph == Item.GetType() ) - Item.Set_PageBreakBefore( Value ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphPageBreakBefore( Value ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); - - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - return; - } - case selectionflag_Numbering: + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; + if ( type_Paragraph == Item.GetType() ) + Item.Set_PageBreakBefore( Value ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphPageBreakBefore( Value ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6403,51 +6363,39 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - - if ( type_Paragraph == Item.GetType() ) - Item.Set_KeepLines( Value ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphKeepLines( Value ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; - return; - } - case selectionflag_Numbering: + if ( type_Paragraph == Item.GetType() ) + Item.Set_KeepLines( Value ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphKeepLines( Value ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6493,51 +6441,39 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - - if ( type_Paragraph == Item.GetType() ) - Item.Set_KeepNext( Value ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphKeepNext( Value ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; - return; - } - case selectionflag_Numbering: + if ( type_Paragraph == Item.GetType() ) + Item.Set_KeepNext( Value ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphKeepNext( Value ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6583,51 +6519,39 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - - if ( type_Paragraph == Item.GetType() ) - Item.Set_WidowControl( Value ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphWidowControl( Value ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; - return; - } - case selectionflag_Numbering: + if ( type_Paragraph == Item.GetType() ) + Item.Set_WidowControl( Value ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphWidowControl( Value ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6673,51 +6597,39 @@ CDocument.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - - if ( type_Paragraph == Item.GetType() ) - Item.Set_Borders( Borders ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphBorders( Borders ); - Item.TurnOn_RecalcEvent(); - } - } - - // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, - // попавшего в Ñелект. - this.ContentLastChangePos = StartPos; - - this.Recalculate(); + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - this.Document_UpdateSelectionState(); - this.Document_UpdateInterfaceState(); + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; - return; - } - case selectionflag_Numbering: + if ( type_Paragraph == Item.GetType() ) + Item.Set_Borders( Borders ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphBorders( Borders ); + Item.TurnOn_RecalcEvent(); } } + // Ðам нужно переÑчитать вÑе изменениÑ, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ Ñлемента, + // попавшего в Ñелект. + this.ContentLastChangePos = StartPos; + + this.Recalculate(); + + this.Document_UpdateSelectionState(); + this.Document_UpdateInterfaceState(); + return; } @@ -6799,9 +6711,6 @@ CDocument.prototype = { if ( true === this.Selection.Use ) { - if ( selectionflag_Numbering === this.Selection.Flag ) - return; - // Проверим, еÑли у Ð½Ð°Ñ Ð²Ñе выделенные Ñлементы - параграфы, Ñ Ð¾Ð´Ð¸Ð½Ð°ÐºÐ¾Ð²Ñ‹Ð¼Ð¸ наÑтройками // FramePr, тогда мы можем применить новую наÑтройку FramePr @@ -12072,8 +11981,18 @@ CDocument.prototype = bCanCopyCut = true; } - if ( null !== LogicDocument ) - bCanCopyCut = LogicDocument.Is_SelectionUse(); + if (null !== LogicDocument) + { + if (true === LogicDocument.Is_SelectionUse()) + { + if (selectionflag_Numbering === LogicDocument.Selection.Flag) + bCanCopyCut = false; + else if (LogicDocument.Selection.StartPos !== LogicDocument.Selection.EndPos || type_Paragraph === LogicDocument.Content[LogicDocument.Selection.StartPos].Get_Type()) + bCanCopyCut = true; + else + bCanCopyCut = LogicDocument.Content[LogicDocument.Selection.StartPos].Can_CopyCut(); + } + } return bCanCopyCut; }, @@ -12270,9 +12189,18 @@ CDocument.prototype = if ( true === this.Selection.Use ) { // Выделение нумерации - if ( selectionflag_Numbering == this.Selection.Flag ) + if (selectionflag_Numbering == this.Selection.Flag) { - // Ðичего не делаем + if (type_Paragraph === this.Content[this.Selection.StartPos].Get_Type()) + { + var NumPr = this.Content[this.Selection.StartPos].Numbering_Get(); + if (undefined !== NumPr) + this.Document_SelectNumbering(NumPr, this.Selection.StartPos); + else + this.Selection_Remove(); + } + else + this.Selection_Remove(); } else { diff --git a/Word/Editor/DocumentContent.js b/Word/Editor/DocumentContent.js index 325a8893bd3585c6920042b0d0e04f84c69ba281..3494af2b3dd18c4f3cbe23e8794433f50f4b13ca 100644 --- a/Word/Editor/DocumentContent.js +++ b/Word/Editor/DocumentContent.js @@ -1751,6 +1751,43 @@ CDocumentContent.prototype = } }, + Can_CopyCut : function() + { + var bCanCopyCut = false; + + var LogicDocument = null; + var DrawingObjects = null; + + // Работаем Ñ ÐºÐ¾Ð»Ð¾Ð½Ñ‚Ð¸Ñ‚ÑƒÐ»Ð¾Ð¼ + if (docpostype_DrawingObjects === this.CurPos.Type) + DrawingObjects = this.DrawingObjects; + else + LogicDocument = this; + + if (null !== DrawingObjects) + { + if (true === DrawingObjects.isSelectedText()) + LogicDocument = DrawingObjects.getTargetDocContent(); + else + bCanCopyCut = true; + } + + if (null !== LogicDocument) + { + if (true === LogicDocument.Is_SelectionUse()) + { + if (selectionflag_Numbering === LogicDocument.Selection.Flag) + bCanCopyCut = false; + else if (LogicDocument.Selection.StartPos !== LogicDocument.Selection.EndPos || type_Paragraph === LogicDocument.Content[LogicDocument.Selection.StartPos].Get_Type()) + bCanCopyCut = true; + else + bCanCopyCut = LogicDocument.Content[LogicDocument.Selection.StartPos].Can_CopyCut(); + } + } + + return bCanCopyCut; + }, + Cursor_MoveToStartPos : function(AddToSelect) { if ( true === AddToSelect ) @@ -5590,50 +5627,38 @@ CDocumentContent.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + + if (undefined !== this.LogicDocument && true === this.LogicDocument.UseTextShd && StartPos === EndPos && type_Paragraph === this.Content[StartPos].GetType() && false === this.Content[StartPos].Selection_CheckParaEnd() && selectionflag_Common === this.Selection.Flag) { - case selectionflag_Common: + this.Paragraph_Add( new ParaTextPr( { Shd : Shd } ) ); + this.Parent.OnContentRecalculate( false ); + } + else + { + if ( EndPos < StartPos ) { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - if (undefined !== this.LogicDocument && true === this.LogicDocument.UseTextShd && StartPos === EndPos && type_Paragraph === this.Content[StartPos].GetType() && false === this.Content[StartPos].Selection_CheckParaEnd() ) + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; + if ( type_Paragraph == Item.GetType() ) + Item.Set_Shd( Shd ); + else if ( type_Table == Item.GetType() ) { - this.Paragraph_Add( new ParaTextPr( { Shd : Shd } ) ); - this.Parent.OnContentRecalculate( false ); + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphShd( Shd ); + Item.TurnOn_RecalcEvent(); } - else - { - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; - if ( type_Paragraph == Item.GetType() ) - Item.Set_Shd( Shd ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphShd( Shd ); - Item.TurnOn_RecalcEvent(); - } - } - - this.Parent.OnContentRecalculate( false ); - } - - break; - } - case selectionflag_Numbering: - { - break; } + + this.Parent.OnContentRecalculate( false ); } return; @@ -5689,12 +5714,6 @@ CDocumentContent.prototype = if ( true === this.Selection.Use ) { - if ( selectionflag_Numbering === this.Selection.Flag ) - { - this.Interface_Update_ParaPr(); - return false; - } - var StartPos = this.Selection.StartPos; var EndPos = this.Selection.EndPos; if ( EndPos < StartPos ) @@ -5704,6 +5723,9 @@ CDocumentContent.prototype = EndPos = Temp; } + if (selectionflag_Numbering === this.Selection.Flag) + this.Remove_NumberingSelection(); + for ( var Index = StartPos; Index <= EndPos; Index++ ) { var Item = this.Content[Index]; @@ -5946,23 +5968,23 @@ CDocumentContent.prototype = if ( true === this.Selection.Use ) { var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) + var EndPos = this.Selection.EndPos; + if (EndPos < StartPos) { var Temp = StartPos; StartPos = EndPos; - EndPos = Temp; + EndPos = Temp; } - for ( var Index = StartPos; Index <= EndPos; Index++ ) + for (var Index = StartPos; Index <= EndPos; Index++) { var Item = this.Content[Index]; - if ( type_Paragraph == Item.GetType() ) - Item.Set_KeepLines( Value ); - else if ( type_Table == Item.GetType() ) + if (type_Paragraph == Item.GetType()) + Item.Set_KeepLines(Value); + else if (type_Table == Item.GetType()) { Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphKeepLines( Value ); + Item.Set_ParagraphKeepLines(Value); Item.TurnOn_RecalcEvent(); } } @@ -6173,43 +6195,31 @@ CDocumentContent.prototype = if ( true === this.Selection.Use ) { - switch ( this.Selection.Flag ) + var StartPos = this.Selection.StartPos; + var EndPos = this.Selection.EndPos; + if ( EndPos < StartPos ) { - case selectionflag_Common: - { - var StartPos = this.Selection.StartPos; - var EndPos = this.Selection.EndPos; - if ( EndPos < StartPos ) - { - var Temp = StartPos; - StartPos = EndPos; - EndPos = Temp; - } - - for ( var Index = StartPos; Index <= EndPos; Index++ ) - { - // При изменении цвета фона параграфа, не надо ничего переÑчитывать - var Item = this.Content[Index]; + var Temp = StartPos; + StartPos = EndPos; + EndPos = Temp; + } - if ( type_Paragraph == Item.GetType() ) - Item.Set_Borders( Borders ); - else if ( type_Table == Item.GetType() ) - { - Item.TurnOff_RecalcEvent(); - Item.Set_ParagraphBorders( Borders ); - Item.TurnOn_RecalcEvent(); - } - } + for ( var Index = StartPos; Index <= EndPos; Index++ ) + { + // При изменении цвета фона параграфа, не надо ничего переÑчитывать + var Item = this.Content[Index]; - this.Recalculate(); - return; - } - case selectionflag_Numbering: + if ( type_Paragraph == Item.GetType() ) + Item.Set_Borders( Borders ); + else if ( type_Table == Item.GetType() ) { - break; + Item.TurnOff_RecalcEvent(); + Item.Set_ParagraphBorders( Borders ); + Item.TurnOn_RecalcEvent(); } } + this.Recalculate(); return; } @@ -7783,7 +7793,7 @@ CDocumentContent.prototype = // ЕÑли ÑÐµÐ¹Ñ‡Ð°Ñ Ñƒ Ð½Ð°Ñ Ð·Ð°Ñелекчена нумерациÑ, тогда убираем Ñелект Remove_NumberingSelection : function() { - if ( true === this.Selection.Use && selectionflag_Numbering == this.Selection.Flag ) + if (true === this.Selection.Use && selectionflag_Numbering == this.Selection.Flag) this.Selection_Remove(); }, //----------------------------------------------------------------------------------- @@ -8426,10 +8436,18 @@ CDocumentContent.prototype = { if ( true === this.Selection.Use ) { - // Выделение нумерации - if ( selectionflag_Numbering == this.Selection.Flag ) + if (selectionflag_Numbering == this.Selection.Flag) { - // Ðичего не делаем + if (type_Paragraph === this.Content[this.Selection.StartPos].Get_Type()) + { + var NumPr = this.Content[this.Selection.StartPos].Numbering_Get(); + if (undefined !== NumPr) + this.Document_SelectNumbering(NumPr, this.Selection.StartPos); + else + this.LogicDocument.Selection_Remove(); + } + else + this.LogicDocument.Selection_Remove(); } else { diff --git a/Word/Editor/Numbering.js b/Word/Editor/Numbering.js index 46b683cd0cd4adcce49aa1616aa4872fb768a1bd..ff713c86d52488f03476589f1d7680345cfc2904 100644 --- a/Word/Editor/Numbering.js +++ b/Word/Editor/Numbering.js @@ -375,10 +375,7 @@ CAbstractNum.prototype = Lvl.ParaPr.Ind.Left = Left; Lvl.ParaPr.Ind.FirstLine = FirstLine; - var TextPr = new CTextPr(); - TextPr.RFonts.Set_All( "Times New Roman", -1 ); - - Lvl.TextPr = TextPr; + Lvl.TextPr = new CTextPr(); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : Index, Old : Lvl_old, New : Lvl_new } ); @@ -425,8 +422,6 @@ CAbstractNum.prototype = Lvl.ParaPr.Ind.FirstLine = FirstLine; var TextPr = new CTextPr(); - TextPr.RFonts.Set_All( "Times New Roman", -1 ); - Lvl.TextPr = TextPr; var Lvl_new = this.Internal_CopyLvl( Lvl ); @@ -505,8 +500,6 @@ CAbstractNum.prototype = Lvl.ParaPr.Ind.FirstLine = FirstLine; var TextPr = new CTextPr(); - TextPr.RFonts.Set_All( "Times New Roman", -1 ); - Lvl.TextPr = TextPr; var Lvl_new = this.Internal_CopyLvl( Lvl ); @@ -663,7 +656,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( ")" ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -684,7 +676,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -705,7 +696,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -726,7 +716,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( ")" ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -747,7 +736,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -768,7 +756,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -789,7 +776,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( ")" ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -810,7 +796,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -831,7 +816,6 @@ CAbstractNum.prototype = Lvl.LvlText = []; Lvl.LvlText.push( new CLvlText_Num( iLvl ) ); Lvl.LvlText.push( new CLvlText_Text( "." ) ); - Lvl.TextPr.RFonts.Set_All( "Times New Roman", -1 ); var Lvl_new = this.Internal_CopyLvl( Lvl ); History.Add( this, { Type : historyitem_AbstractNum_LvlChange, Index : iLvl, Old : Lvl_old, New : Lvl_new } ); @@ -1544,7 +1528,6 @@ CAbstractNum.prototype = case changestype_Document_Content: case changestype_Document_Content_Add: case changestype_Image_Properties: - case changestype_Remove: { CollaborativeEditing.Add_CheckLock(true); break; @@ -1840,10 +1823,9 @@ CNumbering.prototype = AbstractNum.Document_Get_AllFontNames( AllFonts ); } - AllFonts["Symbol"] = true; - AllFonts["Courier New"] = true; - AllFonts["Wingdings"] = true; - AllFonts["Times New Roman"] = true; + AllFonts["Symbol"] = true; + AllFonts["Courier New"] = true; + AllFonts["Wingdings"] = true; } }; diff --git a/Word/Editor/Paragraph.js b/Word/Editor/Paragraph.js index 2f656320c89add01551fd97846f19d842edfc127..1ef921ece59ab47235a2a662f8712b6ded777539 100644 --- a/Word/Editor/Paragraph.js +++ b/Word/Editor/Paragraph.js @@ -8676,7 +8676,7 @@ Paragraph.prototype = EndPos = CurPos; } - if ( this.bFromDocument && this.LogicDocument && true === this.LogicDocument.Spelling.Use ) + if (this.bFromDocument && this.LogicDocument && true === this.LogicDocument.Spelling.Use && selectionflag_Numbering !== this.Selection.Flag) this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos ); if ( true === this.Selection.Use ) diff --git a/Word/Editor/Table.js b/Word/Editor/Table.js index 6f77fbd0cab412c91c9d7bdcdd879f89a44ce0fd..81f9002c109b7fc9826f9b3a072841a3aacd4f79 100644 --- a/Word/Editor/Table.js +++ b/Word/Editor/Table.js @@ -5195,6 +5195,14 @@ CTable.prototype = this.Parent.Set_CurrentElement( this.Index, bUpdateStates ); }, + Can_CopyCut : function() + { + if ( true === this.Selection.Use && table_Selection_Cell === this.Selection.Type ) + return true; + else + return this.CurCell.Content.Can_CopyCut(); + }, + Set_Inline : function(Value) { History.Add( this, { Type : historyitem_Table_Inline, Old : this.Inline, New : Value } );