Пример #1
0
        public override bool RemoveSelection(int selectionNum)
        {
            if (textProvider.SupportedTextSelection == SupportedTextSelection.Single || selectionNum == 0)
            {
                if (selectionNum < 0 || selectionNum >= NSelections)
                {
                    return(false);
                }
                int offset = (CaretProvider != null ? CaretProvider.CaretOffset : 0);
                ITextRangeProvider textRange = GetTextRange(offset, offset);
                textRange.Select();
                return(true);
            }
            int    startOffset, endOffset;
            string selection = GetSelection(selectionNum, out startOffset, out endOffset);

            if (selection != null && selection != String.Empty)
            {
                ITextRangeProvider textRange = GetTextRange(startOffset, endOffset);
                try {
                    textRange.RemoveFromSelection();
                } catch (InvalidOperationException e) {
                    Log.Debug(e);
                    return(false);
                }

                return(true);
            }
            return(false);
        }
Пример #2
0
 public override bool SetSelection(int selectionNum, int startOffset, int endOffset)
 {
     if (textProvider.SupportedTextSelection == SupportedTextSelection.Single)
     {
         if (selectionNum != 0 || NSelections != 1)
         {
             return(false);
         }
         ITextRangeProvider textRange = GetTextRange(startOffset, endOffset);
         textRange.Select();
         return(true);
     }
     if (!RemoveSelection(selectionNum))
     {
         return(false);
     }
     return(AddSelection(startOffset, endOffset));
 }
Пример #3
0
        public override bool AddSelection(int startOffset, int endOffset)
        {
            ITextRangeProvider textRange = GetTextRange(startOffset, endOffset);

            if (NSelections == 0)
            {
                textRange.Select();
                return(true);
            }

            try {
                textRange.AddToSelection();
            } catch (InvalidOperationException e) {
                Log.Debug(e);
                return(false);
            }
            return(true);
        }
Пример #4
0
 public void Select()
 {
     provider.Select();
 }