Commit 9363b005 authored by sfalken's avatar sfalken

2007-04-24 Steve Falkenburg <sfalken@apple.com>

        Reviewed by Darin, Oliver.

        Refactor spelling codepaths

        * bridge/EditorClient.h:
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        * platform/ContextMenu.cpp:
        (WebCore::ContextMenu::populate):
        (WebCore::ContextMenu::checkOrEnableIfNeeded):
        * platform/gdk/EditorClientGdk.cpp:
        (WebCore::EditorClientGdk::ignoreWordInSpellDocument):
        (WebCore::EditorClientGdk::learnWord):
        (WebCore::EditorClientGdk::checkSpellingOfString):
        (WebCore::EditorClientGdk::checkGrammarOfString):
        (WebCore::EditorClientGdk::udpateSpellingUIWithGrammarString):
        (WebCore::EditorClientGdk::updateSpellingUIWithMisspelledWord):
        (WebCore::EditorClientGdk::showSpellingUI):
        (WebCore::EditorClientGdk::spellingUIIsShowing):
        (WebCore::EditorClientGdk::getGuessesForWord):
        * platform/gdk/EditorClientGdk.h:

2007-04-24  Steve Falkenburg  <sfalken@apple.com>

        Reviewed by Oliver.
        
        Spelling and grammar stubs

        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::EditorClientQt::ignoreWordInSpellDocument):
        (WebCore::EditorClientQt::learnWord):
        (WebCore::EditorClientQt::checkSpellingOfString):
        (WebCore::EditorClientQt::checkGrammarOfString):
        (WebCore::EditorClientQt::udpateSpellingUIWithGrammarString):
        (WebCore::EditorClientQt::updateSpellingUIWithMisspelledWord):
        (WebCore::EditorClientQt::showSpellingUI):
        (WebCore::EditorClientQt::spellingUIIsShowing):
        (WebCore::EditorClientQt::getGuessesForWord):
        * WebCoreSupport/EditorClientQt.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ff683654
2007-04-24 Steve Falkenburg <sfalken@apple.com>
Reviewed by Darin, Oliver.
Refactor spelling codepaths
* bridge/EditorClient.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* platform/ContextMenu.cpp:
(WebCore::ContextMenu::populate):
(WebCore::ContextMenu::checkOrEnableIfNeeded):
* platform/gdk/EditorClientGdk.cpp:
(WebCore::EditorClientGdk::ignoreWordInSpellDocument):
(WebCore::EditorClientGdk::learnWord):
(WebCore::EditorClientGdk::checkSpellingOfString):
(WebCore::EditorClientGdk::checkGrammarOfString):
(WebCore::EditorClientGdk::udpateSpellingUIWithGrammarString):
(WebCore::EditorClientGdk::updateSpellingUIWithMisspelledWord):
(WebCore::EditorClientGdk::showSpellingUI):
(WebCore::EditorClientGdk::spellingUIIsShowing):
(WebCore::EditorClientGdk::getGuessesForWord):
* platform/gdk/EditorClientGdk.h:
2007-04-24 Darin Adler <darin@apple.com>
Reviewed by Adele.
......@@ -28,8 +28,10 @@
#define EditorClient_h
#include "EditorInsertAction.h"
#include "PlatformString.h"
#include "TextAffinity.h"
#include <wtf/Forward.h>
#include <wtf/Vector.h>
#if PLATFORM(MAC)
class NSArray;
......@@ -48,7 +50,16 @@ class HTMLElement;
class KeyboardEvent;
class Node;
class Range;
class Selection;
class String;
class VisiblePosition;
struct GrammarDetail {
int location;
int length;
Vector<String> guesses;
String userDescription;
};
class EditorClient {
public:
......@@ -117,6 +128,16 @@ public:
#ifdef BUILDING_ON_TIGER
virtual NSArray* pasteboardTypesForSelection(Frame*) = 0;
#endif
#else
virtual void ignoreWordInSpellDocument(const String&) = 0;
virtual void learnWord(const String&) = 0;
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
virtual void udpateSpellingUIWithGrammarString(const String&, const Vector<String>& guesses) = 0;
virtual void updateSpellingUIWithMisspelledWord(const String&) = 0;
virtual void showSpellingUI(bool show) = 0;
virtual bool spellingUIIsShowing() = 0;
virtual void getGuessesForWord(const String&, Vector<String>& guesses) = 0;
#endif
};
......
......@@ -243,6 +243,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagSearchInSpotlight:
m_client->searchWithSpotlight();
break;
#endif
case ContextMenuItemTagShowSpellingPanel:
frame->editor()->showSpellingGuessPanel();
break;
......@@ -257,6 +258,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
frame->editor()->toggleGrammarChecking();
break;
#endif
#if PLATFORM(MAC)
case ContextMenuItemTagShowFonts:
frame->editor()->showFontPanel();
break;
......
......@@ -336,7 +336,6 @@ void ContextMenu::populate()
if (!inPasswordField) {
appendItem(*separatorItem());
#if PLATFORM(MAC)
#ifndef BUILDING_ON_TIGER
ContextMenuItem SpellingAndGrammarMenuItem(SubmenuType, ContextMenuItemTagSpellingMenu,
contextMenuItemTagSpellingMenu());
......@@ -347,7 +346,6 @@ void ContextMenu::populate()
contextMenuItemTagSpellingMenu());
createAndAppendSpellingSubMenu(m_hitTestResult, SpellingMenuItem);
appendItem(SpellingMenuItem);
#endif
#endif
ContextMenuItem FontMenuItem(SubmenuType, ContextMenuItemTagFontMenu,
contextMenuItemTagFontMenu());
......@@ -452,7 +450,6 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemTagOutline:
shouldEnable = false;
break;
#if PLATFORM(MAC)
case ContextMenuItemTagShowSpellingPanel:
#ifndef BUILDING_ON_TIGER
if (frame->editor()->spellingPanelIsShowing())
......@@ -462,7 +459,6 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
#endif
shouldEnable = frame->editor()->canEdit();
break;
#endif
case ContextMenuItemTagNoGuessesFound:
shouldEnable = false;
break;
......
......@@ -295,6 +295,52 @@ void EditorClientGdk::textDidChangeInTextArea(Element*)
notImplementedGdk();
}
void EditorClientGdk::ignoreWordInSpellDocument(const String&)
{
notImplementedGdk();
}
void EditorClientGdk::learnWord(const String&)
{
notImplementedGdk();
}
void EditorClientGdk::checkSpellingOfString(const UChar*, int, int*, int*)
{
notImplementedGdk();
}
void EditorClientGdk::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*)
{
notImplementedGdk();
}
void EditorClientGdk::udpateSpellingUIWithGrammarString(const String&, const Vector<String>&)
{
notImplementedGdk();
}
void EditorClientGdk::updateSpellingUIWithMisspelledWord(const String&)
{
notImplementedGdk();
}
void EditorClientGdk::showSpellingUI(bool)
{
notImplementedGdk();
}
bool EditorClientGdk::spellingUIIsShowing()
{
notImplementedGdk();
return false;
}
void EditorClientGdk::getGuessesForWord(const String&, Vector<String>&)
{
notImplementedGdk();
}
}
// vim: ts=4 sw=4 et
......@@ -92,6 +92,16 @@ public:
virtual void textWillBeDeletedInTextField(Element*);
virtual void textDidChangeInTextArea(Element*);
virtual void ignoreWordInSpellDocument(const String&);
virtual void learnWord(const String&);
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
virtual void udpateSpellingUIWithGrammarString(const String&, const Vector<String>& guesses);
virtual void updateSpellingUIWithMisspelledWord(const String&);
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const String&, Vector<String>& guesses);
// EditorClientGdk only
void setPage(Page*);
......
2007-04-24 Steve Falkenburg <sfalken@apple.com>
Reviewed by Oliver.
Spelling and grammar stubs
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::ignoreWordInSpellDocument):
(WebCore::EditorClientQt::learnWord):
(WebCore::EditorClientQt::checkSpellingOfString):
(WebCore::EditorClientQt::checkGrammarOfString):
(WebCore::EditorClientQt::udpateSpellingUIWithGrammarString):
(WebCore::EditorClientQt::updateSpellingUIWithMisspelledWord):
(WebCore::EditorClientQt::showSpellingUI):
(WebCore::EditorClientQt::spellingUIIsShowing):
(WebCore::EditorClientQt::getGuessesForWord):
* WebCoreSupport/EditorClientQt.h:
2007-04-11 MorganL <morganl.webkit@yahoo.com>
Reviewed by Maciej.
......
......@@ -301,6 +301,52 @@ void EditorClientQt::textDidChangeInTextArea(Element*)
{
}
void EditorClientQt::ignoreWordInSpellDocument(const String&)
{
notImplemented();
}
void EditorClientQt::learnWord(const String&)
{
notImplemented();
}
void EditorClientQt::checkSpellingOfString(const UChar*, int, int*, int*)
{
notImplemented();
}
void EditorClientQt::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*)
{
notImplemented();
}
void EditorClientQt::udpateSpellingUIWithGrammarString(const String&, const Vector<String>&)
{
notImplemented();
}
void EditorClientQt::updateSpellingUIWithMisspelledWord(const String&)
{
notImplemented();
}
void EditorClientQt::showSpellingUI(bool)
{
notImplemented();
}
bool EditorClientQt::spellingUIIsShowing()
{
notImplemented();
return false;
}
void EditorClientQt::getGuessesForWord(const String&, Vector<String>&)
{
notImplemented();
}
bool EditorClientQt::isEditing() const
{
return m_editing;
......
......@@ -92,6 +92,16 @@ public:
virtual void textWillBeDeletedInTextField(Element*);
virtual void textDidChangeInTextArea(Element*);
virtual void ignoreWordInSpellDocument(const String&);
virtual void learnWord(const String&);
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
virtual void udpateSpellingUIWithGrammarString(const String&, const Vector<String>& guesses);
virtual void updateSpellingUIWithMisspelledWord(const String&);
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const String&, Vector<String>& guesses);
bool isEditing() const;
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment