/embedding/components/find/src/nsWebBrowserFind.h

http://github.com/zpao/v8monkey · C Header · 137 lines · 60 code · 31 blank · 46 comment · 1 complexity · 4be6c5ddb606ceeeb1442c0565cfa7d1 MD5 · raw file

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * ***** BEGIN LICENSE BLOCK *****
  4. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. *
  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/
  10. *
  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
  14. * License.
  15. *
  16. * The Original Code is the Mozilla browser.
  17. *
  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.
  22. *
  23. * Contributor(s):
  24. * Conrad Carlen <ccarlen@netscape.com>
  25. * Simon Fraser <sfraser@netscape.com>
  26. * Akkana Peck <akkana@netscape.com>
  27. *
  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.
  39. *
  40. * ***** END LICENSE BLOCK ***** */
  41. #ifndef nsWebBrowserFindImpl_h__
  42. #define nsWebBrowserFindImpl_h__
  43. #include "nsIWebBrowserFind.h"
  44. #include "nsCOMPtr.h"
  45. #include "nsWeakReference.h"
  46. #include "nsIFind.h"
  47. #include "nsString.h"
  48. #define NS_WEB_BROWSER_FIND_CONTRACTID "@mozilla.org/embedcomp/find;1"
  49. #define NS_WEB_BROWSER_FIND_CID \
  50. {0x57cf9383, 0x3405, 0x11d5, {0xbe, 0x5b, 0xaa, 0x20, 0xfa, 0x2c, 0xf3, 0x7c}}
  51. class nsISelection;
  52. class nsIDOMWindow;
  53. class nsIDocShell;
  54. //*****************************************************************************
  55. // class nsWebBrowserFind
  56. //*****************************************************************************
  57. class nsWebBrowserFind : public nsIWebBrowserFind,
  58. public nsIWebBrowserFindInFrames
  59. {
  60. public:
  61. nsWebBrowserFind();
  62. virtual ~nsWebBrowserFind();
  63. // nsISupports
  64. NS_DECL_ISUPPORTS
  65. // nsIWebBrowserFind
  66. NS_DECL_NSIWEBBROWSERFIND
  67. // nsIWebBrowserFindInFrames
  68. NS_DECL_NSIWEBBROWSERFINDINFRAMES
  69. protected:
  70. bool CanFindNext()
  71. { return mSearchString.Length() != 0; }
  72. nsresult SearchInFrame(nsIDOMWindow* aWindow, bool aWrapping,
  73. bool* didFind);
  74. nsresult OnStartSearchFrame(nsIDOMWindow *aWindow);
  75. nsresult OnEndSearchFrame(nsIDOMWindow *aWindow);
  76. void GetFrameSelection(nsIDOMWindow* aWindow, nsISelection** aSel);
  77. nsresult ClearFrameSelection(nsIDOMWindow *aWindow);
  78. nsresult OnFind(nsIDOMWindow *aFoundWindow);
  79. nsIDocShell *GetDocShellFromWindow(nsIDOMWindow *inWindow);
  80. void SetSelectionAndScroll(nsIDOMWindow* aWindow,
  81. nsIDOMRange* aRange);
  82. nsresult GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode);
  83. nsresult GetSearchLimits(nsIDOMRange* aRange,
  84. nsIDOMRange* aStartPt,
  85. nsIDOMRange* aEndPt,
  86. nsIDOMDocument* aDoc,
  87. nsISelection* aSel,
  88. bool aWrap);
  89. nsresult SetRangeAroundDocument(nsIDOMRange* aSearchRange,
  90. nsIDOMRange* aStartPoint,
  91. nsIDOMRange* aEndPoint,
  92. nsIDOMDocument* aDoc);
  93. protected:
  94. nsString mSearchString;
  95. bool mFindBackwards;
  96. bool mWrapFind;
  97. bool mEntireWord;
  98. bool mMatchCase;
  99. bool mSearchSubFrames;
  100. bool mSearchParentFrames;
  101. nsWeakPtr mCurrentSearchFrame; // who knows if windows can go away during our lifetime, hence weak
  102. nsWeakPtr mRootSearchFrame; // who knows if windows can go away during our lifetime, hence weak
  103. nsWeakPtr mLastFocusedWindow; // who knows if windows can go away during our lifetime, hence weak
  104. nsCOMPtr<nsIFind> mFind;
  105. };
  106. #endif