// ======================================== // method // ======================================== public override void Execute() { var model = GetTableModel(); var fig = GetTableFigure(); _oldModelRow = model.Rows.ElementAt(_rowIndex); _oldFigureRow = fig.TableData.Rows.ElementAt(_rowIndex); /// editorの保持とdisable _oldCellEditors = new List <Tuple <int, IEditor> >(); foreach (var cell in _oldFigureRow.Cells) { var cellFig = cell.Value; var cellEditor = cellFig.GetEditor(); var cellEditorIndex = _target.Children.IndexOf(cellEditor); _oldCellEditors.Add(Tuple.Create(cellEditorIndex, cellEditor)); cellEditor.Disable(); } /// rowのContainer.RemoveはRemoveRowAt()内で実行される /// 更新通知でMemoTableController.RefreshEditor()が呼ばれて /// figureも更新される model.RemoveRowAt(_rowIndex); }
private void ParseTR(HtmlNode node) { if (Logger.IsDebugEnabled) { Logger.Debug(string.Format("tr: {0}, {1}", node.Name, node.InnerText)); } _currentTableRow = _currentTable.AddRow(); if (!node.ChildNodes.Any(child => IsTHOrTD(child))) { /// thやtdの内trのrowspan消費 var newRowSpans = new Dictionary <int, int>(); foreach (var key in _currentRowSpans.Keys) { var rs = _currentRowSpans[key] - 1; if (rs > 1) { newRowSpans[key] = rs; } } _currentRowSpans = newRowSpans; } var colspan = 1; var rowspan = 1; var col = 0; foreach (var child in node.ChildNodes) { switch (child.Name.ToLowerInvariant()) { case "th": case "td": colspan = GetSpan(child, "colspan"); rowspan = GetSpan(child, "rowspan"); if (_isFirstRow) { for (int i = 0; i < colspan; ++i) { _currentTable.AddColumn(); } } if (_currentRowSpans.ContainsKey(col)) { var c = col; while (_currentRowSpans.ContainsKey(c)) { _currentRowSpans[c] = _currentRowSpans[c] - 1; if (_currentRowSpans[c] <= 1) { _currentRowSpans.Remove(c); } ++c; } col = c; } //if (col < _currentTableRow.Cells.Count()) { _currentCell = _currentTableRow.Cells.ElementAt(col); _currentCell.ColumnSpan = colspan; _currentCell.RowSpan = rowspan; ParseTHTD(child); //} if (rowspan > 1) { for (int c = col, clen = col + colspan; c < clen; ++c) { _currentRowSpans[c] = rowspan; } } col += colspan; break; } } /// trのth/tdより後ろにあるrowspan消費 if (col < _currentTable.ColumnCount) { var newRowSpans = new Dictionary <int, int>(); foreach (var key in _currentRowSpans.Keys) { if (key >= col) { var rs = _currentRowSpans[key] - 1; if (rs > 1) { newRowSpans[key] = rs; } } } _currentRowSpans = newRowSpans; } _currentTableRow = null; _isFirstRow = false; }
// ======================================== // method // ======================================== public override void Execute() { _createdRow = _target.InsertRow(_rowIndex); }