Commit c2b558f9 authored by Ilya Kirillov's avatar Ilya Kirillov

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

Рефакторинг и первоначальная реализация для сносок функций увеличения/уменьшения отступов и размера шрифта.
parent fe4ff24e
...@@ -4268,156 +4268,14 @@ CDocument.prototype.Set_ParagraphFramePr = function(FramePr, bDelete) ...@@ -4268,156 +4268,14 @@ CDocument.prototype.Set_ParagraphFramePr = function(FramePr, bDelete)
}; };
CDocument.prototype.Paragraph_IncDecFontSize = function(bIncrease) CDocument.prototype.Paragraph_IncDecFontSize = function(bIncrease)
{ {
// Работаем с колонтитулом this.Controller.IncreaseOrDecreaseParagraphFontSize(bIncrease);
if (docpostype_HdrFtr === this.CurPos.Type)
{
var bRetValue = this.HdrFtr.Paragraph_IncDecFontSize(bIncrease);
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
return bRetValue;
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
var bRetValue = this.DrawingObjects.paragraphIncDecFontSize(bIncrease);
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
return bRetValue;
}
else //if ( docpostype_Content === this.CurPos.Type )
{
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use)
{
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;
}
for (var Index = StartPos; Index <= EndPos; Index++)
{
// При изменении цвета фона параграфа, не надо ничего пересчитывать
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();
}
}
// Нам нужно пересчитать все изменения, начиная с первого элемента,
// попавшего в селект.
this.ContentLastChangePos = StartPos;
this.Recalculate(); this.Recalculate();
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
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);
this.Recalculate();
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
break;
}
}
return;
}
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
if (true === Item.IncDec_FontSize(bIncrease))
{
this.ContentLastChangePos = this.CurPos.ContentPos;
this.Recalculate();
}
}
else if (type_Table == Item.GetType())
{
Item.Paragraph_IncDecFontSize(bIncrease);
}
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
}
}; };
CDocument.prototype.Paragraph_IncDecIndent = function(bIncrease) CDocument.prototype.Paragraph_IncDecIndent = function(bIncrease)
{ {
if (docpostype_HdrFtr === this.CurPos.Type) this.Controller.IncreaseOrDecreaseParagraphIndent(bIncrease);
{
this.HdrFtr.Paragraph_IncDecIndent(bIncrease);
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
if (true != this.DrawingObjects.isSelectedText())
{
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
if (null != ParaDrawing)
{
var Paragraph = ParaDrawing.Parent;
Paragraph.IncDec_Indent(bIncrease);
}
}
else
{
this.DrawingObjects.paragraphIncDecIndent(bIncrease);
}
}
else //if ( docpostype_Content === this.CurPos.Type )
{
if (true === this.Selection.Use)
{
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;
}
for (var Index = StartPos; Index <= EndPos; Index++)
{
this.Content[Index].IncDec_Indent(bIncrease);
}
}
case selectionflag_Numbering:
{
break;
}
}
}
else
{
this.Content[this.CurPos.ContentPos].IncDec_Indent(bIncrease);
}
}
}; };
CDocument.prototype.Paragraph_SetHighlight = function(IsColor, r, g, b) CDocument.prototype.Paragraph_SetHighlight = function(IsColor, r, g, b)
{ {
...@@ -16032,6 +15890,100 @@ CDocument.prototype.controller_SetParagraphFramePr = function(FramePr, bDelete) ...@@ -16032,6 +15890,100 @@ CDocument.prototype.controller_SetParagraphFramePr = function(FramePr, bDelete)
} }
} }
}; };
CDocument.prototype.controller_IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{
if (this.CurPos.ContentPos < 0)
return false;
if (true === this.Selection.Use)
{
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;
}
for (var Index = StartPos; Index <= EndPos; Index++)
{
// При изменении цвета фона параграфа, не надо ничего пересчитывать
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;
}
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
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
Item.IncDec_FontSize(bIncrease);
}
else if (type_Table == Item.GetType())
{
Item.Paragraph_IncDecFontSize(bIncrease);
}
}
};
CDocument.prototype.controller_IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{
if (true === this.Selection.Use)
{
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;
}
for (var Index = StartPos; Index <= EndPos; Index++)
{
this.Content[Index].IncDec_Indent(bIncrease);
}
}
case selectionflag_Numbering:
{
break;
}
}
}
else
{
this.Content[this.CurPos.ContentPos].IncDec_Indent(bIncrease);
}
};
CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
{ {
......
...@@ -431,6 +431,16 @@ CDocumentControllerBase.prototype.SetParagraphBorders = function(Borders){}; ...@@ -431,6 +431,16 @@ CDocumentControllerBase.prototype.SetParagraphBorders = function(Borders){};
* @param bDelete * @param bDelete
*/ */
CDocumentControllerBase.prototype.SetParagraphFramePr = function(FramePr, bDelete){}; CDocumentControllerBase.prototype.SetParagraphFramePr = function(FramePr, bDelete){};
/**
* Уменьшаем или увеличиваем (по специальной таблице) размер шрифта в параграфе.
* @param {boolean} bIncrease
*/
CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphFontSize = function(bIncrease){};
/**
* Уменьшаем или увеличиваем (по специальной таблице) отступы в параграфе.
* @param {boolean} bIncrease
*/
CDocumentControllerBase.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease){};
/** /**
* Добавляем элемент в параграф. * Добавляем элемент в параграф.
......
...@@ -217,6 +217,26 @@ CDrawingsController.prototype.SetParagraphFramePr = function(FramePr, bDelete) ...@@ -217,6 +217,26 @@ CDrawingsController.prototype.SetParagraphFramePr = function(FramePr, bDelete)
{ {
// Не добавляем и не работаем с рамками в автофигурах // Не добавляем и не работаем с рамками в автофигурах
}; };
CDrawingsController.prototype.IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{
this.DrawingObjects.paragraphIncDecFontSize(bIncrease);
};
CDrawingsController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{
if (true != this.DrawingObjects.isSelectedText())
{
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
if (null != ParaDrawing)
{
var Paragraph = ParaDrawing.Parent;
Paragraph.IncDec_Indent(bIncrease);
}
}
else
{
this.DrawingObjects.paragraphIncDecIndent(bIncrease);
}
};
CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate) CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
......
...@@ -691,6 +691,30 @@ CFootnotesController.prototype.SetParagraphFramePr = function(FramePr, bDelete) ...@@ -691,6 +691,30 @@ CFootnotesController.prototype.SetParagraphFramePr = function(FramePr, bDelete)
{ {
// TODO: Реализовать, скорее всего ничего тут не надо делать // TODO: Реализовать, скорее всего ничего тут не надо делать
}; };
CFootnotesController.prototype.IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
this.CurFootnote.Paragraph_IncDecFontSize(bIncrease);
}
};
CFootnotesController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
this.CurFootnote.Paragraph_IncDecIndent(bIncrease);
}
};
CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate) CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
......
...@@ -185,6 +185,15 @@ CHdrFtrController.prototype.SetParagraphFramePr = function(FramePr, bDelete) ...@@ -185,6 +185,15 @@ CHdrFtrController.prototype.SetParagraphFramePr = function(FramePr, bDelete)
{ {
this.HdrFtr.Set_ParagraphFramePr(FramePr, bDelete); this.HdrFtr.Set_ParagraphFramePr(FramePr, bDelete);
}; };
CHdrFtrController.prototype.IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{
this.HdrFtr.Paragraph_IncDecFontSize(bIncrease);
};
CHdrFtrController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{
this.HdrFtr.Paragraph_IncDecIndent(bIncrease);
};
CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate) CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
......
...@@ -161,6 +161,14 @@ CLogicDocumentController.prototype.SetParagraphFramePr = function(FramePr, bDele ...@@ -161,6 +161,14 @@ CLogicDocumentController.prototype.SetParagraphFramePr = function(FramePr, bDele
{ {
this.LogicDocument.controller_SetParagraphFramePr(FramePr, bDelete); this.LogicDocument.controller_SetParagraphFramePr(FramePr, bDelete);
}; };
CLogicDocumentController.prototype.IncreaseOrDecreaseParagraphFontSize = function(bIncrease)
{
this.LogicDocument.controller_IncreaseOrDecreaseParagraphFontSize(bIncrease);
};
CLogicDocumentController.prototype.IncreaseOrDecreaseParagraphIndent = function(bIncrease)
{
this.LogicDocument.controller_IncreaseOrDecreaseParagraphIndent(bIncrease);
};
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