Commit 44f714e2 authored by Ilya Kirillov's avatar Ilya Kirillov

Рефакторинг и первоначальная реализация для сносок функций выставления...

Рефакторинг и первоначальная реализация для сносок функций выставления настроек картинок и таблиц и получения настроек параграфа и текста.
parent 9cb5bf3b
...@@ -4304,24 +4304,7 @@ CDocument.prototype.Paragraph_SetHighlight = function(IsColor, r, g, b) ...@@ -4304,24 +4304,7 @@ CDocument.prototype.Paragraph_SetHighlight = function(IsColor, r, g, b)
}; };
CDocument.prototype.Set_ImageProps = function(Props) CDocument.prototype.Set_ImageProps = function(Props)
{ {
// Работаем с колонтитулом this.Controller.SetImageProps(Props);
if (docpostype_HdrFtr === this.CurPos.Type)
{
this.HdrFtr.Set_ImageProps(Props);
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
this.DrawingObjects.setProps(Props);
}
else if (docpostype_Content == this.CurPos.Type && ( ( true === this.Selection.Use && this.Selection.StartPos == this.Selection.EndPos && type_Table == this.Content[this.Selection.StartPos].GetType() ) || ( false == this.Selection.Use && type_Table == this.Content[this.CurPos.ContentPos].GetType() ) ))
{
this.Interface_Update_TablePr();
if (true == this.Selection.Use)
this.Content[this.Selection.StartPos].Set_ImageProps(Props);
else
this.Content[this.CurPos.ContentPos].Set_ImageProps(Props);
}
this.Recalculate(); this.Recalculate();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
}; };
...@@ -4353,316 +4336,27 @@ CDocument.prototype.Select_Drawings = function(DrawingArray, Targ ...@@ -4353,316 +4336,27 @@ CDocument.prototype.Select_Drawings = function(DrawingArray, Targ
}; };
CDocument.prototype.Set_TableProps = function(Props) CDocument.prototype.Set_TableProps = function(Props)
{ {
// Работаем с колонтитулом this.Controller.SetTableProps(Props);
if (docpostype_HdrFtr === this.CurPos.Type)
{
this.HdrFtr.Set_TableProps(Props);
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
this.DrawingObjects.setTableProps(Props);
}
else //if ( docpostype_Content === this.CurPos.Type )
{
var Pos = -1;
if (true === this.Selection.Use && this.Selection.StartPos == this.Selection.EndPos && type_Table == this.Content[this.Selection.StartPos].GetType())
Pos = this.Selection.StartPos;
else if (false === this.Selection.Use && type_Table === this.Content[this.CurPos.ContentPos].GetType())
Pos = this.CurPos.ContentPos;
if (-1 != Pos)
{
var Table = this.Content[Pos];
Table.Set_Props(Props);
}
}
this.Recalculate(); this.Recalculate();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
}; };
CDocument.prototype.Get_Paragraph_ParaPr = function() CDocument.prototype.Get_Paragraph_ParaPr = function()
{ {
// Работаем с колонтитулом return this.Controller.GetCurrentParaPr();
if (docpostype_HdrFtr === this.CurPos.Type)
return this.HdrFtr.Get_Paragraph_ParaPr();
else if (docpostype_DrawingObjects === this.CurPos.Type)
return this.DrawingObjects.getParagraphParaPr();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_ParaPr = new CParaPr();
if (true === this.Selection.Use && selectionflag_Common === this.Selection.Flag)
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (EndPos < StartPos)
{
var Temp = StartPos;
StartPos = EndPos;
EndPos = Temp;
}
var StartPr, Pr;
if (type_Paragraph == this.Content[StartPos].GetType())
{
StartPr = this.Content[StartPos].Get_CompiledPr2(false).ParaPr;
Pr = StartPr.Copy();
Pr.Locked = this.Content[StartPos].Lock.Is_Locked();
}
else if (type_Table == this.Content[StartPos].GetType())
{
StartPr = this.Content[StartPos].Get_Paragraph_ParaPr();
Pr = StartPr.Copy();
Pr.Locked = StartPr.Locked;
}
for (var Index = StartPos + 1; Index <= EndPos; Index++)
{
var Item = this.Content[Index];
var TempPr;
if (type_Paragraph == Item.GetType())
{
TempPr = Item.Get_CompiledPr2(false).ParaPr;
TempPr.Locked = Item.Lock.Is_Locked();
}
else if (type_Table == Item.GetType())
{
TempPr = Item.Get_Paragraph_ParaPr();
}
Pr = Pr.Compare(TempPr);
}
if (undefined === Pr.Ind.Left)
Pr.Ind.Left = StartPr.Ind.Left;
if (undefined === Pr.Ind.Right)
Pr.Ind.Right = StartPr.Ind.Right;
if (undefined === Pr.Ind.FirstLine)
Pr.Ind.FirstLine = StartPr.Ind.FirstLine;
Result_ParaPr = Pr;
Result_ParaPr.CanAddTable = ( true === Pr.Locked ? false : true );
// Если мы находимся в рамке, тогда дополняем ее свойства настройками границы и настройкой текста (если это буквица)
if (undefined != Result_ParaPr.FramePr && type_Paragraph === this.Content[StartPos].GetType())
this.Content[StartPos].Supplement_FramePr(Result_ParaPr.FramePr);
else if (StartPos === EndPos && StartPos > 0 && type_Paragraph === this.Content[StartPos - 1].GetType())
{
var PrevFrame = this.Content[StartPos - 1].Get_FramePr();
if (undefined != PrevFrame && undefined != PrevFrame.DropCap)
{
Result_ParaPr.FramePr = PrevFrame.Copy();
this.Content[StartPos - 1].Supplement_FramePr(Result_ParaPr.FramePr);
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
var ParaPr = Item.Get_CompiledPr2(false).ParaPr;
var Locked = Item.Lock.Is_Locked();
Result_ParaPr = ParaPr.Copy();
Result_ParaPr.Locked = Locked;
Result_ParaPr.CanAddTable = ( ( true === Locked ) ? ( ( true === Item.Cursor_IsEnd() ) ? true : false ) : true );
// Если мы находимся в рамке, тогда дополняем ее свойства настройками границы и настройкой текста (если это буквица)
if (undefined != Result_ParaPr.FramePr)
Item.Supplement_FramePr(Result_ParaPr.FramePr);
else if (this.CurPos.ContentPos > 0 && type_Paragraph === this.Content[this.CurPos.ContentPos - 1].GetType())
{
var PrevFrame = this.Content[this.CurPos.ContentPos - 1].Get_FramePr();
if (undefined != PrevFrame && undefined != PrevFrame.DropCap)
{
Result_ParaPr.FramePr = PrevFrame.Copy();
this.Content[this.CurPos.ContentPos - 1].Supplement_FramePr(Result_ParaPr.FramePr);
}
}
}
else if (type_Table == Item.GetType())
{
Result_ParaPr = Item.Get_Paragraph_ParaPr();
}
}
if (Result_ParaPr.Shd && Result_ParaPr.Shd.Unifill)
{
Result_ParaPr.Shd.Unifill.check(this.theme, this.Get_ColorMap());
}
return Result_ParaPr;
}
}; };
CDocument.prototype.Get_Paragraph_TextPr = function() CDocument.prototype.Get_Paragraph_TextPr = function()
{ {
// Работаем с колонтитулом return this.Controller.GetCurrentTextPr();
if (docpostype_HdrFtr === this.CurPos.Type)
return this.HdrFtr.Get_Paragraph_TextPr();
else if (docpostype_DrawingObjects === this.CurPos.Type)
return this.DrawingObjects.getParagraphTextPr();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_TextPr = null;
if (true === this.Selection.Use)
{
var VisTextPr;
switch (this.Selection.Flag)
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (EndPos < StartPos)
{
var Temp = StartPos;
StartPos = EndPos;
EndPos = Temp;
}
VisTextPr = this.Content[StartPos].Get_Paragraph_TextPr();
for (var Index = StartPos + 1; Index <= EndPos; Index++)
{
var CurPr = this.Content[Index].Get_Paragraph_TextPr();
VisTextPr = VisTextPr.Compare(CurPr);
}
break;
}
case selectionflag_Numbering:
{
// Текстовые настройки применяем к конкретной нумерации
if (null == this.Selection.Data || this.Selection.Data.length <= 0)
break;
var CurPara = this.Content[this.Selection.Data[0]];
for (var Index = 0; Index < this.Selection.Data.length; Index++)
{
if (this.CurPos.ContentPos === this.Selection.Data[Index])
CurPara = this.Content[this.Selection.Data[Index]];
}
VisTextPr = CurPara.Internal_Get_NumberingTextPr();
break;
}
}
Result_TextPr = VisTextPr;
}
else
{
Result_TextPr = this.Content[this.CurPos.ContentPos].Get_Paragraph_TextPr();
}
return Result_TextPr;
}
}; };
CDocument.prototype.Get_Paragraph_TextPr_Copy = function() CDocument.prototype.Get_Paragraph_TextPr_Copy = function()
{ {
// Работаем с колонтитулом return this.Controller.GetDirectTextPr();
if (docpostype_HdrFtr === this.CurPos.Type)
return this.HdrFtr.Get_Paragraph_TextPr_Copy();
else if (docpostype_DrawingObjects === this.CurPos.Type)
return this.DrawingObjects.getParagraphTextPrCopy();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_TextPr = null;
if (true === this.Selection.Use)
{
var VisTextPr;
switch (this.Selection.Flag)
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos;
if (this.Selection.EndPos < StartPos)
StartPos = this.Selection.EndPos;
var Item = this.Content[StartPos];
VisTextPr = Item.Get_Paragraph_TextPr_Copy();
break;
}
case selectionflag_Numbering:
{
// Текстовые настройки применяем к конкретной нумерации
if (null == this.Selection.Data || this.Selection.Data.length <= 0)
break;
var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
VisTextPr = this.Numbering.Get_AbstractNum(NumPr.NumId).Lvl[NumPr.Lvl].TextPr;
break;
}
}
Result_TextPr = VisTextPr;
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
Result_TextPr = Item.Get_Paragraph_TextPr_Copy();
}
return Result_TextPr;
}
}; };
CDocument.prototype.Get_Paragraph_ParaPr_Copy = function() CDocument.prototype.Get_Paragraph_ParaPr_Copy = function()
{ {
// Работаем с колонтитулом return this.Controller.GetDirectParaPr();
if (docpostype_HdrFtr === this.CurPos.Type)
return this.HdrFtr.Get_Paragraph_ParaPr_Copy();
else if (docpostype_DrawingObjects === this.CurPos.Type)
return this.DrawingObjects.getParagraphParaPrCopy();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_ParaPr = null;
if (true === this.Selection.Use)
{
switch (this.Selection.Flag)
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos;
if (this.Selection.EndPos < StartPos)
StartPos = this.Selection.EndPos;
var Item = this.Content[StartPos];
Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
break;
}
case selectionflag_Numbering:
{
// Текстовые настройки применяем к конкретной нумерации
if (null == this.Selection.Data || this.Selection.Data.length <= 0)
break;
var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
Result_ParaPr = this.Numbering.Get_AbstractNum(NumPr.NumId).Lvl[NumPr.Lvl].ParaPr;
break;
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
}
return Result_ParaPr;
}
}; };
CDocument.prototype.Get_PageSizesByDrawingObjects = function() CDocument.prototype.Get_PageSizesByDrawingObjects = function()
{ {
...@@ -4683,9 +4377,7 @@ CDocument.prototype.Set_DocumentMargin = function(MarPr) ...@@ -4683,9 +4377,7 @@ CDocument.prototype.Set_DocumentMargin = function(MarPr)
SectPr.Set_PageMargins(L, T, R, B); SectPr.Set_PageMargins(L, T, R, B);
this.DrawingObjects.CheckAutoFit(); this.DrawingObjects.CheckAutoFit();
this.ContentLastChangePos = 0;
this.Recalculate(); this.Recalculate();
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
...@@ -4702,9 +4394,7 @@ CDocument.prototype.Set_DocumentPageSize = function(W, H, bNoRecalc) ...@@ -4702,9 +4394,7 @@ CDocument.prototype.Set_DocumentPageSize = function(W, H, bNoRecalc)
this.DrawingObjects.CheckAutoFit(); this.DrawingObjects.CheckAutoFit();
if (true != bNoRecalc) if (true != bNoRecalc)
{ {
this.ContentLastChangePos = 0;
this.Recalculate(); this.Recalculate();
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
...@@ -4737,7 +4427,6 @@ CDocument.prototype.Set_DocumentOrientation = function(Orientation, bNoRe ...@@ -4737,7 +4427,6 @@ CDocument.prototype.Set_DocumentOrientation = function(Orientation, bNoRe
if (true != bNoRecalc) if (true != bNoRecalc)
{ {
this.Recalculate(); this.Recalculate();
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
...@@ -4779,6 +4468,9 @@ CDocument.prototype.Set_DocumentEvenAndOddHeaders = function(Value) ...@@ -4779,6 +4468,9 @@ CDocument.prototype.Set_DocumentEvenAndOddHeaders = function(Value)
*/ */
CDocument.prototype.Interface_Update_ParaPr = function() CDocument.prototype.Interface_Update_ParaPr = function()
{ {
if (!this.Api)
return;
var ParaPr = this.Get_Paragraph_ParaPr(); var ParaPr = this.Get_Paragraph_ParaPr();
if (null != ParaPr) if (null != ParaPr)
...@@ -4786,7 +4478,7 @@ CDocument.prototype.Interface_Update_ParaPr = function() ...@@ -4786,7 +4478,7 @@ CDocument.prototype.Interface_Update_ParaPr = function()
// Проверим, можно ли добавить буквицу // Проверим, можно ли добавить буквицу
ParaPr.CanAddDropCap = false; ParaPr.CanAddDropCap = false;
if (docpostype_Content === this.CurPos.Type) if (docpostype_Content === this.Get_DocPosType())
{ {
var Para = null; var Para = null;
if (false === this.Selection.Use && type_Paragraph === this.Content[this.CurPos.ContentPos].GetType()) if (false === this.Selection.Use && type_Paragraph === this.Content[this.CurPos.ContentPos].GetType())
...@@ -4812,7 +4504,7 @@ CDocument.prototype.Interface_Update_ParaPr = function() ...@@ -4812,7 +4504,7 @@ CDocument.prototype.Interface_Update_ParaPr = function()
ParaPr.CanAddImage = true; ParaPr.CanAddImage = true;
if (undefined != ParaPr.Tabs) if (undefined != ParaPr.Tabs)
editor.Update_ParaTab(Default_Tab_Stop, ParaPr.Tabs); this.Api.Update_ParaTab(Default_Tab_Stop, ParaPr.Tabs);
if (ParaPr.Shd && ParaPr.Shd.Unifill) if (ParaPr.Shd && ParaPr.Shd.Unifill)
{ {
...@@ -4824,7 +4516,7 @@ CDocument.prototype.Interface_Update_ParaPr = function() ...@@ -4824,7 +4516,7 @@ CDocument.prototype.Interface_Update_ParaPr = function()
if (null !== Math && true !== Math.Is_Inline()) if (null !== Math && true !== Math.Is_Inline())
ParaPr.Jc = Math.Get_Align(); ParaPr.Jc = Math.Get_Align();
editor.UpdateParagraphProp(ParaPr); this.Api.UpdateParagraphProp(ParaPr);
} }
}; };
/** /**
...@@ -4832,6 +4524,9 @@ CDocument.prototype.Interface_Update_ParaPr = function() ...@@ -4832,6 +4524,9 @@ CDocument.prototype.Interface_Update_ParaPr = function()
*/ */
CDocument.prototype.Interface_Update_TextPr = function() CDocument.prototype.Interface_Update_TextPr = function()
{ {
if (!this.Api)
return;
var TextPr = this.Get_Paragraph_TextPr(); var TextPr = this.Get_Paragraph_TextPr();
if (null != TextPr) if (null != TextPr)
...@@ -4864,7 +4559,7 @@ CDocument.prototype.Interface_Update_TextPr = function() ...@@ -4864,7 +4559,7 @@ CDocument.prototype.Interface_Update_TextPr = function()
{ {
TextPr.Shd.Unifill.check(this.theme, this.Get_ColorMap()); TextPr.Shd.Unifill.check(this.theme, this.Get_ColorMap());
} }
editor.UpdateTextPr(TextPr); this.Api.UpdateTextPr(TextPr);
} }
}; };
/** /**
...@@ -15515,17 +15210,141 @@ CDocument.prototype.controller_SetParagraphStyle = function(Name) ...@@ -15515,17 +15210,141 @@ CDocument.prototype.controller_SetParagraphStyle = function(Name)
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
{ {
Item.Style_Add(StyleId); Item.Style_Add(StyleId);
}
else if (type_Table == Item.GetType())
{
Item.TurnOff_RecalcEvent();
Item.Set_ParagraphStyle(Name);
Item.TurnOn_RecalcEvent();
}
}
};
CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value)
{
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use)
{
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();
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
Item.Set_ContextualSpacing(Value);
}
else if (type_Table == Item.GetType())
Item.Set_ParagraphContextualSpacing(Value);
}
};
CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value)
{
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use)
{
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();
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
Item.Set_PageBreakBefore(Value);
}
else if (type_Table == Item.GetType())
Item.Set_ParagraphPageBreakBefore(Value);
}
};
CDocument.prototype.controller_SetParagraphKeepLines = function(Value)
{
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use)
{
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();
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
Item.Set_KeepLines(Value);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ Item.Set_ParagraphKeepLines(Value);
Item.TurnOff_RecalcEvent();
Item.Set_ParagraphStyle(Name);
Item.TurnOn_RecalcEvent();
}
} }
}; };
CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value) CDocument.prototype.controller_SetParagraphKeepNext = function(Value)
{ {
if (this.CurPos.ContentPos < 0) if (this.CurPos.ContentPos < 0)
return false; return false;
...@@ -15545,12 +15364,13 @@ CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value) ...@@ -15545,12 +15364,13 @@ CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value)
{ {
// При изменении цвета фона параграфа, не надо ничего пересчитывать // При изменении цвета фона параграфа, не надо ничего пересчитывать
var Item = this.Content[Index]; var Item = this.Content[Index];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
Item.Set_ContextualSpacing(Value); Item.Set_KeepNext(Value);
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); Item.TurnOff_RecalcEvent();
Item.Set_ParagraphContextualSpacing(Value); Item.Set_ParagraphKeepNext(Value);
Item.TurnOn_RecalcEvent(); Item.TurnOn_RecalcEvent();
} }
} }
...@@ -15560,13 +15380,13 @@ CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value) ...@@ -15560,13 +15380,13 @@ CDocument.prototype.controller_SetParagraphContextualSpacing = function(Value)
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
{ {
Item.Set_ContextualSpacing(Value); Item.Set_KeepNext(Value);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
Item.Set_ParagraphContextualSpacing(Value); Item.Set_ParagraphKeepNext(Value);
} }
}; };
CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value) CDocument.prototype.controller_SetParagraphWidowControl = function(Value)
{ {
if (this.CurPos.ContentPos < 0) if (this.CurPos.ContentPos < 0)
return false; return false;
...@@ -15586,12 +15406,13 @@ CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value) ...@@ -15586,12 +15406,13 @@ CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value)
{ {
// При изменении цвета фона параграфа, не надо ничего пересчитывать // При изменении цвета фона параграфа, не надо ничего пересчитывать
var Item = this.Content[Index]; var Item = this.Content[Index];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
Item.Set_PageBreakBefore(Value); Item.Set_WidowControl(Value);
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); Item.TurnOff_RecalcEvent();
Item.Set_ParagraphPageBreakBefore(Value); Item.Set_ParagraphWidowControl(Value);
Item.TurnOn_RecalcEvent(); Item.TurnOn_RecalcEvent();
} }
} }
...@@ -15601,13 +15422,13 @@ CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value) ...@@ -15601,13 +15422,13 @@ CDocument.prototype.controller_SetParagraphPageBreakBefore = function(Value)
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
{ {
Item.Set_PageBreakBefore(Value); Item.Set_WidowControl(Value);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
Item.Set_ParagraphPageBreakBefore(Value); Item.Set_ParagraphWidowControl(Value);
} }
}; };
CDocument.prototype.controller_SetParagraphKeepLines = function(Value) CDocument.prototype.controller_SetParagraphBorders = function(Borders)
{ {
if (this.CurPos.ContentPos < 0) if (this.CurPos.ContentPos < 0)
return false; return false;
...@@ -15629,32 +15450,151 @@ CDocument.prototype.controller_SetParagraphKeepLines = function(Value) ...@@ -15629,32 +15450,151 @@ CDocument.prototype.controller_SetParagraphKeepLines = function(Value)
var Item = this.Content[Index]; var Item = this.Content[Index];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
Item.Set_KeepLines(Value); Item.Set_Borders(Borders);
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); Item.TurnOff_RecalcEvent();
Item.Set_ParagraphKeepLines(Value); Item.Set_ParagraphBorders(Borders);
Item.TurnOn_RecalcEvent(); Item.TurnOn_RecalcEvent();
} }
} }
} }
else else
{ {
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
{ {
Item.Set_KeepLines(Value); // Мы должны выставить границу для всех параграфов, входящих в текущую группу параграфов
// с одинаковыми границами
var StartPos = Item.Index;
var EndPos = Item.Index;
var CurBrd = Item.Get_CompiledPr().ParaPr.Brd;
while (true != CurBrd.First)
{
StartPos--;
if (StartPos < 0)
{
StartPos = 0;
break;
}
var TempItem = this.Content[StartPos];
if (type_Paragraph != TempItem.GetType())
{
StartPos++;
break;
}
CurBrd = TempItem.Get_CompiledPr().ParaPr.Brd;
}
CurBrd = Item.Get_CompiledPr().ParaPr.Brd;
while (true != CurBrd.Last)
{
EndPos++;
if (EndPos >= this.Content.length)
{
EndPos = this.Content.length - 1;
break;
}
var TempItem = this.Content[EndPos];
if (type_Paragraph != TempItem.GetType())
{
EndPos--;
break;
}
CurBrd = TempItem.Get_CompiledPr().ParaPr.Brd;
}
for (var Index = StartPos; Index <= EndPos; Index++)
this.Content[Index].Set_Borders(Borders);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
Item.Set_ParagraphKeepLines(Value); {
Item.Set_ParagraphBorders(Borders);
}
} }
}; };
CDocument.prototype.controller_SetParagraphKeepNext = function(Value) CDocument.prototype.controller_SetParagraphFramePr = function(FramePr, bDelete)
{
if (true === this.Selection.Use)
{
// Проверим, если у нас все выделенные элементы - параграфы, с одинаковыми настройками
// FramePr, тогда мы можем применить новую настройку FramePr
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
var Element = this.Content[StartPos];
if (type_Paragraph != Element.GetType() || undefined === Element.Get_FramePr())
return;
var FramePr = Element.Get_FramePr();
for (var Pos = StartPos + 1; Pos < EndPos; Pos++)
{
var TempElement = this.Content[Pos];
if (type_Paragraph != TempElement.GetType() || undefined === TempElement.Get_FramePr() || true != FramePr.Compare(TempElement.Get_FramePr()))
return;
}
// Раз дошли до сюда, значит можно у всех выделенных параграфов менять настройку рамки
var FrameParas = this.Content[StartPos].Internal_Get_FrameParagraphs();
var FrameCount = FrameParas.length;
for (var Pos = 0; Pos < FrameCount; Pos++)
{
FrameParas[Pos].Set_FramePr(FramePr, bDelete);
}
}
else
{
var Element = this.Content[this.CurPos.ContentPos];
if (type_Paragraph != Element.GetType())
return;
// Возможно, предыдущий элемент является буквицей
if (undefined === Element.Get_FramePr())
{
var PrevElement = Element.Get_DocumentPrev();
if (type_Paragraph != PrevElement.GetType() || undefined === PrevElement.Get_FramePr() || undefined === PrevElement.Get_FramePr().DropCap)
return;
Element = PrevElement;
}
var FrameParas = Element.Internal_Get_FrameParagraphs();
var FrameCount = FrameParas.length;
for (var Pos = 0; Pos < FrameCount; Pos++)
{
FrameParas[Pos].Set_FramePr(FramePr, bDelete);
}
}
};
CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{ {
if (this.CurPos.ContentPos < 0) if (this.CurPos.ContentPos < 0)
return false; return false;
if (true === this.Selection.Use) if (true === this.Selection.Use)
{
switch (this.Selection.Flag)
{
case selectionflag_Common:
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; var EndPos = this.Selection.EndPos;
...@@ -15671,32 +15611,47 @@ CDocument.prototype.controller_SetParagraphKeepNext = function(Value) ...@@ -15671,32 +15611,47 @@ CDocument.prototype.controller_SetParagraphKeepNext = function(Value)
var Item = this.Content[Index]; var Item = this.Content[Index];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
Item.Set_KeepNext(Value); Item.IncDec_FontSize(bIncrease);
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); Item.TurnOff_RecalcEvent();
Item.Set_ParagraphKeepNext(Value); Item.Paragraph_IncDecFontSize(bIncrease);
Item.TurnOn_RecalcEvent(); Item.TurnOn_RecalcEvent();
} }
} }
break;
}
case selectionflag_Numbering:
{
var OldFontSize = this.Get_Paragraph_TextPr().FontSize;
var NewFontSize = FontSize_IncreaseDecreaseValue(bIncrease, OldFontSize);
var TextPr = new CTextPr();
TextPr.FontSize = NewFontSize;
this.Paragraph_Add(new ParaTextPr(TextPr), true);
break;
}
}
} }
else else
{ {
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
{ {
Item.Set_KeepNext(Value); Item.IncDec_FontSize(bIncrease);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
Item.Set_ParagraphKeepNext(Value); {
Item.Paragraph_IncDecFontSize(bIncrease);
}
} }
}; };
CDocument.prototype.controller_SetParagraphWidowControl = function(Value) CDocument.prototype.controller_IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{ {
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use) if (true === this.Selection.Use)
{
switch (this.Selection.Flag)
{
case selectionflag_Common:
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; var EndPos = this.Selection.EndPos;
...@@ -15709,36 +15664,49 @@ CDocument.prototype.controller_SetParagraphWidowControl = function(Value) ...@@ -15709,36 +15664,49 @@ CDocument.prototype.controller_SetParagraphWidowControl = function(Value)
for (var Index = StartPos; Index <= EndPos; Index++) for (var Index = StartPos; Index <= EndPos; Index++)
{ {
// При изменении цвета фона параграфа, не надо ничего пересчитывать this.Content[Index].IncDec_Indent(bIncrease);
var Item = this.Content[Index]; }
}
if (type_Paragraph == Item.GetType()) case selectionflag_Numbering:
Item.Set_WidowControl(Value);
else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); break;
Item.Set_ParagraphWidowControl(Value);
Item.TurnOn_RecalcEvent();
} }
} }
} }
else else
{ {
var Item = this.Content[this.CurPos.ContentPos]; this.Content[this.CurPos.ContentPos].IncDec_Indent(bIncrease);
if (type_Paragraph == Item.GetType())
{
Item.Set_WidowControl(Value);
} }
else if (type_Table == Item.GetType()) };
Item.Set_ParagraphWidowControl(Value); CDocument.prototype.controller_SetImageProps = function(Props)
{
if ((true === this.Selection.Use && this.Selection.StartPos == this.Selection.EndPos && type_Table == this.Content[this.Selection.StartPos].GetType())
|| (false == this.Selection.Use && type_Table == this.Content[this.CurPos.ContentPos].GetType()))
{
if (true == this.Selection.Use)
this.Content[this.Selection.StartPos].Set_ImageProps(Props);
else
this.Content[this.CurPos.ContentPos].Set_ImageProps(Props);
} }
}; };
CDocument.prototype.controller_SetParagraphBorders = function(Borders) CDocument.prototype.controller_SetTableProps = function(Props)
{ {
if (this.CurPos.ContentPos < 0) var Pos = -1;
return false; if (true === this.Selection.Use && this.Selection.StartPos == this.Selection.EndPos && type_Table == this.Content[this.Selection.StartPos].GetType())
Pos = this.Selection.StartPos;
else if (false === this.Selection.Use && type_Table === this.Content[this.CurPos.ContentPos].GetType())
Pos = this.CurPos.ContentPos;
if (true === this.Selection.Use) if (-1 != Pos)
{
var Table = this.Content[Pos];
Table.Set_Props(Props);
}
};
CDocument.prototype.controller_GetCurrentParaPr = function()
{
var Result_ParaPr = new CParaPr();
if (true === this.Selection.Use && selectionflag_Common === this.Selection.Flag)
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; var EndPos = this.Selection.EndPos;
...@@ -15749,151 +15717,161 @@ CDocument.prototype.controller_SetParagraphBorders = function(Borders) ...@@ -15749,151 +15717,161 @@ CDocument.prototype.controller_SetParagraphBorders = function(Borders)
EndPos = Temp; EndPos = Temp;
} }
for (var Index = StartPos; Index <= EndPos; Index++) var StartPr, Pr;
if (type_Paragraph == this.Content[StartPos].GetType())
{
StartPr = this.Content[StartPos].Get_CompiledPr2(false).ParaPr;
Pr = StartPr.Copy();
Pr.Locked = this.Content[StartPos].Lock.Is_Locked();
}
else if (type_Table == this.Content[StartPos].GetType())
{
StartPr = this.Content[StartPos].Get_Paragraph_ParaPr();
Pr = StartPr.Copy();
Pr.Locked = StartPr.Locked;
}
for (var Index = StartPos + 1; Index <= EndPos; Index++)
{ {
// При изменении цвета фона параграфа, не надо ничего пересчитывать
var Item = this.Content[Index]; var Item = this.Content[Index];
var TempPr;
if (type_Paragraph == Item.GetType()) if (type_Paragraph == Item.GetType())
Item.Set_Borders(Borders);
else if (type_Table == Item.GetType())
{ {
Item.TurnOff_RecalcEvent(); TempPr = Item.Get_CompiledPr2(false).ParaPr;
Item.Set_ParagraphBorders(Borders); TempPr.Locked = Item.Lock.Is_Locked();
Item.TurnOn_RecalcEvent();
} }
else if (type_Table == Item.GetType())
{
TempPr = Item.Get_Paragraph_ParaPr();
} }
Pr = Pr.Compare(TempPr);
} }
else
{
var Item = this.Content[this.CurPos.ContentPos]; if (undefined === Pr.Ind.Left)
if (type_Paragraph == Item.GetType()) Pr.Ind.Left = StartPr.Ind.Left;
{
// Мы должны выставить границу для всех параграфов, входящих в текущую группу параграфов
// с одинаковыми границами
var StartPos = Item.Index; if (undefined === Pr.Ind.Right)
var EndPos = Item.Index; Pr.Ind.Right = StartPr.Ind.Right;
var CurBrd = Item.Get_CompiledPr().ParaPr.Brd;
while (true != CurBrd.First) if (undefined === Pr.Ind.FirstLine)
Pr.Ind.FirstLine = StartPr.Ind.FirstLine;
Result_ParaPr = Pr;
Result_ParaPr.CanAddTable = ( true === Pr.Locked ? false : true );
// Если мы находимся в рамке, тогда дополняем ее свойства настройками границы и настройкой текста (если это буквица)
if (undefined != Result_ParaPr.FramePr && type_Paragraph === this.Content[StartPos].GetType())
this.Content[StartPos].Supplement_FramePr(Result_ParaPr.FramePr);
else if (StartPos === EndPos && StartPos > 0 && type_Paragraph === this.Content[StartPos - 1].GetType())
{ {
StartPos--; var PrevFrame = this.Content[StartPos - 1].Get_FramePr();
if (StartPos < 0) if (undefined != PrevFrame && undefined != PrevFrame.DropCap)
{ {
StartPos = 0; Result_ParaPr.FramePr = PrevFrame.Copy();
break; this.Content[StartPos - 1].Supplement_FramePr(Result_ParaPr.FramePr);
} }
var TempItem = this.Content[StartPos];
if (type_Paragraph != TempItem.GetType())
{
StartPos++;
break;
} }
CurBrd = TempItem.Get_CompiledPr().ParaPr.Brd;
} }
else
CurBrd = Item.Get_CompiledPr().ParaPr.Brd;
while (true != CurBrd.Last)
{ {
EndPos++; var Item = this.Content[this.CurPos.ContentPos];
if (EndPos >= this.Content.length) if (type_Paragraph == Item.GetType())
{ {
EndPos = this.Content.length - 1; var ParaPr = Item.Get_CompiledPr2(false).ParaPr;
break; var Locked = Item.Lock.Is_Locked();
}
var TempItem = this.Content[EndPos]; Result_ParaPr = ParaPr.Copy();
if (type_Paragraph != TempItem.GetType()) Result_ParaPr.Locked = Locked;
Result_ParaPr.CanAddTable = ( ( true === Locked ) ? ( ( true === Item.Cursor_IsEnd() ) ? true : false ) : true );
// Если мы находимся в рамке, тогда дополняем ее свойства настройками границы и настройкой текста (если это буквица)
if (undefined != Result_ParaPr.FramePr)
Item.Supplement_FramePr(Result_ParaPr.FramePr);
else if (this.CurPos.ContentPos > 0 && type_Paragraph === this.Content[this.CurPos.ContentPos - 1].GetType())
{ {
EndPos--; var PrevFrame = this.Content[this.CurPos.ContentPos - 1].Get_FramePr();
break; if (undefined != PrevFrame && undefined != PrevFrame.DropCap)
{
Result_ParaPr.FramePr = PrevFrame.Copy();
this.Content[this.CurPos.ContentPos - 1].Supplement_FramePr(Result_ParaPr.FramePr);
} }
CurBrd = TempItem.Get_CompiledPr().ParaPr.Brd;
} }
for (var Index = StartPos; Index <= EndPos; Index++)
this.Content[Index].Set_Borders(Borders);
} }
else if (type_Table == Item.GetType()) else if (type_Table == Item.GetType())
{ {
Item.Set_ParagraphBorders(Borders); Result_ParaPr = Item.Get_Paragraph_ParaPr();
}
} }
if (Result_ParaPr.Shd && Result_ParaPr.Shd.Unifill)
{
Result_ParaPr.Shd.Unifill.check(this.theme, this.Get_ColorMap());
} }
return Result_ParaPr;
}; };
CDocument.prototype.controller_SetParagraphFramePr = function(FramePr, bDelete) CDocument.prototype.controller_GetCurrentTextPr = function()
{ {
var Result_TextPr = null;
if (true === this.Selection.Use) if (true === this.Selection.Use)
{ {
// Проверим, если у нас все выделенные элементы - параграфы, с одинаковыми настройками var VisTextPr;
// FramePr, тогда мы можем применить новую настройку FramePr switch (this.Selection.Flag)
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; var EndPos = this.Selection.EndPos;
if (EndPos < StartPos)
if (StartPos > EndPos)
{ {
StartPos = this.Selection.EndPos; var Temp = StartPos;
EndPos = this.Selection.StartPos; StartPos = EndPos;
EndPos = Temp;
} }
var Element = this.Content[StartPos]; VisTextPr = this.Content[StartPos].Get_Paragraph_TextPr();
if (type_Paragraph != Element.GetType() || undefined === Element.Get_FramePr())
return;
var FramePr = Element.Get_FramePr(); for (var Index = StartPos + 1; Index <= EndPos; Index++)
for (var Pos = StartPos + 1; Pos < EndPos; Pos++)
{ {
var TempElement = this.Content[Pos]; var CurPr = this.Content[Index].Get_Paragraph_TextPr();
VisTextPr = VisTextPr.Compare(CurPr);
if (type_Paragraph != TempElement.GetType() || undefined === TempElement.Get_FramePr() || true != FramePr.Compare(TempElement.Get_FramePr()))
return;
} }
// Раз дошли до сюда, значит можно у всех выделенных параграфов менять настройку рамки break;
var FrameParas = this.Content[StartPos].Internal_Get_FrameParagraphs();
var FrameCount = FrameParas.length;
for (var Pos = 0; Pos < FrameCount; Pos++)
{
FrameParas[Pos].Set_FramePr(FramePr, bDelete);
}
} }
else case selectionflag_Numbering:
{ {
var Element = this.Content[this.CurPos.ContentPos]; // Текстовые настройки применяем к конкретной нумерации
if (null == this.Selection.Data || this.Selection.Data.length <= 0)
if (type_Paragraph != Element.GetType()) break;
return;
// Возможно, предыдущий элемент является буквицей var CurPara = this.Content[this.Selection.Data[0]];
if (undefined === Element.Get_FramePr()) for (var Index = 0; Index < this.Selection.Data.length; Index++)
{ {
var PrevElement = Element.Get_DocumentPrev(); if (this.CurPos.ContentPos === this.Selection.Data[Index])
CurPara = this.Content[this.Selection.Data[Index]];
}
if (type_Paragraph != PrevElement.GetType() || undefined === PrevElement.Get_FramePr() || undefined === PrevElement.Get_FramePr().DropCap) VisTextPr = CurPara.Internal_Get_NumberingTextPr();
return;
Element = PrevElement; break;
}
} }
Result_TextPr = VisTextPr;
var FrameParas = Element.Internal_Get_FrameParagraphs();
var FrameCount = FrameParas.length;
for (var Pos = 0; Pos < FrameCount; Pos++)
{
FrameParas[Pos].Set_FramePr(FramePr, bDelete);
} }
else
{
Result_TextPr = this.Content[this.CurPos.ContentPos].Get_Paragraph_TextPr();
} }
return Result_TextPr;
}; };
CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bIncrease) CDocument.prototype.controller_GetDirectParaPr = function()
{ {
if (this.CurPos.ContentPos < 0) var Result_ParaPr = null;
return false;
if (true === this.Selection.Use) if (true === this.Selection.Use)
{ {
...@@ -15902,37 +15880,23 @@ CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bI ...@@ -15902,37 +15880,23 @@ CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bI
case selectionflag_Common: case selectionflag_Common:
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; if (this.Selection.EndPos < StartPos)
if (EndPos < StartPos) StartPos = this.Selection.EndPos;
{
var Temp = StartPos;
StartPos = EndPos;
EndPos = Temp;
}
for (var Index = StartPos; Index <= EndPos; Index++) var Item = this.Content[StartPos];
{ Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
// При изменении цвета фона параграфа, не надо ничего пересчитывать
var Item = this.Content[Index];
if (type_Paragraph == Item.GetType())
Item.IncDec_FontSize(bIncrease);
else if (type_Table == Item.GetType())
{
Item.TurnOff_RecalcEvent();
Item.Paragraph_IncDecFontSize(bIncrease);
Item.TurnOn_RecalcEvent();
}
}
break; break;
} }
case selectionflag_Numbering: case selectionflag_Numbering:
{ {
var OldFontSize = this.Get_Paragraph_TextPr().FontSize; // Текстовые настройки применяем к конкретной нумерации
var NewFontSize = FontSize_IncreaseDecreaseValue(bIncrease, OldFontSize); if (null == this.Selection.Data || this.Selection.Data.length <= 0)
var TextPr = new CTextPr(); break;
TextPr.FontSize = NewFontSize;
this.Paragraph_Add(new ParaTextPr(TextPr), true); var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
Result_ParaPr = this.Numbering.Get_AbstractNum(NumPr.NumId).Lvl[NumPr.Lvl].ParaPr;
break; break;
} }
} }
...@@ -15940,50 +15904,54 @@ CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bI ...@@ -15940,50 +15904,54 @@ CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bI
else else
{ {
var Item = this.Content[this.CurPos.ContentPos]; var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType()) Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
{
Item.IncDec_FontSize(bIncrease);
}
else if (type_Table == Item.GetType())
{
Item.Paragraph_IncDecFontSize(bIncrease);
}
} }
return Result_ParaPr;
}; };
CDocument.prototype.controller_IncreaseOrDecreaseParagraphIndent = function(bIncrease) CDocument.prototype.controller_GetDirectTextPr = function()
{ {
var Result_TextPr = null;
if (true === this.Selection.Use) if (true === this.Selection.Use)
{ {
var VisTextPr;
switch (this.Selection.Flag) switch (this.Selection.Flag)
{ {
case selectionflag_Common: case selectionflag_Common:
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos; if (this.Selection.EndPos < StartPos)
if (EndPos < StartPos) StartPos = this.Selection.EndPos;
{
var Temp = StartPos;
StartPos = EndPos;
EndPos = Temp;
}
for (var Index = StartPos; Index <= EndPos; Index++) var Item = this.Content[StartPos];
{ VisTextPr = Item.Get_Paragraph_TextPr_Copy();
this.Content[Index].IncDec_Indent(bIncrease);
} break;
} }
case selectionflag_Numbering: case selectionflag_Numbering:
{ {
// Текстовые настройки применяем к конкретной нумерации
if (null == this.Selection.Data || this.Selection.Data.length <= 0)
break;
var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
VisTextPr = this.Numbering.Get_AbstractNum(NumPr.NumId).Lvl[NumPr.Lvl].TextPr;
break; break;
} }
} }
Result_TextPr = VisTextPr;
} }
else else
{ {
this.Content[this.CurPos.ContentPos].IncDec_Indent(bIncrease); var Item = this.Content[this.CurPos.ContentPos];
Result_TextPr = Item.Get_Paragraph_TextPr_Copy();
} }
};
return Result_TextPr;
};
CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
{ {
......
...@@ -441,7 +441,36 @@ CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphFontSize = function ...@@ -441,7 +441,36 @@ CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphFontSize = function
* @param {boolean} bIncrease * @param {boolean} bIncrease
*/ */
CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease){}; CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease){};
/**
* Устанавливаем настройки для изображений.
* @param Props
*/
CDocumentControllerBase.prototype.SetImageProps = function(Props){};
/**
* Устанавливаем настройки для таблиц.
* @param Props
*/
CDocumentControllerBase.prototype.SetTableProps = function(Props){};
/**
* Получаем текущие настройки параграфа.
* @returns {CParaPr}
*/
CDocumentControllerBase.prototype.GetCurrentParaPr = function(){var oParaPr = new CParaPr(); oParaPr.Init_Default(); return oParaPr};
/**
* Получаем текущие настройки текста.
* @returns {CTextPr}
*/
CDocumentControllerBase.prototype.GetCurrentTextPr = function(){var oTextPr = new CTextPr(); oTextPr.Init_Default(); return oTextPr};
/**
* Получаем прямые настройки параграфа.
* @returns {CParaPr}
*/
CDocumentControllerBase.prototype.GetDirectParaPr = function(){var oParaPr = new CParaPr(); oParaPr.Init_Default(); return oParaPr};
/**
* Получаем прямые настройки текста.
* @returns {CTextPr}
*/
CDocumentControllerBase.prototype.GetDirectTextPr = function(){var oTextPr = new CTextPr(); oTextPr.Init_Default(); return oTextPr};
/** /**
* Добавляем элемент в параграф. * Добавляем элемент в параграф.
* @param oItem * @param oItem
......
...@@ -237,6 +237,30 @@ CDrawingsController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncr ...@@ -237,6 +237,30 @@ CDrawingsController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncr
this.DrawingObjects.paragraphIncDecIndent(bIncrease); this.DrawingObjects.paragraphIncDecIndent(bIncrease);
} }
}; };
CDrawingsController.prototype.SetImageProps = function(Props)
{
this.DrawingObjects.setProps(Props);
};
CDrawingsController.prototype.SetTableProps = function(Props)
{
this.DrawingObjects.setTableProps(Props);
};
CDrawingsController.prototype.GetCurrentParaPr = function()
{
return this.DrawingObjects.getParagraphParaPr();
};
CDrawingsController.prototype.GetCurrentTextPr = function()
{
return this.DrawingObjects.getParagraphTextPr();
};
CDrawingsController.prototype.GetDirectParaPr = function()
{
return this.DrawingObjects.getParagraphParaPrCopy();
};
CDrawingsController.prototype.GetDirectTextPr = function()
{
return this.DrawingObjects.getParagraphTextPrCopy();
};
CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate) CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
......
...@@ -715,6 +715,86 @@ CFootnotesController.prototype.IncreaseOrDecreaseParagraphIndent = function(bInc ...@@ -715,6 +715,86 @@ CFootnotesController.prototype.IncreaseOrDecreaseParagraphIndent = function(bInc
this.CurFootnote.Paragraph_IncDecIndent(bIncrease); this.CurFootnote.Paragraph_IncDecIndent(bIncrease);
} }
}; };
CFootnotesController.prototype.SetImageProps = function(Props)
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
this.CurFootnote.Set_ImageProps(Props);
}
};
CFootnotesController.prototype.SetTableProps = function(Props)
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
this.CurFootnote.Set_TableProps(Props);
}
};
CFootnotesController.prototype.GetCurrentParaPr = function()
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
return this.CurFootnote.Get_Paragraph_ParaPr();
}
return null;
};
CFootnotesController.prototype.GetCurrentTextPr = function()
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
return this.CurFootnote.Get_Paragraph_ParaPr();
}
return null;
};
CFootnotesController.prototype.GetDirectParaPr = function()
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
return this.CurFootnote.Get_Paragraph_ParaPr_Copy();
}
return null;
};
CFootnotesController.prototype.GetDirectTextPr = function()
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
return this.CurFootnote.Get_Paragraph_TextPr_Copy();
}
return null;
};
CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate) CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
...@@ -729,6 +809,7 @@ CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate) ...@@ -729,6 +809,7 @@ CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate)
} }
}; };
function CFootEndnotePage() function CFootEndnotePage()
{ {
this.X = 0; this.X = 0;
......
...@@ -193,6 +193,30 @@ CHdrFtrController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrea ...@@ -193,6 +193,30 @@ CHdrFtrController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrea
{ {
this.HdrFtr.Paragraph_IncDecIndent(bIncrease); this.HdrFtr.Paragraph_IncDecIndent(bIncrease);
}; };
CHdrFtrController.prototype.SetImageProps = function(Props)
{
this.HdrFtr.Set_ImageProps(Props);
};
CHdrFtrController.prototype.SetTableProps = function(Props)
{
this.HdrFtr.Set_TableProps(Props);
};
CHdrFtrController.prototype.GetCurrentParaPr = function()
{
return this.HdrFtr.Get_Paragraph_ParaPr();
};
CHdrFtrController.prototype.GetCurrentTextPr = function()
{
return this.HdrFtr.Get_Paragraph_TextPr();
};
CHdrFtrController.prototype.GetDirectParaPr = function()
{
return this.HdrFtr.Get_Paragraph_ParaPr_Copy();
};
CHdrFtrController.prototype.GetDirectTextPr = function()
{
return this.HdrFtr.Get_Paragraph_TextPr_Copy();
};
CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate) CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate)
......
...@@ -169,6 +169,30 @@ CLogicDocumentController.prototype.IncreaseOrDecreaseParagraphIndent = function( ...@@ -169,6 +169,30 @@ CLogicDocumentController.prototype.IncreaseOrDecreaseParagraphIndent = function(
{ {
this.LogicDocument.controller_IncreaseOrDecreaseParagraphIndent(bIncrease); this.LogicDocument.controller_IncreaseOrDecreaseParagraphIndent(bIncrease);
}; };
CLogicDocumentController.prototype.SetImageProps = function(Props)
{
this.LogicDocument.controller_SetImageProps(Props);
};
CLogicDocumentController.prototype.SetTableProps = function(Props)
{
this.LogicDocument.controller_SetTableProps(Props);
};
CLogicDocumentController.prototype.GetCurrentParaPr = function()
{
return this.LogicDocument.controller_GetCurrentParaPr();
};
CLogicDocumentController.prototype.GetCurrentTextPr = function()
{
return this.LogicDocument.controller_GetCurrentTextPr();
};
CLogicDocumentController.prototype.GetDirectParaPr = function()
{
return this.LogicDocument.controller_GetDirectParaPr();
};
CLogicDocumentController.prototype.GetDirectTextPr = function()
{
return this.LogicDocument.controller_GetDirectTextPr();
};
CLogicDocumentController.prototype.AddToParagraph = function(oItem) CLogicDocumentController.prototype.AddToParagraph = function(oItem)
......
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