michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /********************************* #includes *********************************/ michael@0: michael@0: #include "domstubs.idl" // nsIDOMElement, nsIDOMWindow michael@0: #include "nsISupports.idl" // nsISupports michael@0: michael@0: michael@0: /******************************** Declarations *******************************/ michael@0: michael@0: interface nsIDocShell; michael@0: michael@0: michael@0: /****************************** nsTypeAheadFind ******************************/ michael@0: michael@0: [scriptable, uuid(0749a445-19d3-4eb9-9d66-78eca8c6f604)] michael@0: interface nsITypeAheadFind : nsISupports michael@0: { michael@0: /****************************** Initializer ******************************/ michael@0: michael@0: /* Necessary initialization that can't happen in the constructor, either michael@0: * because function calls here may fail, or because the docShell is michael@0: * required. */ michael@0: void init(in nsIDocShell aDocShell); michael@0: michael@0: michael@0: /***************************** Core functions ****************************/ michael@0: michael@0: /* Find aSearchString in page. If aLinksOnly is true, only search the page's michael@0: * hyperlinks for the string. */ michael@0: unsigned short find(in AString aSearchString, in boolean aLinksOnly); michael@0: michael@0: /* Find another match in the page. */ michael@0: unsigned short findAgain(in boolean findBackwards, in boolean aLinksOnly); michael@0: michael@0: michael@0: /**************************** Helper functions ***************************/ michael@0: michael@0: /* Change searched docShell. This happens when e.g. we use the same michael@0: * nsITypeAheadFind object to search different tabs. */ michael@0: void setDocShell(in nsIDocShell aDocShell); michael@0: michael@0: /* Change the look of the the "found match" selection to aToggle, and repaint michael@0: * the selection. */ michael@0: void setSelectionModeAndRepaint(in short toggle); michael@0: michael@0: /* Collapse the "found match" selection to its start. Because not all michael@0: * matches are owned by the same selection controller, this doesn't michael@0: * necessarily happen automatically. */ michael@0: void collapseSelection(); michael@0: michael@0: michael@0: /******************************* Attributes ******************************/ michael@0: michael@0: readonly attribute AString searchString; michael@0: // Most recent search string michael@0: attribute boolean caseSensitive; // Searches are case sensitive michael@0: readonly attribute nsIDOMElement foundLink; michael@0: // Most recent elem found, if a link michael@0: readonly attribute nsIDOMElement foundEditable; michael@0: // Most recent elem found, if editable michael@0: readonly attribute nsIDOMWindow currentWindow; michael@0: // Window of most recent match michael@0: michael@0: michael@0: /******************************* Constants *******************************/ michael@0: michael@0: /* Find return codes */ michael@0: const unsigned short FIND_FOUND = 0; michael@0: // Successful find michael@0: const unsigned short FIND_NOTFOUND = 1; michael@0: // Unsuccessful find michael@0: const unsigned short FIND_WRAPPED = 2; michael@0: // Successful find, but wrapped around michael@0: const unsigned short FIND_PENDING = 3; michael@0: // Unknown status, find has not finished michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: michael@0: }; michael@0: michael@0: michael@0: /*****************************************************************************/