Commit a3832b6d authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented adding a paragraph elements to the new class CBlockLevelSdt.

parent c97557f1
...@@ -4052,7 +4052,7 @@ CDocument.prototype.AddInlineTable = function(Cols, Rows) ...@@ -4052,7 +4052,7 @@ CDocument.prototype.AddInlineTable = function(Cols, Rows)
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
}; };
CDocument.prototype.Add_DropCap = function(bInText) CDocument.prototype.AddDropCap = function(bInText)
{ {
// Определим параграф, к которому мы будем добавлять буквицу // Определим параграф, к которому мы будем добавлять буквицу
var Pos = -1; var Pos = -1;
...@@ -4106,7 +4106,7 @@ CDocument.prototype.Add_DropCap = function(bInText) ...@@ -4106,7 +4106,7 @@ CDocument.prototype.Add_DropCap = function(bInText)
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
} }
}; };
CDocument.prototype.Remove_DropCap = function(bDropCap) CDocument.prototype.RemoveDropCap = function(bDropCap)
{ {
var Pos = -1; var Pos = -1;
...@@ -4247,7 +4247,7 @@ CDocument.prototype.Remove_DropCap = function(bDropCap) ...@@ -4247,7 +4247,7 @@ CDocument.prototype.Remove_DropCap = function(bDropCap)
} }
} }
}; };
CDocument.prototype.Check_FramePrLastParagraph = function() CDocument.prototype.private_CheckFramePrLastParagraph = function()
{ {
var Count = this.Content.length; var Count = this.Content.length;
if (Count <= 0) if (Count <= 0)
...@@ -7469,7 +7469,7 @@ CDocument.prototype.Internal_Content_Remove = function(Position, Count, bCorrect ...@@ -7469,7 +7469,7 @@ CDocument.prototype.Internal_Content_Remove = function(Position, Count, bCorrect
this.Check_SectionLastParagraph(); this.Check_SectionLastParagraph();
// Проверим не является ли рамкой последний параграф // Проверим не является ли рамкой последний параграф
this.Check_FramePrLastParagraph(); this.private_CheckFramePrLastParagraph();
// Запоминаем, что нам нужно произвести переиндексацию элементов // Запоминаем, что нам нужно произвести переиндексацию элементов
this.private_ReindexContent(Position); this.private_ReindexContent(Position);
...@@ -11708,7 +11708,7 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) ...@@ -11708,7 +11708,7 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
{ {
// Просто перерисовываем нужные страницы // Просто перерисовываем нужные страницы
var StartPage = this.Content[StartPos].Get_StartPage_Absolute(); var StartPage = this.Content[StartPos].Get_StartPage_Absolute();
var EndPage = this.Content[EndPos].Get_StartPage_Absolute() + this.Content[EndPos].Pages.length - 1; var EndPage = this.Content[EndPos].Get_StartPage_Absolute() + this.Content[EndPos].GetPagesCount() - 1;
this.ReDraw(StartPage, EndPage); this.ReDraw(StartPage, EndPage);
} }
} }
...@@ -11771,8 +11771,8 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) ...@@ -11771,8 +11771,8 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
{ {
this.Add_NewParagraph(undefined, true); this.Add_NewParagraph(undefined, true);
var CurPos = this.CurPos.ContentPos - 1; var CurPos = this.CurPos.ContentPos - 1;
this.Content[CurPos].Cursor_MoveToStartPos(); this.Content[CurPos].MoveCursorToStartPos(false);
this.Content[CurPos].Add(ParaItem); this.Content[CurPos].AddToParagraph(ParaItem);
this.Content[CurPos].Clear_Formatting(); this.Content[CurPos].Clear_Formatting();
} }
} }
...@@ -11784,15 +11784,15 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) ...@@ -11784,15 +11784,15 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
var CurPos = this.CurPos.ContentPos; var CurPos = this.CurPos.ContentPos;
if (oCurElement && type_Paragraph === oCurElement.Get_Type() && oCurElement.IsColumnBreakOnLeft()) if (oCurElement && type_Paragraph === oCurElement.Get_Type() && oCurElement.IsColumnBreakOnLeft())
{ {
oCurElement.Add(ParaItem); oCurElement.AddToParagraph(ParaItem);
} }
else else
{ {
this.Add_NewParagraph(undefined, true); this.Add_NewParagraph(undefined, true);
CurPos = this.CurPos.ContentPos; CurPos = this.CurPos.ContentPos;
this.Content[CurPos].Cursor_MoveToStartPos(); this.Content[CurPos].MoveCursorToStartPos(false);
this.Content[CurPos].Add(ParaItem); this.Content[CurPos].AddToParagraph(ParaItem);
} }
} }
else else
...@@ -11800,8 +11800,8 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) ...@@ -11800,8 +11800,8 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
this.Add_NewParagraph(undefined, true); this.Add_NewParagraph(undefined, true);
this.Add_NewParagraph(undefined, true); this.Add_NewParagraph(undefined, true);
var CurPos = this.CurPos.ContentPos - 1; var CurPos = this.CurPos.ContentPos - 1;
this.Content[CurPos].Cursor_MoveToStartPos(); this.Content[CurPos].MoveCursorToStartPos(false);
this.Content[CurPos].Add(ParaItem); this.Content[CurPos].AddToParagraph(ParaItem);
this.Content[CurPos].Clear_Formatting(); this.Content[CurPos].Clear_Formatting();
} }
} }
...@@ -11822,7 +11822,7 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate) ...@@ -11822,7 +11822,7 @@ CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
} }
else else
{ {
Item.Add(ParaItem); Item.AddToParagraph(ParaItem);
if (false != bRecalculate && type_Paragraph == Item.GetType()) if (false != bRecalculate && type_Paragraph == Item.GetType())
{ {
......
This diff is collapsed.
...@@ -425,6 +425,10 @@ CDocumentContentElementBase.prototype.Is_Empty = function() ...@@ -425,6 +425,10 @@ CDocumentContentElementBase.prototype.Is_Empty = function()
{ {
return true; return true;
}; };
CDocumentContentElementBase.prototype.Add = function(oParaItem)
{
// TODO: Данную функцию нужно заменить на AddToParagraph
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц // Функции для работы с номерами страниц
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
...@@ -531,6 +535,10 @@ CDocumentContentElementBase.prototype.IsEmpty = function() ...@@ -531,6 +535,10 @@ CDocumentContentElementBase.prototype.IsEmpty = function()
{ {
return this.Is_Empty(); return this.Is_Empty();
}; };
CDocumentContentElementBase.prototype.AddToParagraph = function(oItem)
{
return this.Add(oItem);
};
//--------------------------------------------------------export-------------------------------------------------------- //--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {}; window['AscCommonWord'] = window['AscCommonWord'] || {};
......
...@@ -67,7 +67,7 @@ CDrawingsController.prototype.ClearParagraphFormatting = function() ...@@ -67,7 +67,7 @@ CDrawingsController.prototype.ClearParagraphFormatting = function()
}; };
CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate) CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
if (para_NewLine === oItem.Type && true === oItem.Is_PageOrColumnBreak()) if (para_NewLine === oItem.Type && true === oItem.IsPageOrColumnBreak())
return; return;
this.DrawingObjects.paragraphAdd(oItem, bRecalculate); this.DrawingObjects.paragraphAdd(oItem, bRecalculate);
......
...@@ -1409,7 +1409,7 @@ CFootnotesController.prototype.ClearParagraphFormatting = function() ...@@ -1409,7 +1409,7 @@ CFootnotesController.prototype.ClearParagraphFormatting = function()
}; };
CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate) CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
if (para_NewLine === oItem.Type && true === oItem.Is_PageOrColumnBreak()) if (para_NewLine === oItem.Type && true === oItem.IsPageOrColumnBreak())
return; return;
if (oItem instanceof ParaTextPr) if (oItem instanceof ParaTextPr)
......
...@@ -1870,7 +1870,7 @@ CHeaderFooterController.prototype = ...@@ -1870,7 +1870,7 @@ CHeaderFooterController.prototype =
Paragraph_Add : function( ParaItem, bRecalculate ) Paragraph_Add : function( ParaItem, bRecalculate )
{ {
if (para_NewLine === ParaItem.Type && true === ParaItem.Is_PageOrColumnBreak()) if (para_NewLine === ParaItem.Type && true === ParaItem.IsPageOrColumnBreak())
return; return;
if ( null != this.CurHdrFtr ) if ( null != this.CurHdrFtr )
......
...@@ -70,7 +70,7 @@ CHdrFtrController.prototype.ClearParagraphFormatting = function() ...@@ -70,7 +70,7 @@ CHdrFtrController.prototype.ClearParagraphFormatting = function()
}; };
CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate) CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate)
{ {
if (para_NewLine === oItem.Type && true === oItem.Is_PageOrColumnBreak()) if (para_NewLine === oItem.Type && true === oItem.IsPageOrColumnBreak())
return; return;
this.HdrFtr.Paragraph_Add(oItem, bRecalculate); this.HdrFtr.Paragraph_Add(oItem, bRecalculate);
......
...@@ -1099,14 +1099,6 @@ ParaNewLine.prototype = ...@@ -1099,14 +1099,6 @@ ParaNewLine.prototype =
if (break_Page === this.BreakType || break_Column === this.BreakType) if (break_Page === this.BreakType || break_Column === this.BreakType)
this.Flags = { NewLine : Reader.GetBool() }; this.Flags = { NewLine : Reader.GetBool() };
},
Is_PageOrColumnBreak : function()
{
if (break_Page === this.BreakType || break_Column === this.BreakType)
return true;
return false;
} }
}; };
ParaNewLine.prototype.IsPageOrColumnBreak = function() ParaNewLine.prototype.IsPageOrColumnBreak = function()
......
...@@ -335,6 +335,10 @@ CBlockLevelSdt.prototype.Is_Empty = function() ...@@ -335,6 +335,10 @@ CBlockLevelSdt.prototype.Is_Empty = function()
{ {
return this.Content.Is_Empty(); return this.Content.Is_Empty();
}; };
CBlockLevelSdt.prototype.Add = function(oParaItem)
{
return this.Content.Paragraph_Add(oParaItem);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr) CBlockLevelSdt.prototype.Is_HdrFtr = function(bReturnHdrFtr)
{ {
...@@ -434,6 +438,14 @@ CBlockLevelSdt.prototype.Refresh_RecalcData2 = function(CurPage) ...@@ -434,6 +438,14 @@ CBlockLevelSdt.prototype.Refresh_RecalcData2 = function(CurPage)
{ {
this.Parent.Refresh_RecalcData2(this.Index, CurPage); this.Parent.Refresh_RecalcData2(this.Index, CurPage);
}; };
CBlockLevelSdt.prototype.Check_AutoFit = function()
{
return this.Parent.Check_AutoFit();
};
CBlockLevelSdt.prototype.Is_InTable = function(bReturnTopTable)
{
return this.Parent.Is_InTable(bReturnTopTable);
};
//--------------------------------------------------------export-------------------------------------------------------- //--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {}; window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CBlockLevelSdt = CBlockLevelSdt; window['AscCommonWord'].CBlockLevelSdt = CBlockLevelSdt;
......
...@@ -1412,12 +1412,12 @@ background-repeat: no-repeat;\ ...@@ -1412,12 +1412,12 @@ background-repeat: no-repeat;\
asc_docs_api.prototype.asc_addDropCap = function(bInText) asc_docs_api.prototype.asc_addDropCap = function(bInText)
{ {
this.WordControl.m_oLogicDocument.Add_DropCap(bInText); this.WordControl.m_oLogicDocument.AddDropCap(bInText);
}; };
asc_docs_api.prototype.removeDropcap = function(bDropCap) asc_docs_api.prototype.removeDropcap = function(bDropCap)
{ {
this.WordControl.m_oLogicDocument.Remove_DropCap(bDropCap); this.WordControl.m_oLogicDocument.RemoveDropCap(bDropCap);
}; };
asc_docs_api.prototype.get_TextProps = function() asc_docs_api.prototype.get_TextProps = function()
......
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