/// ------------------------------------------------------------------------------------ /// <summary> /// Perform a single instance of a text replace /// </summary> /// <param name="sel">The current (new) selection in the view where we just did a find. /// Presumably, this matches the Find Text string.</param> /// <param name="tssReplace">The tss string that the user entered in the Replace box /// </param> /// <param name="fUseWS"></param> /// <param name="fEmptySearch"></param> /// <remarks>TODO TE-973: searching for writing systems.</remarks> /// ------------------------------------------------------------------------------------ protected void DoReplacement(IVwSelection sel, ITsString tssReplace, bool fUseWS, bool fEmptySearch) { // Get the properties we will apply, except for the writing system/ows and/or sStyleName. ITsString tssSel; bool fGotItAll; sel.GetFirstParaString(out tssSel, " ", out fGotItAll); if (!fGotItAll) return; // desperate defensive programming. // Get ORCs from selection so that they can be appended after the text has been replaced. ITsStrBldr stringBldr = tssSel.GetBldr(); ReplaceAllCollectorEnv.ReplaceString(stringBldr, tssSel, 0, tssSel.Length, tssReplace, 0, fEmptySearch, fUseWS); // finally - do the replacement sel.ReplaceWithTsString( stringBldr.GetString().get_NormalizedForm(FwNormalizationMode.knmNFD)); }