EditingDelegate.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Copyright (C) 2007 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  14. * its contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  18. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  21. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef EditingDelegate_h
  29. #define EditingDelegate_h
  30. #include <WebKit/WebKit.h>
  31. class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate {
  32. public:
  33. EditingDelegate();
  34. void setAcceptsEditing(bool b) { m_acceptsEditing = b; }
  35. // IUnknown
  36. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  37. virtual ULONG STDMETHODCALLTYPE AddRef(void);
  38. virtual ULONG STDMETHODCALLTYPE Release(void);
  39. // IWebEditingDelegate
  40. virtual HRESULT STDMETHODCALLTYPE shouldBeginEditingInDOMRange(
  41. /* [in] */ IWebView *webView,
  42. /* [in] */ IDOMRange *range,
  43. /* [retval][out] */ BOOL *result);
  44. virtual HRESULT STDMETHODCALLTYPE shouldEndEditingInDOMRange(
  45. /* [in] */ IWebView *webView,
  46. /* [in] */ IDOMRange *range,
  47. /* [retval][out] */ BOOL *result);
  48. virtual HRESULT STDMETHODCALLTYPE shouldInsertNode(
  49. /* [in] */ IWebView *webView,
  50. /* [in] */ IDOMNode *node,
  51. /* [in] */ IDOMRange *range,
  52. /* [in] */ WebViewInsertAction action);
  53. virtual HRESULT STDMETHODCALLTYPE shouldInsertText(
  54. /* [in] */ IWebView *webView,
  55. /* [in] */ BSTR text,
  56. /* [in] */ IDOMRange *range,
  57. /* [in] */ WebViewInsertAction action,
  58. /* [retval][out] */ BOOL *result);
  59. virtual HRESULT STDMETHODCALLTYPE shouldDeleteDOMRange(
  60. /* [in] */ IWebView *webView,
  61. /* [in] */ IDOMRange *range,
  62. /* [retval][out] */ BOOL *result);
  63. virtual HRESULT STDMETHODCALLTYPE shouldChangeSelectedDOMRange(
  64. /* [in] */ IWebView *webView,
  65. /* [in] */ IDOMRange *currentRange,
  66. /* [in] */ IDOMRange *proposedRange,
  67. /* [in] */ WebSelectionAffinity selectionAffinity,
  68. /* [in] */ BOOL stillSelecting,
  69. /* [retval][out] */ BOOL *result);
  70. virtual HRESULT STDMETHODCALLTYPE shouldApplyStyle(
  71. /* [in] */ IWebView *webView,
  72. /* [in] */ IDOMCSSStyleDeclaration *style,
  73. /* [in] */ IDOMRange *range,
  74. /* [retval][out] */ BOOL *result);
  75. virtual HRESULT STDMETHODCALLTYPE shouldChangeTypingStyle(
  76. /* [in] */ IWebView *webView,
  77. /* [in] */ IDOMCSSStyleDeclaration *currentStyle,
  78. /* [in] */ IDOMCSSStyleDeclaration *proposedStyle,
  79. /* [retval][out] */ BOOL *result);
  80. virtual HRESULT STDMETHODCALLTYPE doPlatformCommand(
  81. /* [in] */ IWebView *webView,
  82. /* [in] */ BSTR command,
  83. /* [retval][out] */ BOOL *result);
  84. virtual HRESULT STDMETHODCALLTYPE webViewDidBeginEditing(
  85. /* [in] */ IWebNotification *notification);
  86. virtual HRESULT STDMETHODCALLTYPE webViewDidChange(
  87. /* [in] */ IWebNotification *notification);
  88. virtual HRESULT STDMETHODCALLTYPE webViewDidEndEditing(
  89. /* [in] */ IWebNotification *notification);
  90. virtual HRESULT STDMETHODCALLTYPE webViewDidChangeTypingStyle(
  91. /* [in] */ IWebNotification *notification);
  92. virtual HRESULT STDMETHODCALLTYPE webViewDidChangeSelection(
  93. /* [in] */ IWebNotification *notification);
  94. virtual HRESULT STDMETHODCALLTYPE undoManagerForWebView(
  95. /* [in] */ IWebView *webView,
  96. /* [retval][out] */ IWebUndoManager **undoManager) { return E_NOTIMPL; }
  97. virtual HRESULT STDMETHODCALLTYPE ignoreWordInSpellDocument(
  98. /* [in] */ IWebView *view,
  99. /* [in] */ BSTR word) { return E_NOTIMPL; }
  100. virtual HRESULT STDMETHODCALLTYPE learnWord(
  101. /* [in] */ BSTR word) { return E_NOTIMPL; }
  102. virtual HRESULT STDMETHODCALLTYPE checkSpellingOfString(
  103. /* [in] */ IWebView *view,
  104. /* [in] */ LPCTSTR text,
  105. /* [in] */ int length,
  106. /* [out] */ int *misspellingLocation,
  107. /* [out] */ int *misspellingLength);
  108. virtual HRESULT STDMETHODCALLTYPE checkGrammarOfString(
  109. /* [in] */ IWebView *view,
  110. /* [in] */ LPCTSTR text,
  111. /* [in] */ int length,
  112. /* [out] */ IEnumWebGrammarDetails **grammarDetails,
  113. /* [out] */ int *badGrammarLocation,
  114. /* [out] */ int *badGrammarLength) { return E_NOTIMPL; }
  115. virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithGrammarString(
  116. /* [in] */ BSTR string,
  117. /* [in] */ int location,
  118. /* [in] */ int length,
  119. /* [in] */ BSTR userDescription,
  120. /* [in] */ BSTR *guesses,
  121. /* [in] */ int guessesCount) { return E_NOTIMPL; }
  122. virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithMisspelledWord(
  123. /* [in] */ BSTR word) { return E_NOTIMPL; }
  124. virtual HRESULT STDMETHODCALLTYPE showSpellingUI(
  125. /* [in] */ BOOL show) { return E_NOTIMPL; }
  126. virtual HRESULT STDMETHODCALLTYPE spellingUIIsShowing(
  127. /* [retval][out] */ BOOL *result) { return E_NOTIMPL; }
  128. virtual HRESULT STDMETHODCALLTYPE guessesForWord(
  129. /* [in] */ BSTR word,
  130. /* [retval][out] */ IEnumSpellingGuesses **guesses) { return E_NOTIMPL; }
  131. virtual HRESULT STDMETHODCALLTYPE closeSpellDocument(
  132. /* [in] */ IWebView *view) { return E_NOTIMPL; }
  133. virtual HRESULT STDMETHODCALLTYPE sharedSpellCheckerExists(
  134. /* [retval][out] */ BOOL *exists) { return E_NOTIMPL; }
  135. virtual HRESULT STDMETHODCALLTYPE preflightChosenSpellServer( void) { return E_NOTIMPL; }
  136. virtual HRESULT STDMETHODCALLTYPE updateGrammar( void) { return E_NOTIMPL; }
  137. private:
  138. bool m_acceptsEditing;
  139. ULONG m_refCount;
  140. };
  141. #endif // !defined(EditingDelegate_h)