public void DetermineRangeToSearch(out SearchAreaType eType)
        {
            // this is either a selection chunk or "the rest of the document" from the insertion point
            theRangeToSearch = Document.Application.Selection.Range.Duplicate;

            // to determine if this is a selection or not, see if the start and end insertation points
            //  are the same (i.e. no selection).
            // but we really don't want this to be considered a selection, if it's just one word, so
            //  make sure that there are at least two words selected before calling it a selection
            // also, if the location hasn't changed since our last Find or Replace, then it's also
            //  not a selection.
            if ((theRangeToSearch.Start == theRangeToSearch.End) ||
                !m_bLocationChanged ||
                (theRangeToSearch.Text.Trim().IndexOf(' ') == -1))
            {
                ChangeToRestOfDocument(ref theRangeToSearch, out eType);
            }
            else
            {
                eType = SearchAreaType.eSelection;
            }

            // we call this function whenever the location has changed. In both cases, we then
            //  want to restart the search from the beginning paragraph of the range.
            m_paraSearch = null;
        }
        public void ChangeToRestOfDocument(ref Word.Range aRunRange, out SearchAreaType eType)
        {
            // i.e. rest of the document
            eType = SearchAreaType.eWholeDocument;

            // we only really want to make the End = end of the document, but querying the end of the document
            //  is a very expensive call, so save the current start, call 'WholeStory' (which is inexpensive, but
            //  selects the whole document), and then reset the original start
            SearchAreaStart = aRunRange.Start;
            aRunRange.WholeStory();
            aRunRange.Start = SearchAreaStart;
        }
 private void ecTextBox_TextChanged(object sender, EventArgs e)
 {
     m_eSearchAreaType      = SearchAreaType.eUnknown;
     m_aWordByWordProcessor = null;
 }
Example #4
0
		public void DetermineRangeToSearch(out SearchAreaType eType)
		{
			// this is either a selection chunk or "the rest of the document" from the insertion point
			theRangeToSearch = Document.Application.Selection.Range.Duplicate;

			// to determine if this is a selection or not, see if the start and end insertation points
			//  are the same (i.e. no selection).
			// but we really don't want this to be considered a selection, if it's just one word, so
			//  make sure that there are at least two words selected before calling it a selection
			// also, if the location hasn't changed since our last Find or Replace, then it's also
			//  not a selection.
			if ((theRangeToSearch.Start == theRangeToSearch.End)
				|| !m_bLocationChanged
				|| (theRangeToSearch.Text.Trim().IndexOf(' ') == -1))
			{
				ChangeToRestOfDocument(ref theRangeToSearch, out eType);
			}
			else
			{
				eType = SearchAreaType.eSelection;
			}

			// we call this function whenever the location has changed. In both cases, we then
			//  want to restart the search from the beginning paragraph of the range.
			m_paraSearch = null;
		}
Example #5
0
		public void ChangeToRestOfDocument(ref Word.Range aRunRange, out SearchAreaType eType)
		{
			// i.e. rest of the document
			eType = SearchAreaType.eWholeDocument;

			// we only really want to make the End = end of the document, but querying the end of the document
			//  is a very expensive call, so save the current start, call 'WholeStory' (which is inexpensive, but
			//  selects the whole document), and then reset the original start
			SearchAreaStart = aRunRange.Start;
			aRunRange.WholeStory();
			aRunRange.Start = SearchAreaStart;
		}
Example #6
0
		private void ecTextBox_TextChanged(object sender, EventArgs e)
		{
			m_eSearchAreaType = SearchAreaType.eUnknown;
			m_aWordByWordProcessor = null;
		}