1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
24 * Conrad Carlen <ccarlen@netscape.com>
25 * Simon Fraser <sfraser@netscape.com>
26 * Akkana Peck <akkana@netscape.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #ifndef nsWebBrowserFindImpl_h__
43 #define nsWebBrowserFindImpl_h__
45 #include "nsIWebBrowserFind.h"
48 #include "nsWeakReference.h"
54 #define NS_WEB_BROWSER_FIND_CONTRACTID "@mozilla.org/embedcomp/find;1"
56 #define NS_WEB_BROWSER_FIND_CID \
57 {0x57cf9383, 0x3405, 0x11d5, {0xbe, 0x5b, 0xaa, 0x20, 0xfa, 0x2c, 0xf3, 0x7c}}
64 //*****************************************************************************
65 // class nsWebBrowserFind
66 //*****************************************************************************
68 class nsWebBrowserFind
: public nsIWebBrowserFind
,
69 public nsIWebBrowserFindInFrames
73 virtual ~nsWebBrowserFind();
79 NS_DECL_NSIWEBBROWSERFIND
81 // nsIWebBrowserFindInFrames
82 NS_DECL_NSIWEBBROWSERFINDINFRAMES
88 { return mSearchString
.Length() != 0; }
90 nsresult
SearchInFrame(nsIDOMWindow
* aWindow
, PRBool aWrapping
,
93 nsresult
OnStartSearchFrame(nsIDOMWindow
*aWindow
);
94 nsresult
OnEndSearchFrame(nsIDOMWindow
*aWindow
);
96 void GetFrameSelection(nsIDOMWindow
* aWindow
, nsISelection
** aSel
);
97 nsresult
ClearFrameSelection(nsIDOMWindow
*aWindow
);
99 nsresult
OnFind(nsIDOMWindow
*aFoundWindow
);
101 nsIDocShell
*GetDocShellFromWindow(nsIDOMWindow
*inWindow
);
103 void SetSelectionAndScroll(nsIDOMWindow
* aWindow
,
104 nsIDOMRange
* aRange
);
106 nsresult
GetRootNode(nsIDOMDocument
* aDomDoc
, nsIDOMNode
** aNode
);
107 nsresult
GetSearchLimits(nsIDOMRange
* aRange
,
108 nsIDOMRange
* aStartPt
,
110 nsIDOMDocument
* aDoc
,
113 nsresult
SetRangeAroundDocument(nsIDOMRange
* aSearchRange
,
114 nsIDOMRange
* aStartPoint
,
115 nsIDOMRange
* aEndPoint
,
116 nsIDOMDocument
* aDoc
);
120 nsString mSearchString
;
122 PRPackedBool mFindBackwards
;
123 PRPackedBool mWrapFind
;
124 PRPackedBool mEntireWord
;
125 PRPackedBool mMatchCase
;
127 PRPackedBool mSearchSubFrames
;
128 PRPackedBool mSearchParentFrames
;
130 nsWeakPtr mCurrentSearchFrame
; // who knows if windows can go away during our lifetime, hence weak
131 nsWeakPtr mRootSearchFrame
; // who knows if windows can go away during our lifetime, hence weak
132 nsWeakPtr mLastFocusedWindow
; // who knows if windows can go away during our lifetime, hence weak
134 nsCOMPtr
<nsIFind
> mFind
;