OSDN Git Service

am e5097951: (-s ours) am 5793dcc1: Merge "Do not merge: fix dns prefetch, multiply...
[android-x86/external-webkit.git] / WebCore / editing / TextCheckingHelper.h
1 /*
2  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef TextCheckingHelper_h
22 #define TextCheckingHelper_h
23
24 #include "EditorClient.h"
25
26 namespace WebCore {
27
28 class Range;
29
30 class TextCheckingHelper : public Noncopyable {
31 public:
32     TextCheckingHelper(EditorClient*, PassRefPtr<Range>);
33     ~TextCheckingHelper();
34
35     String findFirstMisspelling(int& firstMisspellingOffset, bool markAll, RefPtr<Range>& firstMisspellingRange);
36     String findFirstMisspellingOrBadGrammar(bool checkGrammar, bool& outIsSpelling, int& outFirstFoundOffset, GrammarDetail& outGrammarDetail);
37     String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll);
38     int findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int badGrammarPhraseLength, int startOffset, int endOffset, bool markAll);
39     void markAllMisspellings(RefPtr<Range>& firstMisspellingRange);
40     void markAllBadGrammar();
41
42     bool isUngrammatical(Vector<String>& guessesVector) const;
43     Vector<String> guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool& misspelled, bool& ungrammatical) const;
44     PassRefPtr<Range> paragraphAlignedRange(int& offsetIntoParagraphAlignedRange, String& paragraphString) const;
45 private:
46     EditorClient* m_client;
47     RefPtr<Range> m_range;
48 };
49
50 } // namespace WebCore
51
52 #endif // TextCheckingHelper_h