1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/embedding/components/find/src/nsWebBrowserFind.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,100 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsWebBrowserFindImpl_h__ 1.11 +#define nsWebBrowserFindImpl_h__ 1.12 + 1.13 +#include "nsIWebBrowserFind.h" 1.14 + 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsWeakReference.h" 1.17 + 1.18 +#include "nsIFind.h" 1.19 + 1.20 +#include "nsString.h" 1.21 + 1.22 +#define NS_WEB_BROWSER_FIND_CONTRACTID "@mozilla.org/embedcomp/find;1" 1.23 + 1.24 +#define NS_WEB_BROWSER_FIND_CID \ 1.25 + {0x57cf9383, 0x3405, 0x11d5, {0xbe, 0x5b, 0xaa, 0x20, 0xfa, 0x2c, 0xf3, 0x7c}} 1.26 + 1.27 +class nsISelection; 1.28 +class nsIDOMWindow; 1.29 + 1.30 +class nsIDocShell; 1.31 + 1.32 +//***************************************************************************** 1.33 +// class nsWebBrowserFind 1.34 +//***************************************************************************** 1.35 + 1.36 +class nsWebBrowserFind : public nsIWebBrowserFind, 1.37 + public nsIWebBrowserFindInFrames 1.38 +{ 1.39 +public: 1.40 + nsWebBrowserFind(); 1.41 + virtual ~nsWebBrowserFind(); 1.42 + 1.43 + // nsISupports 1.44 + NS_DECL_ISUPPORTS 1.45 + 1.46 + // nsIWebBrowserFind 1.47 + NS_DECL_NSIWEBBROWSERFIND 1.48 + 1.49 + // nsIWebBrowserFindInFrames 1.50 + NS_DECL_NSIWEBBROWSERFINDINFRAMES 1.51 + 1.52 + 1.53 +protected: 1.54 + 1.55 + bool CanFindNext() 1.56 + { return mSearchString.Length() != 0; } 1.57 + 1.58 + nsresult SearchInFrame(nsIDOMWindow* aWindow, bool aWrapping, 1.59 + bool* didFind); 1.60 + 1.61 + nsresult OnStartSearchFrame(nsIDOMWindow *aWindow); 1.62 + nsresult OnEndSearchFrame(nsIDOMWindow *aWindow); 1.63 + 1.64 + void GetFrameSelection(nsIDOMWindow* aWindow, nsISelection** aSel); 1.65 + nsresult ClearFrameSelection(nsIDOMWindow *aWindow); 1.66 + 1.67 + nsresult OnFind(nsIDOMWindow *aFoundWindow); 1.68 + 1.69 + nsIDocShell *GetDocShellFromWindow(nsIDOMWindow *inWindow); 1.70 + 1.71 + void SetSelectionAndScroll(nsIDOMWindow* aWindow, 1.72 + nsIDOMRange* aRange); 1.73 + 1.74 + nsresult GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode); 1.75 + nsresult GetSearchLimits(nsIDOMRange* aRange, 1.76 + nsIDOMRange* aStartPt, 1.77 + nsIDOMRange* aEndPt, 1.78 + nsIDOMDocument* aDoc, 1.79 + nsISelection* aSel, 1.80 + bool aWrap); 1.81 + nsresult SetRangeAroundDocument(nsIDOMRange* aSearchRange, 1.82 + nsIDOMRange* aStartPoint, 1.83 + nsIDOMRange* aEndPoint, 1.84 + nsIDOMDocument* aDoc); 1.85 + 1.86 +protected: 1.87 + 1.88 + nsString mSearchString; 1.89 + 1.90 + bool mFindBackwards; 1.91 + bool mWrapFind; 1.92 + bool mEntireWord; 1.93 + bool mMatchCase; 1.94 + 1.95 + bool mSearchSubFrames; 1.96 + bool mSearchParentFrames; 1.97 + 1.98 + nsWeakPtr mCurrentSearchFrame; // who knows if windows can go away during our lifetime, hence weak 1.99 + nsWeakPtr mRootSearchFrame; // who knows if windows can go away during our lifetime, hence weak 1.100 + nsWeakPtr mLastFocusedWindow; // who knows if windows can go away during our lifetime, hence weak 1.101 +}; 1.102 + 1.103 +#endif