Example #1
0
        /// <summary>
        /// Perform the appropriate action for this unit.  If this is a parent undo unit, the
        /// parent must create an appropriate parent undo unit to contain the redo units.
        /// </summary>
        public override void Do()
        {
            UndoManager     undoManager;
            IParentUndoUnit redo;
            TextPointer     textPointerTable;
            Table           table;

            undoManager = TopContainer as UndoManager;
            redo        = null;

            textPointerTable = new TextPointer(_textContainer.Start, _cpTable, LogicalDirection.Forward);
            table            = (Table)textPointerTable.Parent;

            _columnWidths[_columnIndex] -= _resizeAmount;
            if (_columnIndex < table.ColumnCount - 1)
            {
                _columnWidths[_columnIndex + 1] += _resizeAmount;
            }

            if (undoManager != null && undoManager.IsEnabled)
            {
                redo = new ColumnResizeUndoUnit(textPointerTable, _columnIndex, _columnWidths, -_resizeAmount);
                undoManager.Open(redo);
            }

            TextRangeEditTables.EnsureTableColumnsAreFixedSize(table, _columnWidths);

            if (redo != null)
            {
                undoManager.Close(redo, UndoCloseAction.Commit);
            }
        }
        // Token: 0x06002B4B RID: 11083 RVA: 0x000C592C File Offset: 0x000C3B2C
        public override void Do()
        {
            UndoManager     undoManager    = base.TopContainer as UndoManager;
            IParentUndoUnit parentUndoUnit = null;
            TextPointer     textPointer    = new TextPointer(this._textContainer.Start, this._cpTable, LogicalDirection.Forward);
            Table           table          = (Table)textPointer.Parent;

            this._columnWidths[this._columnIndex] -= this._resizeAmount;
            if (this._columnIndex < table.ColumnCount - 1)
            {
                this._columnWidths[this._columnIndex + 1] += this._resizeAmount;
            }
            if (undoManager != null && undoManager.IsEnabled)
            {
                parentUndoUnit = new ColumnResizeUndoUnit(textPointer, this._columnIndex, this._columnWidths, -this._resizeAmount);
                undoManager.Open(parentUndoUnit);
            }
            TextRangeEditTables.EnsureTableColumnsAreFixedSize(table, this._columnWidths);
            if (parentUndoUnit != null)
            {
                undoManager.Close(parentUndoUnit, UndoCloseAction.Commit);
            }
        }