ReactOS 0.4.15-dev-7842-g558ab78
olecallback.c
Go to the documentation of this file.
1/*
2 * Wordpad implementation - Richedit OLE callback implementation
3 *
4 * Copyright 2010 by Dylan Smith <dylan.ah.smith@gmail.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22
23#define WIN32_NO_STATUS
24#define WIN32_LEAN_AND_MEAN
25#include <windows.h>
26#include <richedit.h>
27#include <richole.h>
28#include <wine/debug.h>
29
30#include "wordpad.h"
31
33
35 const IRichEditOleCallbackVtbl *vtbl;
38};
39
41
45 void **ppvObject)
46{
47 WINE_TRACE("(%p, %s, %p)\n", This, wine_dbgstr_guid(riid), ppvObject);
48 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IRichEditOleCallback))
49 {
50 *ppvObject = This;
51 return S_OK;
52 }
53 WINE_FIXME("Unknown interface: %s\n", wine_dbgstr_guid(riid));
54 return E_NOINTERFACE;
55}
56
59{
60 WINE_TRACE("(%p)\n", This);
61 /* singleton */
62 return 1;
63}
64
67{
68 WINE_TRACE("(%p)\n", This);
69 return 1;
70}
71
72/*** IRichEditOleCallback methods ***/
75 LPSTORAGE *lplpstg)
76{
77 WCHAR name[32];
78 static const WCHAR template[] = {'R','E','O','L','E','_','%','u','\0'};
79
80 WINE_TRACE("(%p, %p)\n", This, lplpstg);
81 wsprintfW(name, template, olecallback.item_num++);
82 return IStorage_CreateStorage(olecallback.stg, name,
84 0, 0, lplpstg);
85}
86
89 LPOLEINPLACEFRAME *lplpFrame,
90 LPOLEINPLACEUIWINDOW *lplpDoc,
91 LPOLEINPLACEFRAMEINFO lpFrameInfo)
92{
93 WINE_FIXME("(%p, %p, %p, %p) stub\n", This, lplpFrame, lplpDoc, lpFrameInfo);
94 return E_INVALIDARG;
95}
96
99 BOOL fShow)
100{
101 WINE_TRACE("(%p, %d)\n", This, fShow);
102 return S_OK;
103}
104
107 LPCLSID lpclsid,
108 LPSTORAGE lpstg,
109 LONG cp)
110{
111 WINE_TRACE("(%p, %p, %p, %d)\n", This, lpclsid, lpstg, cp);
112 return S_OK;
113}
114
117 LPOLEOBJECT lpoleobj)
118{
119 WINE_TRACE("(%p, %p)\n", This, lpoleobj);
120 return S_OK;
121}
122
125 LPDATAOBJECT lpdataobj,
126 CLIPFORMAT *lpcfFormat,
127 DWORD reco,
128 BOOL fReally,
129 HGLOBAL hMetaPict)
130{
131 WINE_TRACE("(%p, %p, %p, %x, %d, %p)\n",
132 This, lpdataobj, lpcfFormat, reco, fReally, hMetaPict);
133 return S_OK;
134}
135
138 BOOL fEnterMode)
139{
140 WINE_TRACE("(%p, %d)\n", This, fEnterMode);
141 return S_OK;
142}
143
146 CHARRANGE *lpchrg,
147 DWORD reco,
148 LPDATAOBJECT *lplpdataobj)
149{
150 WINE_TRACE("(%p, %p, %x, %p)\n", This, lpchrg, reco, lplpdataobj);
151 return E_NOTIMPL;
152}
153
156 BOOL fDrag,
157 DWORD grfKeyState,
158 LPDWORD pdwEffect)
159{
160 WINE_TRACE("(%p, %d, %x, %p)\n", This, fDrag, grfKeyState, pdwEffect);
161 if (pdwEffect)
162 *pdwEffect = DROPEFFECT_COPY;
163 return S_OK;
164}
165
168 WORD seltype,
169 LPOLEOBJECT lpoleobj,
170 CHARRANGE *lpchrg,
171 HMENU *lphmenu)
172{
175
176 WINE_TRACE("(%p, %x, %p, %p, %p)\n",
177 This, seltype, lpoleobj, lpchrg, lphmenu);
178
179 *lphmenu = GetSubMenu(hPopupMenu, 0);
180 return S_OK;
181}
182
183struct IRichEditOleCallbackVtbl olecallbackVtbl = {
197};
198
201};
202
204{
207 0, &olecallback.stg);
208
210 return hr;
211}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static HWND hEditorWnd
Definition: wordpad.c:61
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
HINSTANCE hInstance
Definition: charmap.c:19
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8636
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
POINT cp
Definition: magnifier.c:59
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define STGM_CREATE
Definition: objbase.h:926
#define STGM_READWRITE
Definition: objbase.h:919
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:923
#define STGM_DELETEONRELEASE
Definition: objbase.h:925
interface IStorage * LPSTORAGE
Definition: objfwd.h:30
interface IDataObject * LPDATAOBJECT
Definition: objfwd.h:21
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_ContextSensitiveHelp(IRichEditOleCallback *This, BOOL fEnterMode)
Definition: olecallback.c:136
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_QueryInterface(IRichEditOleCallback *This, REFIID riid, void **ppvObject)
Definition: olecallback.c:42
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_GetDragDropEffect(IRichEditOleCallback *This, BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect)
Definition: olecallback.c:154
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_GetInPlaceContext(IRichEditOleCallback *This, LPOLEINPLACEFRAME *lplpFrame, LPOLEINPLACEUIWINDOW *lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: olecallback.c:87
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_GetNewStorage(IRichEditOleCallback *This, LPSTORAGE *lplpstg)
Definition: olecallback.c:73
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_DeleteObject(IRichEditOleCallback *This, LPOLEOBJECT lpoleobj)
Definition: olecallback.c:115
HRESULT setup_richedit_olecallback(HWND hEditorWnd)
Definition: olecallback.c:203
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_ShowContainerUI(IRichEditOleCallback *This, BOOL fShow)
Definition: olecallback.c:97
struct IRichEditOleCallbackImpl olecallback
Definition: olecallback.c:40
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_GetContextMenu(IRichEditOleCallback *This, WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE *lpchrg, HMENU *lphmenu)
Definition: olecallback.c:166
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_QueryAcceptData(IRichEditOleCallback *This, LPDATAOBJECT lpdataobj, CLIPFORMAT *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict)
Definition: olecallback.c:123
static ULONG STDMETHODCALLTYPE RichEditOleCallback_Release(IRichEditOleCallback *This)
Definition: olecallback.c:65
static ULONG STDMETHODCALLTYPE RichEditOleCallback_AddRef(IRichEditOleCallback *This)
Definition: olecallback.c:57
struct IRichEditOleCallbackVtbl olecallbackVtbl
Definition: olecallback.c:183
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_GetClipboardData(IRichEditOleCallback *This, CHARRANGE *lpchrg, DWORD reco, LPDATAOBJECT *lplpdataobj)
Definition: olecallback.c:144
static HRESULT STDMETHODCALLTYPE RichEditOleCallback_QueryInsertObject(IRichEditOleCallback *This, LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp)
Definition: olecallback.c:105
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define EM_SETOLECALLBACK
Definition: richedit.h:103
#define WINE_TRACE
Definition: debug.h:354
#define WINE_FIXME
Definition: debug.h:366
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
HRESULT hr
Definition: shlfolder.c:183
const IRichEditOleCallbackVtbl * vtbl
Definition: olecallback.c:35
Definition: name.c:39
uint32_t * LPDWORD
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
LONG_PTR LPARAM
Definition: windef.h:208
#define E_NOINTERFACE
Definition: winerror.h:2364
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDM_POPUP
Definition: wordpad.h:180
__wchar_t WCHAR
Definition: xmlstorage.h:180