|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 /********************************* #includes *********************************/ |
|
8 |
|
9 #include "domstubs.idl" // nsIDOMElement, nsIDOMWindow |
|
10 #include "nsISupports.idl" // nsISupports |
|
11 |
|
12 |
|
13 /******************************** Declarations *******************************/ |
|
14 |
|
15 interface nsIDocShell; |
|
16 |
|
17 |
|
18 /****************************** nsTypeAheadFind ******************************/ |
|
19 |
|
20 [scriptable, uuid(0749a445-19d3-4eb9-9d66-78eca8c6f604)] |
|
21 interface nsITypeAheadFind : nsISupports |
|
22 { |
|
23 /****************************** Initializer ******************************/ |
|
24 |
|
25 /* Necessary initialization that can't happen in the constructor, either |
|
26 * because function calls here may fail, or because the docShell is |
|
27 * required. */ |
|
28 void init(in nsIDocShell aDocShell); |
|
29 |
|
30 |
|
31 /***************************** Core functions ****************************/ |
|
32 |
|
33 /* Find aSearchString in page. If aLinksOnly is true, only search the page's |
|
34 * hyperlinks for the string. */ |
|
35 unsigned short find(in AString aSearchString, in boolean aLinksOnly); |
|
36 |
|
37 /* Find another match in the page. */ |
|
38 unsigned short findAgain(in boolean findBackwards, in boolean aLinksOnly); |
|
39 |
|
40 |
|
41 /**************************** Helper functions ***************************/ |
|
42 |
|
43 /* Change searched docShell. This happens when e.g. we use the same |
|
44 * nsITypeAheadFind object to search different tabs. */ |
|
45 void setDocShell(in nsIDocShell aDocShell); |
|
46 |
|
47 /* Change the look of the the "found match" selection to aToggle, and repaint |
|
48 * the selection. */ |
|
49 void setSelectionModeAndRepaint(in short toggle); |
|
50 |
|
51 /* Collapse the "found match" selection to its start. Because not all |
|
52 * matches are owned by the same selection controller, this doesn't |
|
53 * necessarily happen automatically. */ |
|
54 void collapseSelection(); |
|
55 |
|
56 |
|
57 /******************************* Attributes ******************************/ |
|
58 |
|
59 readonly attribute AString searchString; |
|
60 // Most recent search string |
|
61 attribute boolean caseSensitive; // Searches are case sensitive |
|
62 readonly attribute nsIDOMElement foundLink; |
|
63 // Most recent elem found, if a link |
|
64 readonly attribute nsIDOMElement foundEditable; |
|
65 // Most recent elem found, if editable |
|
66 readonly attribute nsIDOMWindow currentWindow; |
|
67 // Window of most recent match |
|
68 |
|
69 |
|
70 /******************************* Constants *******************************/ |
|
71 |
|
72 /* Find return codes */ |
|
73 const unsigned short FIND_FOUND = 0; |
|
74 // Successful find |
|
75 const unsigned short FIND_NOTFOUND = 1; |
|
76 // Unsuccessful find |
|
77 const unsigned short FIND_WRAPPED = 2; |
|
78 // Successful find, but wrapped around |
|
79 const unsigned short FIND_PENDING = 3; |
|
80 // Unknown status, find has not finished |
|
81 |
|
82 |
|
83 /*************************************************************************/ |
|
84 |
|
85 }; |
|
86 |
|
87 |
|
88 /*****************************************************************************/ |