Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Go to the next paragraph looking at the specified selection helper.
        /// </summary>
        /// <returns>A new selection for the next paragraph, or null if there is no next
        /// paragraph</returns>
        /// ------------------------------------------------------------------------------------
        private IVwSelection FindNextPara(SelectionHelper helper)
        {
            IVwRootBox rootb = helper.RootSite.RootBox;

            int level = helper.GetNumberOfLevels(SelectionHelper.SelLimitType.Top) - 1;

            while (level >= 0)
            {
                int          iBox = helper.Selection.get_BoxIndex(false, level);
                IVwSelection sel  = rootb.MakeSelInBox(helper.Selection, false, level,
                                                       iBox + 1, true, false, false);
                if (sel != null)
                {
                    return(sel);                    // We found the next paragraph
                }
                // Try the next level up
                level--;
            }

            return(null);
        }