public void ReplaceReplaceAllProblem1()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();
            FlowDocument content = LoadFlowDocument("FlowDocument1.xaml");

            System.Collections.Generic.List <Run> runs = new System.Collections.Generic.List <Run>(5);
            //FindRuns(content.Blocks, runs);
            runs.Add(new Run("aaaa"));

            RunCollectionContainer coll = new RunCollectionContainer(runs);


            finder.Query = new Query("aaaa");
            finder.FindText(coll);



            finder.ReplaceMatchCommand.Execute("ddd");
            finder.ReplaceAllMatchesCommand.Execute("ddd");
        }
        public void ReplaceAsFindWithPrependSpace()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();


            System.Collections.Generic.List <Run> runs = new System.Collections.Generic.List <Run>(5);
            //FindRuns(content.Blocks, runs);
            runs.Add(new Run("ax  ax"));
            runs.Add(new Run("T"));

            RunCollectionContainer coll = new RunCollectionContainer(runs);


            finder.Query = new Query("ax");
            finder.FindText(coll);



            finder.ReplaceAllMatchesCommand.Execute(" ax");
        }
        public void FindDoubleSpace()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();

            System.Collections.Generic.List <Run> runs = new System.Collections.Generic.List <Run>(5);
            //FindRuns(content.Blocks, runs);
            runs.Add(new Run("a  a"));
            runs.Add(new Run("T"));

            RunCollectionContainer coll = new RunCollectionContainer(runs);


            finder.Query = new Query("  ");
            finder.FindText(coll);

            finder.SelectNextMatch();


            Assert.AreEqual(1, finder.CurrentMatch.AbsoluteStart);
            Assert.AreEqual(3, finder.CurrentMatch.AbsoluteEnd);
        }
 /// <summary>
 /// New instance.
 /// </summary>
 public RunCollectionRunReader(RunCollectionContainer collection)
 {
     this.collection = collection;
 }
 public RunCollectionHighlightHandler(DependencyObject elementToHighlight, Brush bodyHighlightAdornerBrush, Pen bodyHighlightAdornerPen, Brush bodyIterativeHighlightAdornerBrush, Pen bodyIterativeHighlightAdornerPen)
     : base(elementToHighlight,bodyHighlightAdornerBrush,bodyHighlightAdornerPen,bodyIterativeHighlightAdornerBrush, bodyIterativeHighlightAdornerPen)
 {
     container = elementToHighlight as RunCollectionContainer;
 }
Esempio n. 6
0
 public RunCollectionHighlightHandler(DependencyObject elementToHighlight, Brush bodyHighlightAdornerBrush, Pen bodyHighlightAdornerPen, Brush bodyIterativeHighlightAdornerBrush, Pen bodyIterativeHighlightAdornerPen)
     : base(elementToHighlight, bodyHighlightAdornerBrush, bodyHighlightAdornerPen, bodyIterativeHighlightAdornerBrush, bodyIterativeHighlightAdornerPen)
 {
     container = elementToHighlight as RunCollectionContainer;
 }
 /// <summary>
 /// New instance.
 /// </summary>
 public RunCollectionRunReader(RunCollectionContainer collection)
 {
     this.collection = collection;
 }