Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Reverses (or "un-does") an action.
        /// </summary>
        /// <param name="fRefreshPending">Ignored</param>
        /// ------------------------------------------------------------------------------------
        public override bool Undo(bool fRefreshPending)
        {
            m_reviewedList.Remove(m_differenceRef);
            m_differenceList.Insert(m_index, m_differenceClone);
            // move to the difference that was just inserted
            System.Diagnostics.Debug.Assert(m_index < m_differenceList.Count);
            m_differenceList.CurrentDifferenceIndex = m_index;

            // Only adjust following diff details if it was actually reverted and the current diff
            // type is not a para style change. For a para style change, the text of the paragraph
            // doesn't change, so we shouldn't adjust anything (TE-6336).
            if (m_fReverted && (m_differenceClone.DiffType != DifferenceType.ParagraphStyleDifference))
            {
                int offset = (m_differenceClone.IchLimCurr - m_differenceClone.IchMinCurr) -
                             (m_differenceClone.IchLimRev - m_differenceClone.IchMinRev);
                m_differenceList.AdjustFollowingDiffsForUndo(m_index, m_differenceClone.HvoCurr, offset);
            }
            return(true);
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Re-applies (or "re-does") an action.
        /// </summary>
        /// <param name="fRefreshPending">Ignored</param>
        /// ------------------------------------------------------------------------------------
        public override bool Redo(bool fRefreshPending)
        {
            if (m_fReverted)
            {
                int offset = (m_differenceClone.IchLimRev - m_differenceClone.IchMinRev) -
                             (m_differenceClone.IchLimCurr - m_differenceClone.IchMinCurr);
                m_differenceList.AdjustFollowingDiffsForUndo(m_index, m_differenceClone.HvoCurr, offset);
            }

            m_differenceList.Remove(m_differenceClone);
            m_reviewedList.Add(m_differenceClone);
            m_differenceRef = m_differenceClone;

            // This moves to the difference immediately following the difference that was just
            // removed from the list. This may not be the final design. But, until further
            // customer comments, this will just have to be.
            if (m_index < m_differenceList.Count)
            {
                m_differenceList.CurrentDifferenceIndex = m_index;
            }
            return(true);
        }