~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/embedding/components/find/src/nsFind.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is mozilla.org code.
 
16
 *
 
17
 * The Initial Developer of the Original Code is 
 
18
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *   Akkana Peck   <akkana@netscape.com>
 
24
 *
 
25
 *
 
26
 * Alternatively, the contents of this file may be used under the terms of
 
27
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
28
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
30
 * of those above. If you wish to allow use of your version of this file only
 
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
32
 * use your version of this file under the terms of the NPL, indicate your
 
33
 * decision by deleting the provisions above and replace them with the notice
 
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
35
 * the provisions above, a recipient may use your version of this file under
 
36
 * the terms of any one of the NPL, the GPL or the LGPL.
 
37
 *
 
38
 * ***** END LICENSE BLOCK ***** */
 
39
 
 
40
#ifndef nsFind_h__
 
41
#define nsFind_h__
 
42
 
 
43
#include "nsIFind.h"
 
44
 
 
45
#include "nsCOMPtr.h"
 
46
#include "nsIDOMNode.h"
 
47
#include "nsIDOMRange.h"
 
48
#include "nsIContentIterator.h"
 
49
#include "nsIParserService.h"
 
50
#include "nsIWordBreaker.h"
 
51
 
 
52
class nsIPresShell;
 
53
class nsIAtom;
 
54
 
 
55
#define NS_FIND_CONTRACTID "@mozilla.org/embedcomp/rangefind;1"
 
56
 
 
57
#define NS_FIND_CID \
 
58
 {0x471f4944, 0x1dd2, 0x11b2, {0x87, 0xac, 0x90, 0xbe, 0x0a, 0x51, 0xd6, 0x09}}
 
59
 
 
60
class nsFind : public nsIFind
 
61
{
 
62
public:
 
63
  NS_DECL_ISUPPORTS
 
64
  NS_DECL_NSIFIND
 
65
 
 
66
  nsFind();
 
67
  virtual ~nsFind();
 
68
 
 
69
protected:
 
70
  static PRInt32 sInstanceCount;
 
71
 
 
72
  // HTML tags we treat specially
 
73
  static nsIAtom* sTextAtom;
 
74
  static nsIAtom* sImgAtom;
 
75
  static nsIAtom* sHRAtom;
 
76
  // Nodes we skip
 
77
  static nsIAtom* sCommentAtom;
 
78
  static nsIAtom* sScriptAtom;
 
79
  static nsIAtom* sNoframesAtom;
 
80
  static nsIAtom* sSelectAtom;
 
81
  static nsIAtom* sTextareaAtom;
 
82
  static nsIAtom* sThAtom;
 
83
  static nsIAtom* sTdAtom;
 
84
 
 
85
  // Parameters set from the interface:
 
86
  //nsCOMPtr<nsIDOMRange> mRange;   // search only in this range
 
87
  PRPackedBool mFindBackward;
 
88
  PRPackedBool mCaseSensitive;
 
89
 
 
90
  nsCOMPtr<nsIWordBreaker> mWordBreaker;
 
91
  nsCOMPtr<nsIParserService> mParserService;
 
92
 
 
93
  PRInt32 mIterOffset;
 
94
  nsCOMPtr<nsIDOMNode> mIterNode;
 
95
 
 
96
  // Last block parent, so that we will notice crossing block boundaries:
 
97
  nsCOMPtr<nsIDOMNode> mLastBlockParent;
 
98
  nsresult GetBlockParent(nsIDOMNode* aNode, nsIDOMNode** aParent);
 
99
 
 
100
  // Utility routines:
 
101
  PRBool IsTextNode(nsIDOMNode* aNode);
 
102
  PRBool IsBlockNode(nsIContent* aNode);
 
103
  PRBool SkipNode(nsIContent* aNode);
 
104
  PRBool IsVisibleNode(nsIDOMNode *aNode);
 
105
 
 
106
  // Move in the right direction for our search:
 
107
  nsresult NextNode(nsIDOMRange* aSearchRange,
 
108
                    nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint,
 
109
                    PRBool aContinueOk);
 
110
 
 
111
  // Reset variables before returning -- don't hold any references.
 
112
  void ResetAll();
 
113
 
 
114
  // The iterator we use to move through the document:
 
115
  nsresult InitIterator(nsIDOMRange* aSearchRange);
 
116
  nsCOMPtr<nsIContentIterator> mIterator;
 
117
};
 
118
 
 
119
#endif // nsFind_h__