protected virtual void DoSelfUndoDestroy(HCUndo aUndo) { if (aUndo.Data != null) { aUndo.Data.Dispose(); } }
protected virtual void DoUndoDestroy(HCUndo Sender) { if (Sender.Data != null) { Sender.Data.Dispose(); } }
protected void DoRedo(HCUndo sender) { if (sender is HCEditUndo) { FHScrollBar.Position = (sender as HCEditUndo).HScrollPos; FVScrollBar.Position = (sender as HCEditUndo).VScrollPos; } else if (sender is HCUndoEditGroupBegin) { FHScrollBar.Position = (sender as HCUndoEditGroupBegin).HScrollPos; FVScrollBar.Position = (sender as HCUndoEditGroupBegin).VScrollPos; } HCUndoList vUndoList = DoGetUndoList(); if (!vUndoList.GroupWorking) { HCFunction vEvent = delegate() { FData.Redo(sender); return(true); }; DataChangeByAction(vEvent); } else { FData.Redo(sender); } }
protected override void DoSelfUndoDestroy(HCUndo aUndo) { if (aUndo.Data is HCSizeUndoData) { (aUndo.Data as HCSizeUndoData).Dispose(); } base.DoSelfUndoDestroy(aUndo); }
protected override void DoUndoDestroy(HCUndo Sender) { if (Sender.Data is HCUndoSize) { (Sender.Data as HCUndoSize).Dispose(); } base.DoUndoDestroy(Sender); }
protected HCUndo DoUndoNew() { HCUndo Result = new HCUndo(); (Result as HCEditUndo).HScrollPos = FHScrollBar.Position; (Result as HCEditUndo).VScrollPos = FVScrollBar.Position; Result.Data = FData; return(Result); }
protected override void DoRedo(HCUndo Sender) { if (Sender.Data is HCUndoSize) { HCUndoSize vSizeAction = Sender.Data as HCUndoSize; this.Width = vSizeAction.NewWidth; this.Height = vSizeAction.NewHeight; } else { base.DoRedo(Sender); } }
protected void Undo_New() { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.UndoNew(); if (vUndo is HCDataUndo) { (vUndo as HCDataUndo).CaretDrawItemNo = CaretDrawItemNo; } } }
protected void UndoAction_ItemSelf(int aItemNo, int aOffset) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { vUndo.ActionAppend(HCAction.actItemSelf, aItemNo, aOffset, Items[aItemNo].ParaFirst); } } }
protected override void DoSelfRedo(HCUndo aRedo) { if (aRedo.Data is HCSizeUndoData) { HCSizeUndoData vSizeAction = aRedo.Data as HCSizeUndoData; this.Width = vSizeAction.NewWidth; this.Height = vSizeAction.NewHeight; } else { base.DoSelfRedo(aRedo); } }
/// <summary> 插入Item到指定位置 </summary> /// <param name="AItemNo">操作发生时的ItemNo</param> /// <param name="AOffset">操作发生时的Offset</param> protected void UndoAction_InsertItem(int aItemNo, int aOffset) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCItemUndoAction vItemAction = vUndo.ActionAppend(UndoActionTag.uatInsertItem, aItemNo, aOffset, Items[aItemNo].ParaFirst) as HCItemUndoAction; SaveItemToStreamAlone(Items[aItemNo], vItemAction.ItemStream); } } }
protected void UndoAction_ItemMirror(int aItemNo, int aOffset) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCItemUndoAction vItemAction = vUndo.ActionAppend(HCAction.actItemMirror, aItemNo, aOffset, Items[aItemNo].ParaFirst) as HCItemUndoAction; SaveItemToStreamAlone(vItemAction.ItemStream, Items[aItemNo]); } } }
protected void UndoAction_SetItemText(int aItemNo, int aOffset, string aNewText) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCSetItemTextUndoAction vTextAction = vUndo.ActionAppend(UndoActionTag.uatSetItemText, aItemNo, aOffset, Items[aItemNo].ParaFirst) as HCSetItemTextUndoAction; vTextAction.NewText = aNewText; } } }
protected void UndoAction_InsertText(int aItemNo, int aOffset, string aText) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCTextUndoAction vTextAction = vUndo.ActionAppend(HCAction.actInsertText, aItemNo, aOffset, Items[aItemNo].ParaFirst) as HCTextUndoAction; vTextAction.Text = aText; } } }
// 撤销恢复相关方法 protected void Undo_Resize(int ANewWidth, int ANewHeight) { if (OwnerData.Style.EnableUndo) { Undo_StartRecord(); HCUndoList vUndoList = GetSelfUndoList(); HCUndo vUndo = vUndoList[vUndoList.Count - 1]; if (vUndo != null) { HCUndoSize vUndoSize = new HCUndoSize(); vUndoSize.OldWidth = this.Width; vUndoSize.OldHeight = this.Height; vUndoSize.NewWidth = ANewWidth; vUndoSize.NewHeight = ANewHeight; vUndo.Data = vUndoSize; } } }
/// <summary> 修改Item的分页属性(修改前调用) </summary> protected void UndoAction_ItemPageBreak(int aItemNo, int aOffset, bool aNewPageBreak) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCItemPageBreakUndoAction vItemAction = new HCItemPageBreakUndoAction(); vItemAction.ItemNo = aItemNo; vItemAction.Offset = aOffset; vItemAction.OldPageBreak = Items[aItemNo].PageBreak; vItemAction.NewPageBreak = aNewPageBreak; vUndo.Actions.Add(vItemAction); } } }
protected void UndoAction_ItemStyle(int aItemNo, int aOffset, int aNewStyleNo) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCItemStyleUndoAction vItemAction = new HCItemStyleUndoAction(); vItemAction.ItemNo = aItemNo; vItemAction.Offset = aOffset; vItemAction.OldStyleNo = Items[aItemNo].StyleNo; vItemAction.NewStyleNo = aNewStyleNo; vUndo.Actions.Add(vItemAction); } } }
// 撤销恢复相关方法 protected void SelfUndo_Resize(int aNewWidth, int aNewHeight) { HCUndoList vUndoList = GetSelfUndoList(); if ((vUndoList != null) && vUndoList.Enable) { SelfUndo_New(); HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCSizeUndoData vSizeUndoData = new HCSizeUndoData(); vSizeUndoData.OldWidth = this.Width; vSizeUndoData.OldHeight = this.Height; vSizeUndoData.NewWidth = aNewWidth; vSizeUndoData.NewHeight = aNewHeight; vUndo.Data = vSizeUndoData; } } }
protected virtual void DoSelfUndo(HCUndo aUndo) { }
protected virtual void DoUndo(HCUndo Sender) { }
protected virtual void DoRedo(HCUndo Sende) { }
protected virtual void DoSelfRedo(HCUndo aRedo) { }