/// <summary> /// 删除对应数据 /// </summary> /// <param name="p_args"></param> /// <param name="p_headerType"></param> /// <param name="p_mat"></param> /// <param name="p_title"></param> void DelRows(SubTitleCmdArgs p_args, RptMtxHeaderType p_headerType, RptMatrix p_mat, RptMtxSubtitle p_title) { if ((p_title.Parent is RptMtxLevel && (p_title.Parent as RptMtxLevel).SubTitles.Count > 1) || (p_title.Parent is RptMtxSubtitle && (p_title.Parent as RptMtxSubtitle).SubTitles.Count > 1)) { if (p_headerType == RptMtxHeaderType.Row) { int index = -1; List <RptMtxRow> opsRows = p_title.GetRptRows(out index); if (opsRows != null) { p_args.OpsRows = opsRows; p_args.CurIndex = index; p_mat.Rows.RemoveRange(index, p_title.RowSpan); } } else { int index = -1; Dictionary <RptMtxRow, List <RptText> > opsCells = p_title.GetRptCells(out index); if (opsCells != null) { foreach (RptMtxRow row in opsCells.Keys) { row.Cells.RemoveRange(index, p_title.ColSpan); } p_args.CurIndex = index; p_args.OpsCells = opsCells; } } } }
public override void Undo(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptMtxSubtitle title = args.SubTitle; RptMatrix mtx = title.Level.Matrix; title.Span = args.OldSpan; mtx.Update(true); }
public override object Execute(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptMtxSubtitle title = args.SubTitle; RptMatrix mtx = title.Level.Matrix; args.OldSpan = title.Span; title.Span = args.NewSpan; mtx.Update(true); return(null); }
public override void Undo(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptMtxSubtitle title = args.SubTitle; RptItemBase parent = args.Parent; RptMatrix mtx = null; if (parent is RptMtxLevel) { RptMtxLevel pLevel = parent as RptMtxLevel; mtx = pLevel.Matrix; args.BackMtxRow(); pLevel.SubTitles.Insert(args.TilteIndex, title); } else { RptMtxSubtitle pTotal = parent as RptMtxSubtitle; mtx = pTotal.Level.Matrix; args.BackMtxRow(); pTotal.SubTitles.Insert(args.TilteIndex, title); } mtx.Update(true); }
public override void Undo(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptMtxSubtitle title = args.SubTitle; RptItemBase parent = args.Parent; RptMatrix mtx = null; if (parent is RptMtxLevel) { RptMtxLevel pLevel = parent as RptMtxLevel; mtx = pLevel.Matrix; args.DelMtxRows(); pLevel.SubTitles.Remove(title); } else { RptMtxSubtitle pTitle = parent as RptMtxSubtitle; mtx = pTitle.Level.Matrix; args.DelMtxRows(); pTitle.SubTitles.Remove(title); } mtx.Update(true); }
public override object Execute(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptItemBase parent = args.Parent; RptMtxSubtitle title = args.SubTitle; RptMtxHeaderType headerType = RptMtxHeaderType.Col; RptMatrix mtx = null; args.InitData(); if (parent is RptMtxLevel) { RptMtxLevel pLevel = parent as RptMtxLevel; mtx = pLevel.Matrix; if (pLevel.Parent is RptMtxRowHeader) { headerType = RptMtxHeaderType.Row; } DelRows(args, headerType, mtx, title); args.TilteIndex = pLevel.SubTitles.IndexOf(title); pLevel.SubTitles.Remove(title); } else { RptMtxSubtitle pTotal = parent as RptMtxSubtitle; mtx = pTotal.Level.Matrix; if (pTotal.Level.Parent is RptMtxRowHeader) { headerType = RptMtxHeaderType.Row; } DelRows(args, headerType, mtx, title); args.TilteIndex = pTotal.SubTitles.IndexOf(title); pTotal.SubTitles.Remove(title); } mtx.Update(true); return(null); }
public override object Execute(object p_args) { SubTitleCmdArgs args = (SubTitleCmdArgs)p_args; RptItemBase parent = args.Parent; RptMtxHeaderType headerType = RptMtxHeaderType.Col; RptMtxSubtitle title = args.SubTitle; RptMatrix mtx = null; if (title == null) { title = new RptMtxSubtitle(parent); args.InitData(); if (parent is RptMtxLevel) { RptMtxLevel pLevel = parent as RptMtxLevel; mtx = pLevel.Matrix; if (pLevel.Parent is RptMtxRowHeader) { headerType = RptMtxHeaderType.Row; } title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle()); RptMtxHeader header = pLevel.Parent as RptMtxHeader; if (pLevel.SubTitles.Count > 0 || header.Levels.Count > header.Levels.IndexOf(pLevel) + 1) { int curIndex = 0; if (headerType == RptMtxHeaderType.Row) { int subLevelSpan = 0; if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1) { subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].RowSpan; } curIndex = pLevel.Row - mtx.ColHeader.Row - mtx.ColHeader.RowSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles); args.OpsRows.Add(InsertNewRow(mtx, curIndex)); } else { int subLevelSpan = 0; if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1) { subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].ColSpan; } curIndex = pLevel.Col - mtx.RowHeader.Col - mtx.RowHeader.ColSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles); foreach (RptMtxRow row in mtx.Rows) { args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList()); } } args.CurIndex = curIndex; } pLevel.SubTitles.Add(title); } else { RptMtxSubtitle pTitle = parent as RptMtxSubtitle; mtx = pTitle.Level.Matrix; if (pTitle.Level.Parent is RptMtxRowHeader) { headerType = RptMtxHeaderType.Row; } title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle()); if (pTitle.SubTitles.Count > 0) { int curIndex = 0; if (headerType == RptMtxHeaderType.Row) { curIndex = pTitle.Row + pTitle.RowSpan - mtx.ColHeader.Row - mtx.ColHeader.RowSpan; args.OpsRows.Add(InsertNewRow(mtx, curIndex)); } else { curIndex = pTitle.Col + pTitle.ColSpan - mtx.RowHeader.Col - mtx.RowHeader.ColSpan; foreach (RptMtxRow row in mtx.Rows) { args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList()); } } args.CurIndex = curIndex; } pTitle.SubTitles.Add(title); } args.SubTitle = title; } else { mtx = title.Level.Matrix; if (parent is RptMtxLevel) { args.BackMtxRow(); (parent as RptMtxLevel).SubTitles.Add(title); } else { (parent as RptMtxSubtitle).SubTitles.Add(title); } } mtx.Update(true); return(title); }