Commit 241e7393 authored by Ilya Kirillov's avatar Ilya Kirillov

Рефакторинг оставишихся функий. Теперь класс CDocument полностью работает через Controller.

parent eca88479
......@@ -5798,7 +5798,7 @@ CDocument.prototype.Get_ParentTextTransform = function()
*/
CDocument.prototype.Is_InDrawing = function(X, Y, PageIndex)
{
if (docpostype_HdrFtr === this.CurPos.Type)
if (docpostype_HdrFtr === this.Get_DocPosType())
{
return this.HdrFtr.Is_InDrawing(X, Y, PageIndex);
}
......@@ -9052,10 +9052,10 @@ CDocument.prototype.Viewer_OnChangePosition = function()
}
var Coords = this.DrawingDocument.ConvertCoordsToCursorWR(Comment_X, Comment_Y, Comment_PageNum);
editor.sync_UpdateCommentPosition(Comment.Get_Id(), Coords.X, Coords.Y);
this.Api.sync_UpdateCommentPosition(Comment.Get_Id(), Coords.X, Coords.Y);
}
this.TrackRevisionsManager.Update_VisibleChangesPosition(editor);
this.TrackRevisionsManager.Update_VisibleChangesPosition(this.Api);
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с секциями
......@@ -9086,19 +9086,9 @@ CDocument.prototype.Check_SectionLastParagraph = function()
};
CDocument.prototype.Add_SectionBreak = function(SectionBreakType)
{
var Element = null;
if (docpostype_HdrFtr === this.CurPos.Type)
{
// В колонтитуле нельзя добавить разрыв страницы
if (docpostype_Content !== this.Get_DocPosType())
return false;
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
// В автофигуре нельзя добавить разрыв страницы
return false;
}
else
{
if (true === this.Selection.Use)
{
// Если у нас есть селект, тогда ставим курсор в начало селекта
......@@ -9161,14 +9151,14 @@ CDocument.prototype.Add_SectionBreak = function(SectionBreakType)
// изменилось, надо сохранить эту информацию для пересчета, для этого мы помечаем все следующие изменения
// как не влияющие на пересчет.
History.MinorChanges = true;
this.History.MinorChanges = true;
SectPr.Copy(CurSectPr);
CurSectPr.Set_Type(SectionBreakType);
CurSectPr.Set_PageNum_Start(-1);
CurSectPr.Clear_AllHdrFtr();
History.MinorChanges = false;
this.History.MinorChanges = false;
Element.Set_SectionPr(SectPr);
Element.Refresh_RecalcData2(0, 0);
......@@ -9178,9 +9168,6 @@ CDocument.prototype.Add_SectionBreak = function(SectionBreakType)
this.Document_UpdateSelectionState();
return true;
}
return false;
};
CDocument.prototype.Get_SectionFirstPage = function(SectIndex, Page_abs)
{
......@@ -9499,16 +9486,15 @@ CDocument.prototype.Set_UseTextShd = function(bUse)
};
CDocument.prototype.Recalculate_FromStart = function(bUpdateStates)
{
var RecalculateData =
{
Inline : { Pos : 0, PageNum : 0 },
var RecalculateData = {
Inline : {Pos : 0, PageNum : 0},
Flow : [],
HdrFtr : [],
Drawings : { All: true, Map:{} }
Drawings : {All : true, Map : {}}
};
this.Reset_RecalculateCache();
this.Recalculate( false, false, RecalculateData );
this.Recalculate(false, false, RecalculateData);
if (true === bUpdateStates)
{
......@@ -9574,7 +9560,7 @@ CDocument.prototype.private_StartSelectionFromCurPos = function()
this.private_UpdateCursorXY(true, true);
var CurPara = this.Get_CurrentParagraph();
if ( null !== CurPara )
if (null !== CurPara)
{
var MouseEvent = new AscCommon.CMouseEventHandler();
......@@ -9619,28 +9605,12 @@ CDocument.prototype.private_UpdateCursorXY = function(bUpdateX, bUpdateY)
if (true !== this.Is_SelectionUse() || true === this.Selection_IsEmpty())
{
if (docpostype_Content === this.CurPos.Type)
{
var Pos = ( true === this.Selection.Use && selectionflag_Numbering !== this.Selection.Flag ? this.Selection.EndPos : this.CurPos.ContentPos );
if (Pos >= 0 && undefined !== this.Content[Pos].RecalculateCurPos && ( null === this.FullRecalc.Id || this.FullRecalc.StartIndex > Pos ))
{
this.Internal_CheckCurPage();
NewCursorPos = this.Content[Pos].RecalculateCurPos();
}
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
NewCursorPos = this.DrawingObjects.recalculateCurPos();
}
else if (docpostype_HdrFtr === this.CurPos.Type)
{
NewCursorPos = this.HdrFtr.RecalculateCurPos();
}
NewCursorPos = this.Controller.RecalculateCurPos();
if (NewCursorPos && NewCursorPos.Transform)
{
var x = NewCursorPos.Transform.TransformPointX(NewCursorPos.X, NewCursorPos.Y);
var y = NewCursorPos.Transform.TransformPointY(NewCursorPos.X, NewCursorPos.Y);
NewCursorPos.X = x;
NewCursorPos.Y = y;
}
......@@ -9688,7 +9658,6 @@ CDocument.prototype.private_UpdateCursorXY = function(bUpdateX, bUpdateY)
if (null !== CurPara)
CurPara.CurPos.RealY = RealY;
}
};
CDocument.prototype.private_MoveCursorDown = function(StartX, StartY, AddToSelect)
{
......@@ -9882,20 +9851,7 @@ CDocument.prototype.Start_SelectionFromCurPos = function()
this.Selection.Use = true;
this.Selection.Start = false;
if (docpostype_HdrFtr === this.CurPos.Type)
{
return this.HdrFtr.Start_SelectionFromCurPos();
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
return this.DrawingObjects.startSelectionFromCurPos();
}
else //if (docpostype_Content === this.CurPos.Type)
{
this.Selection.StartPos = this.CurPos.ContentPos;
this.Selection.EndPos = this.CurPos.ContentPos;
this.Content[this.CurPos.ContentPos].Start_SelectionFromCurPos();
}
this.Controller.StartSelectionFromCurPos();
};
CDocument.prototype.Is_TrackingDrawingObjects = function()
{
......@@ -9931,12 +9887,14 @@ CDocument.prototype.Get_AllParagraphs = function(Props)
this.SectionsInfo.Get_AllParagraphs(Props, ParaArray);
var Count = this.Content.length;
for ( var Index = 0; Index < Count; Index++ )
for (var Index = 0; Index < Count; Index++)
{
var Element = this.Content[Index];
Element.Get_AllParagraphs(Props, ParaArray);
}
// TODO: Добавить обработку сносок
return ParaArray;
};
CDocument.prototype.Get_AllParagraphsByNumbering = function(NumPr)
......@@ -10072,7 +10030,13 @@ CDocument.prototype.Save_DocumentStateBeforeLoadChanges = function()
Use : this.Selection.Use,
Flag : this.Selection.Flag,
UpdateOnRecalc : this.Selection.UpdateOnRecalc,
DragDrop : {Flag : this.Selection.DragDrop.Flag, Data : null === this.Selection.DragDrop.Data ? null : {X : this.Selection.DragDrop.Data.X, Y : this.Selection.DragDrop.Data.Y, PageNum : this.Selection.DragDrop.Data.PageNum}}
DragDrop : {Flag : this.Selection.DragDrop.Flag,
Data : null === this.Selection.DragDrop.Data ? null : {
X : this.Selection.DragDrop.Data.X,
Y : this.Selection.DragDrop.Data.Y,
PageNum : this.Selection.DragDrop.Data.PageNum
}
}
};
State.SingleCell = this.Get_SelectedElementsInfo().Get_SingleCell();
......@@ -10080,47 +10044,7 @@ CDocument.prototype.Save_DocumentStateBeforeLoadChanges = function()
State.StartPos = [];
State.EndPos = [];
switch (this.CurPos.Type)
{
case docpostype_HdrFtr:
{
var HdrFtr = this.HdrFtr.Get_CurHdrFtr();
if (null !== HdrFtr)
{
var HdrFtrContent = HdrFtr.Get_DocumentContent();
State.HdrFtr = HdrFtr;
State.HdrFtrDocPosType = HdrFtrContent.CurPos.Type;
State.HdrFtrSelection = HdrFtrContent.Selection.Use;
if (docpostype_Content === HdrFtrContent.CurPos.Type)
{
State.Pos = HdrFtrContent.Get_ContentPosition(false, false, undefined);
State.StartPos = HdrFtrContent.Get_ContentPosition(true, true, undefined);
State.EndPos = HdrFtrContent.Get_ContentPosition(true, false, undefined);
}
else // if (docpostype_Drawing === HdrFtrContent.CurPos.Type)
{
this.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State);
}
}
break;
}
case docpostype_DrawingObjects:
{
this.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State);
break;
}
case docpostype_Content:
{
State.Pos = this.Get_ContentPosition(false, false);
State.StartPos = this.Get_ContentPosition(true, true);
State.EndPos = this.Get_ContentPosition(true, false);
break;
}
}
this.Controller.SaveDocumentStateBeforeLoadChanges(State);
this.Selection_Remove();
return State;
};
......@@ -10137,84 +10061,13 @@ CDocument.prototype.Load_DocumentStateAfterLoadChanges = function(State)
this.Selection.Flag = State.Selection.Flag;
this.Selection.UpdateOnRecalc = State.Selection.UpdateOnRecalc;
this.Selection.DragDrop.Flag = State.Selection.DragDrop.Flag;
this.Selection.DragDrop.Data = State.Selection.DragDrop.Data === null ? null : {X : State.Selection.DragDrop.Data.X, Y : State.Selection.DragDrop.Data.X, PageNum : State.Selection.DragDrop.Data.PageNum};
switch (this.CurPos.Type)
{
case docpostype_HdrFtr:
{
var HdrFtr = State.HdrFtr;
if (null !== HdrFtr && undefined !== HdrFtr && true === HdrFtr.Is_UseInDocument())
{
this.HdrFtr.Set_CurHdrFtr(HdrFtr);
var HdrFtrContent = HdrFtr.Get_DocumentContent();
if (docpostype_Content === State.HdrFtrDocPosType)
{
HdrFtrContent.Set_DocPosType(docpostype_Content);
HdrFtrContent.Selection.Use = State.HdrFtrSelection;
if (true === HdrFtrContent.Selection.Use)
{
HdrFtrContent.Set_ContentPosition(State.StartPos, 0, 0);
HdrFtrContent.Set_ContentSelection(State.StartPos, State.EndPos, 0, 0, 0);
}
else
{
HdrFtrContent.Set_ContentPosition(State.Pos, 0, 0);
this.NeedUpdateTarget = true;
}
}
else if (docpostype_DrawingObjects === State.HdrFtrDocPosType)
{
HdrFtrContent.Set_DocPosType(docpostype_DrawingObjects);
if (true !== this.DrawingObjects.Load_DocumentStateAfterLoadChanges(State))
{
HdrFtrContent.Set_DocPosType(docpostype_Content);
this.Cursor_MoveAt(State.X ? State.X : 0, State.Y ? State.Y : 0, false);
}
}
}
else
{
this.Document_End_HdrFtrEditing();
return;
}
break;
}
case docpostype_DrawingObjects:
{
if (true !== this.DrawingObjects.Load_DocumentStateAfterLoadChanges(State))
{
this.Set_DocPosType(docpostype_Content);
var ContentPos = 0;
if (this.Pages[this.CurPage])
ContentPos = this.Pages[this.CurPage].Pos + 1;
else
ContentPos = 0;
ContentPos = Math.max(0, Math.min(this.Content.length - 1, ContentPos));
this.CurPos.ContentPos = ContentPos;
this.Content[ContentPos].Cursor_MoveToStartPos(false);
}
break;
}
case docpostype_Content:
{
if (true === this.Selection.Use)
{
this.Set_ContentPosition(State.StartPos, 0, 0);
this.Set_ContentSelection(State.StartPos, State.EndPos, 0, 0, 0);
}
else
{
this.Set_ContentPosition(State.Pos, 0, 0);
this.NeedUpdateTarget = true;
}
this.Selection.DragDrop.Data = State.Selection.DragDrop.Data === null ? null : {
X : State.Selection.DragDrop.Data.X,
Y : State.Selection.DragDrop.Data.Y,
PageNum : State.Selection.DragDrop.Data.PageNum
};
break;
}
}
this.Controller.RestoreDocumentStateAfterLoadChanges(State);
if (true === this.Selection.Use && null !== State.SingleCell && undefined !== State.SingleCell)
{
......@@ -10236,16 +10089,28 @@ CDocument.prototype.Set_ContentSelection = function(StartDocPos, EndDocPos, Dept
var StartPos = 0, EndPos = 0;
switch (StartFlag)
{
case 0 : StartPos = StartDocPos[Depth].Position; break;
case 1 : StartPos = 0; break;
case -1: StartPos = this.Content.length - 1; break;
case 0 :
StartPos = StartDocPos[Depth].Position;
break;
case 1 :
StartPos = 0;
break;
case -1:
StartPos = this.Content.length - 1;
break;
}
switch (EndFlag)
{
case 0 : EndPos = EndDocPos[Depth].Position; break;
case 1 : EndPos = 0; break;
case -1: EndPos = this.Content.length - 1; break;
case 0 :
EndPos = EndDocPos[Depth].Position;
break;
case 1 :
EndPos = 0;
break;
case -1:
EndPos = this.Content.length - 1;
break;
}
var _StartDocPos = StartDocPos, _StartFlag = StartFlag;
......@@ -10340,9 +10205,15 @@ CDocument.prototype.Set_ContentPosition = function(DocPos, Depth, Flag)
var Pos = 0;
switch (Flag)
{
case 0 : Pos = DocPos[Depth].Position; break;
case 1 : Pos = 0; break;
case -1: Pos = this.Content.length - 1; break;
case 0 :
Pos = DocPos[Depth].Position;
break;
case 1 :
Pos = 0;
break;
case -1:
Pos = this.Content.length - 1;
break;
}
var _DocPos = DocPos, _Flag = Flag;
......@@ -10380,8 +10251,10 @@ CDocument.prototype.Get_DocumentPositionFromObject = function(PosArray)
};
CDocument.prototype.Get_CursorLogicPosition = function()
{
var DocPos = null;
if (docpostype_HdrFtr === this.CurPos.Type)
// TODO: Обработка сносок
var nDocPosType = this.Get_DocPosType();
if (docpostype_HdrFtr === nDocPosType)
{
var HdrFtr = this.HdrFtr.Get_CurHdrFtr();
if (HdrFtr)
......@@ -10401,7 +10274,7 @@ CDocument.prototype.private_GetLogicDocumentPosition = function(LogicDocument)
if (!LogicDocument)
return null;
if (docpostype_DrawingObjects === LogicDocument.CurPos.Type)
if (docpostype_DrawingObjects === LogicDocument.Get_DocPosType())
{
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
var DrawingContent = this.DrawingObjects.getTargetDocContent();
......@@ -10838,7 +10711,7 @@ CDocument.prototype.private_RecalculateNumbering = function(Elements)
{
var Element = Elements[Index];
if (type_Paragraph === Element.Get_Type())
History.Add_RecalcNumPr(Element.Numbering_Get());
this.History.Add_RecalcNumPr(Element.Numbering_Get());
else if (type_Paragraph === Element.Get_Type())
{
var ParaArray = [];
......@@ -10847,7 +10720,7 @@ CDocument.prototype.private_RecalculateNumbering = function(Elements)
for (var ParaIndex = 0, ParasCount = ParaArray.length; ParaIndex < ParasCount; ++ParaIndex)
{
var Para = ParaArray[ParaIndex];
History.Add_RecalcNumPr(Element.Numbering_Get());
this.History.Add_RecalcNumPr(Element.Numbering_Get());
}
}
}
......@@ -11202,8 +11075,10 @@ CDocument.prototype.controller_RecalculateCurPos = function()
if (nPos >= 0 && undefined !== this.Content[nPos].RecalculateCurPos && (null === this.FullRecalc.Id || this.FullRecalc.StartIndex > nPos))
{
this.Internal_CheckCurPage();
this.Content[nPos].RecalculateCurPos();
return this.Content[nPos].RecalculateCurPos();
}
return {X : 0, Y : 0, Height : 0, PageNum : 0, Internal : {Line : 0, Page : 0, Range : 0}, Transform : null};
};
CDocument.prototype.controller_GetCurPage = function()
{
......@@ -15646,7 +15521,32 @@ CDocument.prototype.controller_GetSelectionAnchorPos = function()
{
var Pos = ( true === this.Selection.Use ? ( this.Selection.StartPos < this.Selection.EndPos ? this.Selection.StartPos : this.Selection.EndPos ) : this.CurPos.ContentPos );
return this.Content[Pos].Get_SelectionAnchorPos();
}
};
CDocument.prototype.controller_StartSelectionFromCurPos = function()
{
this.Selection.StartPos = this.CurPos.ContentPos;
this.Selection.EndPos = this.CurPos.ContentPos;
this.Content[this.CurPos.ContentPos].Start_SelectionFromCurPos();
};
CDocument.prototype.controller_SaveDocumentStateBeforeLoadChanges = function(State)
{
State.Pos = this.Get_ContentPosition(false, false);
State.StartPos = this.Get_ContentPosition(true, true);
State.EndPos = this.Get_ContentPosition(true, false);
};
CDocument.prototype.controller_RestoreDocumentStateAfterLoadChanges = function(State)
{
if (true === this.Selection.Use)
{
this.Set_ContentPosition(State.StartPos, 0, 0);
this.Set_ContentSelection(State.StartPos, State.EndPos, 0, 0, 0);
}
else
{
this.Set_ContentPosition(State.Pos, 0, 0);
this.NeedUpdateTarget = true;
}
};
CDocument.prototype.controller_AddToParagraph = function(ParaItem, bRecalculate)
{
......
......@@ -258,8 +258,9 @@ CDocumentControllerBase.prototype.Get_PageContentStartPos = function(PageAbs)
CDocumentControllerBase.prototype.CanTargetUpdate = function(){return true;};
/**
* Пересчитываем текущую позицию.
* @returns {{X: number, Y: number, Height: number, PageNum: number, Internal: {Line: number, Page: number, Range: number}, Transform: null}}
*/
CDocumentControllerBase.prototype.RecalculateCurPos = function(){};
CDocumentControllerBase.prototype.RecalculateCurPos = function(){return {X : 0, Y : 0, Height : 0, PageNum : 0, Internal : {Line : 0, Page : 0, Range : 0}, Transform : null};};
/**
* Получаем текущий номер страницы.
* @returns {number} -1 - значит, номер страницы определеить невозможно
......@@ -687,6 +688,20 @@ CDocumentControllerBase.prototype.CanAddComment = function(){return false;};
* @returns {{X0: number, X1: number, Y: number, Page: number}}
*/
CDocumentControllerBase.prototype.GetSelectionAnchorPos = function(){return {X0 : 0, X1 : 0, Y : 0, Page : 0};};
/**
* Начинаем селект с текущей позиции.
*/
CDocumentControllerBase.prototype.StartSelectionFromCurPos = function(){};
/**
* Сохраняем состояние документа изменения перед принятием чужих изменений.
* @param State
*/
CDocumentControllerBase.prototype.SaveDocumentStateBeforeLoadChanges = function(State){};
/**
* Восстанавливаем состояние документа после загрузки изменений.
* @param State
*/
CDocumentControllerBase.prototype.RestoreDocumentStateAfterLoadChanges = function(State){};
/**
* Добавляем элемент в параграф.
......
......@@ -26,7 +26,7 @@ CDrawingsController.prototype.CanTargetUpdate = function()
};
CDrawingsController.prototype.RecalculateCurPos = function()
{
this.DrawingObjects.recalculateCurPos();
return this.DrawingObjects.recalculateCurPos();
};
CDrawingsController.prototype.GetCurPage = function()
{
......@@ -461,6 +461,32 @@ CDrawingsController.prototype.GetSelectionAnchorPos = function()
Page : ParaDrawing.PageNum
};
};
CDrawingsController.prototype.StartSelectionFromCurPos = function()
{
this.DrawingObjects.startSelectionFromCurPos();
};
CDrawingsController.prototype.SaveDocumentStateBeforeLoadChanges = function(State)
{
this.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State);
};
CDrawingsController.prototype.RestoreDocumentStateAfterLoadChanges = function(State)
{
if (true !== this.DrawingObjects.Load_DocumentStateAfterLoadChanges(State))
{
this.Set_DocPosType(docpostype_Content);
var LogicDocument = this.LogicDocument;
var ContentPos = 0;
if (LogicDocument.Pages[LogicDocument.CurPage])
ContentPos = LogicDocument.Pages[LogicDocument.CurPage].Pos + 1;
else
ContentPos = 0;
ContentPos = Math.max(0, Math.min(LogicDocument.Content.length - 1, ContentPos));
LogicDocument.CurPos.ContentPos = ContentPos;
LogicDocument.Content[ContentPos].Cursor_MoveToStartPos(false);
}
};
CDrawingsController.prototype.AddToParagraph = function(oItem, bRecalculate)
......
......@@ -285,8 +285,11 @@ CFootnotesController.prototype.CanTargetUpdate = function()
};
CFootnotesController.prototype.RecalculateCurPos = function()
{
// TODO: Доделать селект и курсор
if (null !== this.CurFootnote)
this.CurFootnote.RecalculateCurPos();
return this.CurFootnote.RecalculateCurPos();
return {X : 0, Y : 0, Height : 0, PageNum : 0, Internal : {Line : 0, Page : 0, Range : 0}, Transform : null};
};
CFootnotesController.prototype.GetCurPage = function()
{
......@@ -1048,6 +1051,18 @@ CFootnotesController.prototype.GetSelectionAnchorPos = function()
Page : 0
};
};
CFootnotesController.prototype.StartSelectionFromCurPos = function()
{
// TODO: Реализовать
};
CFootnotesController.prototype.SaveDocumentStateBeforeLoadChanges = function(State)
{
// TODO: Реализовать
};
CFootnotesController.prototype.RestoreDocumentStateAfterLoadChanges = function(State)
{
// TODO: Реализовать
};
CFootnotesController.prototype.AddToParagraph = function(oItem, bRecalculate)
{
......
......@@ -29,7 +29,7 @@ CHdrFtrController.prototype.CanTargetUpdate = function()
};
CHdrFtrController.prototype.RecalculateCurPos = function()
{
this.HdrFtr.RecalculateCurPos();
return this.HdrFtr.RecalculateCurPos();
};
CHdrFtrController.prototype.GetCurPage = function()
{
......@@ -376,6 +376,71 @@ CHdrFtrController.prototype.GetSelectionAnchorPos = function()
{
return this.HdrFtr.Get_SelectionAnchorPos();
};
CHdrFtrController.prototype.StartSelectionFromCurPos = function()
{
this.HdrFtr.Start_SelectionFromCurPos();
};
CHdrFtrController.prototype.SaveDocumentStateBeforeLoadChanges = function(State)
{
var HdrFtr = this.HdrFtr.Get_CurHdrFtr();
if (null !== HdrFtr)
{
var HdrFtrContent = HdrFtr.Get_DocumentContent();
State.HdrFtr = HdrFtr;
State.HdrFtrDocPosType = HdrFtrContent.CurPos.Type;
State.HdrFtrSelection = HdrFtrContent.Selection.Use;
if (docpostype_Content === HdrFtrContent.Get_DocPosType())
{
State.Pos = HdrFtrContent.Get_ContentPosition(false, false, undefined);
State.StartPos = HdrFtrContent.Get_ContentPosition(true, true, undefined);
State.EndPos = HdrFtrContent.Get_ContentPosition(true, false, undefined);
}
else if (docpostype_DrawingObjects === HdrFtrContent.Get_DocPosType())
{
this.LogicDocument.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State);
}
}
};
CHdrFtrController.prototype.RestoreDocumentStateAfterLoadChanges = function(State)
{
var HdrFtr = State.HdrFtr;
if (null !== HdrFtr && undefined !== HdrFtr && true === HdrFtr.Is_UseInDocument())
{
this.HdrFtr.Set_CurHdrFtr(HdrFtr);
var HdrFtrContent = HdrFtr.Get_DocumentContent();
if (docpostype_Content === State.HdrFtrDocPosType)
{
HdrFtrContent.Set_DocPosType(docpostype_Content);
HdrFtrContent.Selection.Use = State.HdrFtrSelection;
if (true === HdrFtrContent.Selection.Use)
{
HdrFtrContent.Set_ContentPosition(State.StartPos, 0, 0);
HdrFtrContent.Set_ContentSelection(State.StartPos, State.EndPos, 0, 0, 0);
}
else
{
HdrFtrContent.Set_ContentPosition(State.Pos, 0, 0);
this.LogicDocument.NeedUpdateTarget = true;
}
}
else if (docpostype_DrawingObjects === State.HdrFtrDocPosType)
{
HdrFtrContent.Set_DocPosType(docpostype_DrawingObjects);
if (true !== this.LogicDocument.DrawingObjects.Load_DocumentStateAfterLoadChanges(State))
{
HdrFtrContent.Set_DocPosType(docpostype_Content);
this.LogicDocument.Cursor_MoveAt(State.X ? State.X : 0, State.Y ? State.Y : 0, false);
}
}
}
else
{
this.LogicDocument.Document_End_HdrFtrEditing();
}
};
CHdrFtrController.prototype.AddToParagraph = function(oItem, bRecalculate)
......
......@@ -23,7 +23,7 @@ CLogicDocumentController.prototype.CanTargetUpdate = function()
};
CLogicDocumentController.prototype.RecalculateCurPos = function()
{
this.LogicDocument.controller_RecalculateCurPos();
return this.LogicDocument.controller_RecalculateCurPos();
};
CLogicDocumentController.prototype.GetCurPage = function()
{
......@@ -349,6 +349,18 @@ CLogicDocumentController.prototype.GetSelectionAnchorPos = function()
{
return this.LogicDocument.controller_GetSelectionAnchorPos();
};
CLogicDocumentController.prototype.StartSelectionFromCurPos = function()
{
this.LogicDocument.controller_StartSelectionFromCurPos();
};
CLogicDocumentController.prototype.SaveDocumentStateBeforeLoadChanges = function(State)
{
this.LogicDocument.controller_SaveDocumentStateBeforeLoadChanges(State);
};
CLogicDocumentController.prototype.RestoreDocumentStateAfterLoadChanges = function(State)
{
this.LogicDocument.controller_RestoreDocumentStateAfterLoadChanges(State);
};
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