michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * 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: #ifndef nsWebBrowserFindImpl_h__ michael@0: #define nsWebBrowserFindImpl_h__ michael@0: michael@0: #include "nsIWebBrowserFind.h" michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: #include "nsIFind.h" michael@0: michael@0: #include "nsString.h" michael@0: michael@0: #define NS_WEB_BROWSER_FIND_CONTRACTID "@mozilla.org/embedcomp/find;1" michael@0: michael@0: #define NS_WEB_BROWSER_FIND_CID \ michael@0: {0x57cf9383, 0x3405, 0x11d5, {0xbe, 0x5b, 0xaa, 0x20, 0xfa, 0x2c, 0xf3, 0x7c}} michael@0: michael@0: class nsISelection; michael@0: class nsIDOMWindow; michael@0: michael@0: class nsIDocShell; michael@0: michael@0: //***************************************************************************** michael@0: // class nsWebBrowserFind michael@0: //***************************************************************************** michael@0: michael@0: class nsWebBrowserFind : public nsIWebBrowserFind, michael@0: public nsIWebBrowserFindInFrames michael@0: { michael@0: public: michael@0: nsWebBrowserFind(); michael@0: virtual ~nsWebBrowserFind(); michael@0: michael@0: // nsISupports michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIWebBrowserFind michael@0: NS_DECL_NSIWEBBROWSERFIND michael@0: michael@0: // nsIWebBrowserFindInFrames michael@0: NS_DECL_NSIWEBBROWSERFINDINFRAMES michael@0: michael@0: michael@0: protected: michael@0: michael@0: bool CanFindNext() michael@0: { return mSearchString.Length() != 0; } michael@0: michael@0: nsresult SearchInFrame(nsIDOMWindow* aWindow, bool aWrapping, michael@0: bool* didFind); michael@0: michael@0: nsresult OnStartSearchFrame(nsIDOMWindow *aWindow); michael@0: nsresult OnEndSearchFrame(nsIDOMWindow *aWindow); michael@0: michael@0: void GetFrameSelection(nsIDOMWindow* aWindow, nsISelection** aSel); michael@0: nsresult ClearFrameSelection(nsIDOMWindow *aWindow); michael@0: michael@0: nsresult OnFind(nsIDOMWindow *aFoundWindow); michael@0: michael@0: nsIDocShell *GetDocShellFromWindow(nsIDOMWindow *inWindow); michael@0: michael@0: void SetSelectionAndScroll(nsIDOMWindow* aWindow, michael@0: nsIDOMRange* aRange); michael@0: michael@0: nsresult GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode); michael@0: nsresult GetSearchLimits(nsIDOMRange* aRange, michael@0: nsIDOMRange* aStartPt, michael@0: nsIDOMRange* aEndPt, michael@0: nsIDOMDocument* aDoc, michael@0: nsISelection* aSel, michael@0: bool aWrap); michael@0: nsresult SetRangeAroundDocument(nsIDOMRange* aSearchRange, michael@0: nsIDOMRange* aStartPoint, michael@0: nsIDOMRange* aEndPoint, michael@0: nsIDOMDocument* aDoc); michael@0: michael@0: protected: michael@0: michael@0: nsString mSearchString; michael@0: michael@0: bool mFindBackwards; michael@0: bool mWrapFind; michael@0: bool mEntireWord; michael@0: bool mMatchCase; michael@0: michael@0: bool mSearchSubFrames; michael@0: bool mSearchParentFrames; michael@0: michael@0: nsWeakPtr mCurrentSearchFrame; // who knows if windows can go away during our lifetime, hence weak michael@0: nsWeakPtr mRootSearchFrame; // who knows if windows can go away during our lifetime, hence weak michael@0: nsWeakPtr mLastFocusedWindow; // who knows if windows can go away during our lifetime, hence weak michael@0: }; michael@0: michael@0: #endif