/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s): 
 */
 
#include "nsISupports.idl"

interface nsITextServicesDocument;

%{ C++
#define NS_FINDANDREPLACE_CONTRACTID "@mozilla.org/textservices/findandreplace;1"
%} C++

[scriptable, uuid(E0178A21-B9A2-11d4-A3FF-000064657374)]
interface nsIFindAndReplace : nsISupports
{
  [noscript] attribute nsITextServicesDocument tsDoc;
  attribute boolean findBackwards;
  attribute boolean caseSensitive;
  attribute boolean wrapFind;
  attribute boolean entireWord;
  readonly attribute boolean replaceEnabled;

  /**
   * Find some text in the current context. The implementation is
   * responsible for performing the find and highliting the text.
   * @param aFindText The text to search for.
   * @retval Returns true if an instance of aFindText was found.
   */
  boolean Find(in wstring aFindText);

  /**
   * Finds the text specified by aFindText and replaces it with
   * the text specified by aReplaceText. The implementation is responsible
   * for performing the find, replacing the text, and finding the
   * next instance.
   * @param aFindText The text to search for.
   * @param aReplaceText The text to replace aFindText with.
   * @param aAllOccurrences If true, the Replace() call will replace all
   * instances of aFindText in the document with a ReplaceText.
   * @retval Returns true if another instance of aFindText was found.
   */
  boolean Replace(in wstring aFindText, in wstring aReplaceText, in boolean aAllOccurrences);
};
