Exemple #1
0
        public ICmd Exec()
        {
            ICmd inverse = new RestoreBGColor(mCell, mCell.BGColor);

            mCell.BGColor = mBGColor;
            return(inverse);
        }
        /*************************************************************
        * Name: Exec(Spreadsheet ssheet)
        * Date Created: March 8, 2017
        * Date Last Modified: March 8, 2017
        * Description: Restores old color for a cell
        *************************************************************/
        public IUndoRedoCmd Exec(Spreadsheet ssheet)
        {
            Cell cell = ssheet.GetCell(m_Name);

            int old = (int)cell.BGColor;

            cell.BGColor = (uint)m_Color;

            RestoreBGColor oldBGClass = new RestoreBGColor(old, m_Name);

            return(oldBGClass);
        }
Exemple #3
0
        public void ExecuteRedo()
        {
            var      pop            = mRedoStack.Pop();
            Cell     currentCell    = pop.GetCell();
            ICmd     current        = new MultiCmd();
            MultiCmd temp           = current as MultiCmd;
            ICmd     currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor);
            ICmd     currentText    = new RestoreText(currentCell, currentCell.Text);

            temp.Add(currentText);
            temp.Add(currentBGColor);
            AddUndo(current);
            ICmd command = pop.Exec();
        }
Exemple #4
0
        public void ExecuteUndo()
        {
            var      pop            = mUndoStack.Pop(); //Get the top element of the stack
            Cell     currentCell    = pop.GetCell();
            ICmd     current        = new MultiCmd();
            MultiCmd temp           = current as MultiCmd;
            ICmd     currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor);
            ICmd     currentText    = new RestoreText(currentCell, currentCell.Text);

            temp.Add(currentText);
            temp.Add(currentBGColor);
            AddRedo(current);          //Push the current cell to the redo stack
            ICmd command = pop.Exec(); //Get the inverse action and apply to the cell
        }