Exemplo n.º 1
0
        /// <summary>
        /// Finds the previous redaction mark in previous document stories of the current type (e.g. previous headers).
        /// </summary>
        /// <param name="CurrentRange">The range containing the starting point of the search. Changes to the location of the output mark if one is found.</param>
        /// <returns>True if a mark was found, otherwise False.</returns>
        private static bool FindPreviousMarkInStoryRanges(ref Word.Range CurrentRange)
        {
            object CollapseEnd = Word.WdCollapseDirection.wdCollapseEnd;

            Word.WdHeaderFooterIndex?headerFooterId = null;

            Word.Range PreviousStoryRange = RedactCommon.PreviousStoryRange(CurrentRange);
            while (PreviousStoryRange != null)
            {
                //if we're in headers/footers, we need to get our location so we can update the current view
                if (CurrentRange.StoryType != Word.WdStoryType.wdTextFrameStory)
                {
                    headerFooterId = RedactCommon.GetHeaderFooterType(CurrentRange.StoryType);
                }

                CurrentRange       = PreviousStoryRange;
                PreviousStoryRange = RedactCommon.PreviousStoryRange(CurrentRange);
                CurrentRange.Collapse(ref CollapseEnd);
                if (FindPreviousMarkInCurrentStoryRange(ref CurrentRange))
                {
                    //move the focus in the view
                    if (RedactCommon.IsHeaderFooter(CurrentRange.StoryType))
                    {
                        MoveHeaderFooterFocus(CurrentRange, RedactCommon.FindSectionWithHeaderFooter(CurrentRange.Document, CurrentRange), headerFooterId);
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Finds the previous redaction mark in current document story (e.g. this or any previous odd page footer).
 /// </summary>
 /// <param name="CurrentRange">The range containing the starting point of the search. Changes to the location of the output mark if one is found.</param>
 /// <returns>True if a mark was found, otherwise False.</returns>
 private static bool FindPreviousMarkInCurrentStory(ref Word.Range CurrentRange)
 {
     //execute the search
     if (FindPreviousMarkInCurrentStoryRange(ref CurrentRange))
     {
         return(true);
     }
     else if (RedactCommon.PreviousStoryRange(CurrentRange) != null)
     {
         return(FindPreviousMarkInStoryRanges(ref CurrentRange));
     }
     else
     {
         return(false);
     }
 }