ReactOS 0.4.15-dev-8119-g4fb2fdb
clipboard.c File Reference
#include "editor.h"
Include dependency graph for clipboard.c:

Go to the source code of this file.

Classes

struct  DataObjectImpl
 
struct  EnumFormatImpl
 
struct  tagME_GlobalDestStruct
 

Macros

#define NONAMELESSUNION
 

Typedefs

typedef struct DataObjectImpl DataObjectImpl
 
typedef struct EnumFormatImpl EnumFormatImpl
 
typedef struct tagME_GlobalDestStruct ME_GlobalDestStruct
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (richedit)
 
static HRESULT EnumFormatImpl_Create (const FORMATETC *fmtetc, UINT size, LPENUMFORMATETC *lplpformatetc)
 
static DataObjectImplimpl_from_IDataObject (IDataObject *iface)
 
static EnumFormatImplimpl_from_IEnumFORMATETC (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFormatImpl_QueryInterface (IEnumFORMATETC *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI EnumFormatImpl_AddRef (IEnumFORMATETC *iface)
 
static ULONG WINAPI EnumFormatImpl_Release (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFormatImpl_Next (IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumFormatImpl_Skip (IEnumFORMATETC *iface, ULONG celt)
 
static HRESULT WINAPI EnumFormatImpl_Reset (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFormatImpl_Clone (IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
 
static HRESULT EnumFormatImpl_Create (const FORMATETC *fmtetc, UINT fmtetc_cnt, IEnumFORMATETC **formatetc)
 
static HRESULT WINAPI DataObjectImpl_QueryInterface (IDataObject *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI DataObjectImpl_AddRef (IDataObject *iface)
 
static ULONG WINAPI DataObjectImpl_Release (IDataObject *iface)
 
static HRESULT WINAPI DataObjectImpl_GetData (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
 
static HRESULT WINAPI DataObjectImpl_GetDataHere (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
 
static HRESULT WINAPI DataObjectImpl_QueryGetData (IDataObject *iface, FORMATETC *pformatetc)
 
static HRESULT WINAPI DataObjectImpl_GetCanonicalFormatEtc (IDataObject *iface, FORMATETC *pformatetcIn, FORMATETC *pformatetcOut)
 
static HRESULT WINAPI DataObjectImpl_SetData (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
 
static HRESULT WINAPI DataObjectImpl_EnumFormatEtc (IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
 
static HRESULT WINAPI DataObjectImpl_DAdvise (IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 
static HRESULT WINAPI DataObjectImpl_DUnadvise (IDataObject *iface, DWORD dwConnection)
 
static HRESULT WINAPI DataObjectImpl_EnumDAdvise (IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
 
static HGLOBAL get_unicode_text (ME_TextEditor *editor, const ME_Cursor *start, int nChars)
 
static DWORD CALLBACK ME_AppendToHGLOBAL (DWORD_PTR dwCookie, LPBYTE lpBuff, LONG cb, LONG *pcb)
 
static HGLOBAL get_rtf_text (ME_TextEditor *editor, const ME_Cursor *start, int nChars)
 
HRESULT ME_GetDataObject (ME_TextEditor *editor, const ME_Cursor *start, int nChars, IDataObject **dataobj)
 

Variables

static UINT cfRTF = 0
 
static const IEnumFORMATETCVtbl VT_EnumFormatImpl
 
static const IDataObjectVtbl VT_DataObjectImpl
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 21 of file clipboard.c.

Typedef Documentation

◆ DataObjectImpl

◆ EnumFormatImpl

◆ ME_GlobalDestStruct

Function Documentation

◆ DataObjectImpl_AddRef()

static ULONG WINAPI DataObjectImpl_AddRef ( IDataObject iface)
static

Definition at line 193 of file clipboard.c.

194{
197 TRACE("(%p) ref=%d\n", This, ref);
198 return ref;
199}
#define InterlockedIncrement
Definition: armddk.h:53
static snapshot * impl_from_IDataObject(IDataObject *iface)
Definition: clipboard.c:159
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ DataObjectImpl_DAdvise()

static HRESULT WINAPI DataObjectImpl_DAdvise ( IDataObject iface,
FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 304 of file clipboard.c.

306{
308 FIXME("(%p): stub\n", This);
309 return E_NOTIMPL;
310}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DataObjectImpl_DUnadvise()

static HRESULT WINAPI DataObjectImpl_DUnadvise ( IDataObject iface,
DWORD  dwConnection 
)
static

Definition at line 312 of file clipboard.c.

313{
315 FIXME("(%p): stub\n", This);
316 return E_NOTIMPL;
317}

◆ DataObjectImpl_EnumDAdvise()

static HRESULT WINAPI DataObjectImpl_EnumDAdvise ( IDataObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 319 of file clipboard.c.

320{
322 FIXME("(%p): stub\n", This);
323 return E_NOTIMPL;
324}

◆ DataObjectImpl_EnumFormatEtc()

static HRESULT WINAPI DataObjectImpl_EnumFormatEtc ( IDataObject iface,
DWORD  dwDirection,
IEnumFORMATETC **  ppenumFormatEtc 
)
static

Definition at line 289 of file clipboard.c.

291{
293 TRACE("(%p)->(%d)\n", This, dwDirection);
294
295 if(dwDirection != DATADIR_GET) {
296 FIXME("Unsupported direction: %d\n", dwDirection);
297 /* WinXP riched20 also returns E_NOTIMPL in this case */
298 *ppenumFormatEtc = NULL;
299 return E_NOTIMPL;
300 }
301 return EnumFormatImpl_Create(This->fmtetc, This->fmtetc_cnt, ppenumFormatEtc);
302}
#define NULL
Definition: types.h:112
static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT size, LPENUMFORMATETC *lplpformatetc)

◆ DataObjectImpl_GetCanonicalFormatEtc()

static HRESULT WINAPI DataObjectImpl_GetCanonicalFormatEtc ( IDataObject iface,
FORMATETC *  pformatetcIn,
FORMATETC *  pformatetcOut 
)
static

Definition at line 268 of file clipboard.c.

270{
272 TRACE("(%p)->(%p,%p)\n", This, pformatetcIn, pformatetcOut);
273
274 if(pformatetcOut) {
275 *pformatetcOut = *pformatetcIn;
276 pformatetcOut->ptd = NULL;
277 }
279}
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674

◆ DataObjectImpl_GetData()

static HRESULT WINAPI DataObjectImpl_GetData ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium 
)
static

Definition at line 217 of file clipboard.c.

218{
220 TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
221
222 if(pformatetc->lindex != -1)
223 return DV_E_LINDEX;
224
225 if(!(pformatetc->tymed & TYMED_HGLOBAL))
226 return DV_E_TYMED;
227
228 if(This->unicode && pformatetc->cfFormat == CF_UNICODETEXT)
229 pmedium->u.hGlobal = This->unicode;
230 else if(This->rtf && pformatetc->cfFormat == cfRTF)
231 pmedium->u.hGlobal = This->rtf;
232 else
233 return DV_E_FORMATETC;
234
235 pmedium->tymed = TYMED_HGLOBAL;
236 pmedium->pUnkForRelease = (LPUNKNOWN)iface;
237 IUnknown_AddRef(pmedium->pUnkForRelease);
238 return S_OK;
239}
#define CF_UNICODETEXT
Definition: constants.h:408
static UINT cfRTF
Definition: clipboard.c:27
#define S_OK
Definition: intsafe.h:52
static LPUNKNOWN
Definition: ndr_ole.c:49
#define DV_E_TYMED
Definition: winerror.h:2638
#define DV_E_FORMATETC
Definition: winerror.h:2633
#define DV_E_LINDEX
Definition: winerror.h:2637

◆ DataObjectImpl_GetDataHere()

static HRESULT WINAPI DataObjectImpl_GetDataHere ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium 
)
static

Definition at line 241 of file clipboard.c.

242{
244 FIXME("(%p): stub\n", This);
245 return E_NOTIMPL;
246}

◆ DataObjectImpl_QueryGetData()

static HRESULT WINAPI DataObjectImpl_QueryGetData ( IDataObject iface,
FORMATETC *  pformatetc 
)
static

Definition at line 248 of file clipboard.c.

249{
251 UINT i;
252 BOOL foundFormat = FALSE;
253 TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
254
255 if(pformatetc->lindex != -1)
256 return DV_E_LINDEX;
257
258 for(i=0; i<This->fmtetc_cnt; i++) {
259 if(This->fmtetc[i].cfFormat == pformatetc->cfFormat) {
260 foundFormat = TRUE;
261 if(This->fmtetc[i].tymed == pformatetc->tymed)
262 return S_OK;
263 }
264 }
265 return foundFormat?DV_E_FORMATETC:DV_E_TYMED;
266}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

◆ DataObjectImpl_QueryInterface()

static HRESULT WINAPI DataObjectImpl_QueryInterface ( IDataObject iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 179 of file clipboard.c.

180{
182 TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
183
185 IDataObject_AddRef(iface);
186 *ppvObj = &This->IDataObject_iface;
187 return S_OK;
188 }
189 *ppvObj = NULL;
190 return E_NOINTERFACE;
191}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IDataObject
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DataObjectImpl_Release()

static ULONG WINAPI DataObjectImpl_Release ( IDataObject iface)
static

Definition at line 201 of file clipboard.c.

202{
205 TRACE("(%p) ref=%d\n",This, ref);
206
207 if(!ref) {
208 if(This->unicode) GlobalFree(This->unicode);
209 if(This->rtf) GlobalFree(This->rtf);
210 if(This->fmtetc) GlobalFree(This->fmtetc);
212 }
213
214 return ref;
215}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611

◆ DataObjectImpl_SetData()

static HRESULT WINAPI DataObjectImpl_SetData ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 281 of file clipboard.c.

283{
285 FIXME("(%p): stub\n", This);
286 return E_NOTIMPL;
287}

◆ EnumFormatImpl_AddRef()

static ULONG WINAPI EnumFormatImpl_AddRef ( IEnumFORMATETC iface)
static

Definition at line 76 of file clipboard.c.

77{
80 TRACE("(%p) ref=%d\n", This, ref);
81 return ref;
82}
static enum_fmtetc * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: clipboard.c:238
long LONG
Definition: pedump.c:60

◆ EnumFormatImpl_Clone()

static HRESULT WINAPI EnumFormatImpl_Clone ( IEnumFORMATETC iface,
IEnumFORMATETC **  ppenum 
)
static

Definition at line 138 of file clipboard.c.

139{
141 HRESULT hr;
142 TRACE("(%p)->(%p)\n", This, ppenum);
143
144 if(!ppenum)
145 return E_INVALIDARG;
146 hr = EnumFormatImpl_Create(This->fmtetc, This->fmtetc_cnt, ppenum);
147 if(SUCCEEDED(hr))
148 hr = IEnumFORMATETC_Skip(*ppenum, This->cur);
149 return hr;
150}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183

◆ EnumFormatImpl_Create() [1/2]

static HRESULT EnumFormatImpl_Create ( const FORMATETC *  fmtetc,
UINT  fmtetc_cnt,
IEnumFORMATETC **  formatetc 
)
static

Definition at line 162 of file clipboard.c.

164{
166 TRACE("\n");
167
168 ret = heap_alloc(sizeof(EnumFormatImpl));
169 ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl;
170 ret->ref = 1;
171 ret->cur = 0;
172 ret->fmtetc_cnt = fmtetc_cnt;
173 ret->fmtetc = GlobalAlloc(GMEM_ZEROINIT, fmtetc_cnt*sizeof(FORMATETC));
174 memcpy(ret->fmtetc, fmtetc, fmtetc_cnt*sizeof(FORMATETC));
175 *formatetc = &ret->IEnumFORMATETC_iface;
176 return S_OK;
177}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static const IEnumFORMATETCVtbl VT_EnumFormatImpl
Definition: clipboard.c:152
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int ret
#define GMEM_ZEROINIT
Definition: winbase.h:306

◆ EnumFormatImpl_Create() [2/2]

static HRESULT EnumFormatImpl_Create ( const FORMATETC *  fmtetc,
UINT  size,
LPENUMFORMATETC lplpformatetc 
)
static

◆ EnumFormatImpl_Next()

static HRESULT WINAPI EnumFormatImpl_Next ( IEnumFORMATETC iface,
ULONG  celt,
FORMATETC *  rgelt,
ULONG pceltFetched 
)
static

Definition at line 98 of file clipboard.c.

100{
102 ULONG count = 0;
103 TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
104
105 if(!rgelt)
106 return E_INVALIDARG;
107
108 count = min(celt, This->fmtetc_cnt-This->cur);
109 if(count > 0) {
110 memcpy(rgelt, This->fmtetc+This->cur, count*sizeof(FORMATETC));
111 This->cur += count;
112 }
113 if(pceltFetched)
114 *pceltFetched = count;
115 return count == celt ? S_OK : S_FALSE;
116}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define min(a, b)
Definition: monoChain.cc:55
#define S_FALSE
Definition: winerror.h:2357

◆ EnumFormatImpl_QueryInterface()

static HRESULT WINAPI EnumFormatImpl_QueryInterface ( IEnumFORMATETC iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 62 of file clipboard.c.

63{
65 TRACE("%p %s\n", This, debugstr_guid(riid));
66
68 IEnumFORMATETC_AddRef(iface);
69 *ppvObj = &This->IEnumFORMATETC_iface;
70 return S_OK;
71 }
72 *ppvObj = NULL;
73 return E_NOINTERFACE;
74}
const GUID IID_IEnumFORMATETC

◆ EnumFormatImpl_Release()

static ULONG WINAPI EnumFormatImpl_Release ( IEnumFORMATETC iface)
static

Definition at line 84 of file clipboard.c.

85{
88 TRACE("(%p) ref=%d\n", This, ref);
89
90 if(!ref) {
91 GlobalFree(This->fmtetc);
93 }
94
95 return ref;
96}

◆ EnumFormatImpl_Reset()

static HRESULT WINAPI EnumFormatImpl_Reset ( IEnumFORMATETC iface)
static

Definition at line 129 of file clipboard.c.

130{
132 TRACE("(%p)\n", This);
133
134 This->cur = 0;
135 return S_OK;
136}

◆ EnumFormatImpl_Skip()

static HRESULT WINAPI EnumFormatImpl_Skip ( IEnumFORMATETC iface,
ULONG  celt 
)
static

Definition at line 118 of file clipboard.c.

119{
121 ULONG count = 0;
122 TRACE("(%p)->(%d)\n", This, celt);
123
124 count = min(celt, This->fmtetc_cnt-This->cur);
125 This->cur += count;
126 return count == celt ? S_OK : S_FALSE;
127}

◆ get_rtf_text()

static HGLOBAL get_rtf_text ( ME_TextEditor editor,
const ME_Cursor start,
int  nChars 
)
static

Definition at line 391 of file clipboard.c.

392{
395
397 gds.nLength = 0;
398 es.dwCookie = (DWORD_PTR)&gds;
399 es.pfnCallback = ME_AppendToHGLOBAL;
400 ME_StreamOutRange(editor, SF_RTF, start, nChars, &es);
401 GlobalReAlloc(gds.hData, gds.nLength+1, 0);
402 return gds.hData;
403}
static DWORD CALLBACK ME_AppendToHGLOBAL(DWORD_PTR dwCookie, LPBYTE lpBuff, LONG cb, LONG *pcb)
Definition: clipboard.c:369
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream) DECLSPEC_HIDDEN
Definition: writer.c:1163
GLuint start
Definition: gl.h:1545
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
#define es
Definition: i386-dis.c:440
#define SF_RTF
Definition: richedit.h:721
#define DWORD_PTR
Definition: treelist.c:76
#define GMEM_MOVEABLE
Definition: winbase.h:294

Referenced by ME_GetDataObject().

◆ get_unicode_text()

static HGLOBAL get_unicode_text ( ME_TextEditor editor,
const ME_Cursor start,
int  nChars 
)
static

Definition at line 342 of file clipboard.c.

343{
344 int pars = 0;
345 WCHAR *data;
346 HANDLE ret;
347 ME_DisplayItem *para;
348 int nEnd = ME_GetCursorOfs(start) + nChars;
349
350 /* count paragraphs in range */
351 para = start->pPara;
352 while((para = para->member.para.next_para) &&
353 para->member.para.nCharOfs <= nEnd)
354 pars++;
355
356 ret = GlobalAlloc(GMEM_MOVEABLE, sizeof(WCHAR) * (nChars + pars + 1));
358 ME_GetTextW(editor, data, nChars + pars, start, nChars, TRUE, FALSE);
360 return ret;
361}
int ME_GetCursorOfs(const ME_Cursor *cursor)
Definition: caret.c:957
int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen, const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP)
Definition: editor.c:5192
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
union tagME_DisplayItem::@540 member
ME_Paragraph para
Definition: editstr.h:262
struct tagME_DisplayItem * next_para
Definition: editstr.h:217
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ME_GetDataObject().

◆ impl_from_IDataObject()

static DataObjectImpl * impl_from_IDataObject ( IDataObject iface)
inlinestatic

Definition at line 52 of file clipboard.c.

53{
54 return CONTAINING_RECORD(iface, DataObjectImpl, IDataObject_iface);
55}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ impl_from_IEnumFORMATETC()

static EnumFormatImpl * impl_from_IEnumFORMATETC ( IEnumFORMATETC iface)
inlinestatic

Definition at line 57 of file clipboard.c.

58{
59 return CONTAINING_RECORD(iface, EnumFormatImpl, IEnumFORMATETC_iface);
60}

◆ ME_AppendToHGLOBAL()

static DWORD CALLBACK ME_AppendToHGLOBAL ( DWORD_PTR  dwCookie,
LPBYTE  lpBuff,
LONG  cb,
LONG pcb 
)
static

Definition at line 369 of file clipboard.c.

370{
372 int nMaxSize;
373 BYTE *pDest;
374
375 nMaxSize = GlobalSize(pData->hData);
376 if (pData->nLength+cb+1 >= cb) {
377 /* round up to 2^17 */
378 int nNewSize = (((nMaxSize+cb+1)|0x1FFFF)+1) & 0xFFFE0000;
379 pData->hData = GlobalReAlloc(pData->hData, nNewSize, 0);
380 }
381 pDest = GlobalLock(pData->hData);
382 memcpy(pDest + pData->nLength, lpBuff, cb);
383 pData->nLength += cb;
384 pDest[pData->nLength] = '\0';
385 GlobalUnlock(pData->hData);
386 *pcb = cb;
387
388 return 0;
389}
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
unsigned char BYTE
Definition: xxhash.c:193

Referenced by get_rtf_text().

◆ ME_GetDataObject()

HRESULT ME_GetDataObject ( ME_TextEditor editor,
const ME_Cursor start,
int  nChars,
IDataObject **  dataobj 
)

Definition at line 405 of file clipboard.c.

407{
409 TRACE("(%p,%d,%d)\n", editor, ME_GetCursorOfs(start), nChars);
410
411 obj = heap_alloc(sizeof(DataObjectImpl));
412 if(cfRTF == 0)
413 cfRTF = RegisterClipboardFormatA("Rich Text Format");
414
416 obj->ref = 1;
417 obj->unicode = get_unicode_text(editor, start, nChars);
418 obj->rtf = NULL;
419
420 obj->fmtetc_cnt = 1;
421 if(editor->mode & TM_RICHTEXT)
422 obj->fmtetc_cnt++;
423 obj->fmtetc = GlobalAlloc(GMEM_ZEROINIT, obj->fmtetc_cnt*sizeof(FORMATETC));
424 InitFormatEtc(obj->fmtetc[0], CF_UNICODETEXT, TYMED_HGLOBAL);
425 if(editor->mode & TM_RICHTEXT) {
426 obj->rtf = get_rtf_text(editor, start, nChars);
427 InitFormatEtc(obj->fmtetc[1], cfRTF, TYMED_HGLOBAL);
428 }
429
430 *dataobj = &obj->IDataObject_iface;
431 return S_OK;
432}
static HGLOBAL get_unicode_text(ME_TextEditor *editor, const ME_Cursor *start, int nChars)
Definition: clipboard.c:342
static HGLOBAL get_rtf_text(ME_TextEditor *editor, const ME_Cursor *start, int nChars)
Definition: clipboard.c:391
static const IDataObjectVtbl VT_DataObjectImpl
Definition: clipboard.c:326
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:32
#define TM_RICHTEXT
Definition: richedit.h:1029
IDataObject IDataObject_iface
Definition: usrmarshal.c:1273
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)

Referenced by IRichEditOle_fnGetClipboardData(), and ME_Copy().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( richedit  )

Variable Documentation

◆ cfRTF

UINT cfRTF = 0
static

Definition at line 27 of file clipboard.c.

Referenced by DataObjectImpl_GetData(), and ME_GetDataObject().

◆ VT_DataObjectImpl

const IDataObjectVtbl VT_DataObjectImpl
static
Initial value:
=
{
}
static HRESULT WINAPI DataObjectImpl_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: clipboard.c:241
static ULONG WINAPI DataObjectImpl_AddRef(IDataObject *iface)
Definition: clipboard.c:193
static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: clipboard.c:248
static HRESULT WINAPI DataObjectImpl_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: clipboard.c:304
static HRESULT WINAPI DataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, LPVOID *ppvObj)
Definition: clipboard.c:179
static HRESULT WINAPI DataObjectImpl_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: clipboard.c:312
static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: clipboard.c:289
static ULONG WINAPI DataObjectImpl_Release(IDataObject *iface)
Definition: clipboard.c:201
static HRESULT WINAPI DataObjectImpl_GetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: clipboard.c:217
static HRESULT WINAPI DataObjectImpl_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatetcIn, FORMATETC *pformatetcOut)
Definition: clipboard.c:268
static HRESULT WINAPI DataObjectImpl_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: clipboard.c:319
static HRESULT WINAPI DataObjectImpl_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: clipboard.c:281

Definition at line 326 of file clipboard.c.

Referenced by DataObjectImpl_CreateComplex(), DataObjectImpl_CreateFromHGlobal(), and ME_GetDataObject().

◆ VT_EnumFormatImpl

const IEnumFORMATETCVtbl VT_EnumFormatImpl
static
Initial value:
= {
}
static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface)
Definition: clipboard.c:76
static HRESULT WINAPI EnumFormatImpl_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: clipboard.c:118
static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
Definition: clipboard.c:84
static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: clipboard.c:98
static HRESULT WINAPI EnumFormatImpl_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: clipboard.c:138
static HRESULT WINAPI EnumFormatImpl_QueryInterface(IEnumFORMATETC *iface, REFIID riid, LPVOID *ppvObj)
Definition: clipboard.c:62
static HRESULT WINAPI EnumFormatImpl_Reset(IEnumFORMATETC *iface)
Definition: clipboard.c:129

Definition at line 152 of file clipboard.c.

Referenced by EnumFormatImpl_Create().