ReactOS  0.4.13-dev-79-gcd489d8
pastespl.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "oledlg.h"
#include "oledlg_private.h"
#include "resource.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for pastespl.c:

Go to the source code of this file.

Classes

struct  ps_struct_t
 
struct  ps_flag
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define PS_FLAG_ENTRY(p)   {p, #p}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static void dump_ps_flags (DWORD flags)
 
static void dump_pastespecial (const OLEUIPASTESPECIALW *ps)
 
static WCHARstrdupAtoW (const char *str)
 
static WCHARstrdupW (const WCHAR *str)
 
static void get_descriptors (HWND hdlg, ps_struct_t *ps_struct)
 
static BOOL add_entry_to_lb (HWND hdlg, UINT id, OLEUIPASTEENTRYW *pe)
 
static DWORD init_pastelist (HWND hdlg, OLEUIPASTESPECIALW *ps)
 
static DWORD init_linklist (HWND hdlg, OLEUIPASTESPECIALW *ps)
 
static void update_display_list (HWND hdlg, UINT src_list_id)
 
static void init_lists (HWND hdlg, ps_struct_t *ps_struct)
 
static void update_src_text (HWND hdlg, const ps_struct_t *ps_struct)
 
static void update_as_icon (HWND hdlg, ps_struct_t *ps_struct)
 
static void update_result_text (HWND hdlg, const ps_struct_t *ps_struct)
 
static void selection_change (HWND hdlg, ps_struct_t *ps_struct)
 
static void mode_change (HWND hdlg, ps_struct_t *ps_struct, UINT id)
 
static void post_help_msg (HWND hdlg, ps_struct_t *ps_struct)
 
static void send_end_dialog_msg (HWND hdlg, ps_struct_t *ps_struct, UINT id)
 
static void update_structure (HWND hdlg, ps_struct_t *ps_struct)
 
static void free_structure (ps_struct_t *ps_struct)
 
static INT_PTR CALLBACK ps_dlg_proc (HWND hdlg, UINT msg, WPARAM wp, LPARAM lp)
 
UINT WINAPI OleUIPasteSpecialA (LPOLEUIPASTESPECIALA psA)
 
UINT WINAPI OleUIPasteSpecialW (LPOLEUIPASTESPECIALW ps)
 

Variables

static const struct ps_flag ps_flags []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file pastespl.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 22 of file pastespl.c.

◆ PS_FLAG_ENTRY

#define PS_FLAG_ENTRY (   p)    {p, #p}

Function Documentation

◆ add_entry_to_lb()

static BOOL add_entry_to_lb ( HWND  hdlg,
UINT  id,
OLEUIPASTEENTRYW pe 
)
static

Definition at line 197 of file pastespl.c.

198 {
199  HWND hwnd = GetDlgItem(hdlg, id);
200  BOOL ret = FALSE;
201 
202  /* FIXME %s handling */
203 
204  /* Note that this suffers from the same bug as native, in that if a new string
205  is a substring of an already added string, then the FINDSTRING will succeed
206  this is probably not what we want */
208  {
211  ret = TRUE;
212  }
213  return ret;
214 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define LB_ADDSTRING
Definition: winuser.h:1992
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPCWSTR lpstrFormatName
Definition: oledlg.h:364
#define LB_SETITEMDATA
Definition: winuser.h:2026
int ret
#define LB_FINDSTRING
Definition: winuser.h:1995
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by init_linklist(), and init_pastelist().

◆ dump_pastespecial()

static void dump_pastespecial ( const OLEUIPASTESPECIALW ps)
static

Definition at line 85 of file pastespl.c.

86 {
87  INT i;
88  UINT j;
89 
91  TRACE("hwnd %p caption %s hook %p custdata %lx\n",
92  ps->hWndOwner, debugstr_w(ps->lpszCaption), ps->lpfnHook, ps->lCustData);
94  TRACE("hinst %p template %04x hresource %p\n", ps->hInstance, (WORD)(ULONG_PTR)ps->lpszTemplate, ps->hResource);
95  else
96  TRACE("hinst %p template %s hresource %p\n", ps->hInstance, debugstr_w(ps->lpszTemplate), ps->hResource);
97  TRACE("dataobj %p arrpasteent %p cpasteent %d arrlinktype %p clinktype %d\n",
99  ps->arrLinkTypes, ps->cLinkTypes);
100  TRACE("cclsidex %d lpclsidex %p nselect %d flink %d hmetapict %p size(%d,%d)\n",
102  ps->hMetaPict, ps->sizel.cx, ps->sizel.cy);
103  for(i = 0; i < ps->cPasteEntries; i++)
104  {
105  TRACE("arrPasteEntries[%d]: cFormat %08x pTargetDevice %p dwAspect %d lindex %d tymed %d\n",
106  i, ps->arrPasteEntries[i].fmtetc.cfFormat, ps->arrPasteEntries[i].fmtetc.ptd,
107  ps->arrPasteEntries[i].fmtetc.dwAspect, ps->arrPasteEntries[i].fmtetc.lindex,
108  ps->arrPasteEntries[i].fmtetc.tymed);
109  TRACE("\tformat name %s result text %s flags %04x\n", debugstr_w(ps->arrPasteEntries[i].lpstrFormatName),
111  }
112  for(i = 0; i < ps->cLinkTypes; i++)
113  TRACE("arrLinkTypes[%d] %08x\n", i, ps->arrLinkTypes[i]);
114  for(j = 0; j < ps->cClsidExclude; j++)
115  TRACE("lpClsidExclude[%u] %s\n", j, debugstr_guid(&ps->lpClsidExclude[j]));
116 
117 }
HINSTANCE hInstance
Definition: oledlg.h:406
LPOLEUIPASTEENTRYW arrPasteEntries
Definition: oledlg.h:410
FORMATETC fmtetc
Definition: oledlg.h:363
int32_t INT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR lpszCaption
Definition: oledlg.h:403
LONG cx
Definition: windef.h:319
LPFNOLEUIHOOK lpfnHook
Definition: oledlg.h:404
#define debugstr_guid
Definition: kernel32.h:35
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 GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
static void dump_ps_flags(DWORD flags)
Definition: pastespl.c:71
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
LPCWSTR lpstrFormatName
Definition: oledlg.h:364
unsigned short WORD
Definition: ntddk_ex.h:93
LPCLSID lpClsidExclude
Definition: oledlg.h:415
LPCWSTR lpstrResultText
Definition: oledlg.h:365
unsigned int UINT
Definition: ndis.h:50
LONG cy
Definition: windef.h:320
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409
LPCWSTR lpszTemplate
Definition: oledlg.h:407

Referenced by OleUIPasteSpecialW().

◆ dump_ps_flags()

static void dump_ps_flags ( DWORD  flags)
static

Definition at line 71 of file pastespl.c.

72 {
73  char flagstr[1000] = "";
74 
75  const struct ps_flag *flag = ps_flags;
76  for( ; flag->name; flag++) {
77  if(flags & flag->flag) {
78  strcat(flagstr, flag->name);
79  strcat(flagstr, "|");
80  }
81  }
82  TRACE("flags %08x %s\n", flags, flagstr);
83 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
static const struct ps_flag ps_flags[]
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 flag
Definition: glfuncs.h:52

Referenced by dump_pastespecial().

◆ free_structure()

static void free_structure ( ps_struct_t ps_struct)
static

Definition at line 502 of file pastespl.c.

503 {
504  HeapFree(GetProcessHeap(), 0, ps_struct->type_name);
505  HeapFree(GetProcessHeap(), 0, ps_struct->source_name);
506  HeapFree(GetProcessHeap(), 0, ps_struct->link_type_name);
507  HeapFree(GetProcessHeap(), 0, ps_struct->link_source_name);
508  CoTaskMemFree(ps_struct->app_name);
509  HeapFree(GetProcessHeap(), 0, ps_struct);
510 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
LPOLESTR app_name
Definition: pastespl.c:50
WCHAR * link_type_name
Definition: pastespl.c:49
#define GetProcessHeap()
Definition: compat.h:395
WCHAR * type_name
Definition: pastespl.c:48
WCHAR * link_source_name
Definition: pastespl.c:47
WCHAR * source_name
Definition: pastespl.c:46
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ps_dlg_proc().

◆ get_descriptors()

static void get_descriptors ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 141 of file pastespl.c.

142 {
143  FORMATETC fmtetc;
144  STGMEDIUM stg;
145 
146  fmtetc.tymed = TYMED_HGLOBAL;
147  fmtetc.dwAspect = DVASPECT_CONTENT;
148  fmtetc.ptd = NULL;
149  fmtetc.lindex = -1;
150 
151  fmtetc.cfFormat = cf_object_descriptor;
152  if(IDataObject_GetData(ps_struct->ps->lpSrcDataObj, &fmtetc, &stg) == S_OK)
153  {
154  OBJECTDESCRIPTOR *obj_desc = GlobalLock(stg.u.hGlobal);
155  if(obj_desc->dwSrcOfCopy)
156  ps_struct->source_name = strdupW((WCHAR*)((char*)obj_desc + obj_desc->dwSrcOfCopy));
157  if(obj_desc->dwFullUserTypeName)
158  ps_struct->type_name = strdupW((WCHAR*)((char*)obj_desc + obj_desc->dwFullUserTypeName));
159  OleRegGetUserType(&obj_desc->clsid, USERCLASSTYPE_APPNAME, &ps_struct->app_name);
160  /* Get the icon here. If dwDrawAspect & DVASCPECT_ICON call GetData(CF_METAFILEPICT), otherwise
161  native calls OleGetIconFromClass(obj_desc->clsid) */
162  GlobalUnlock(stg.u.hGlobal);
163  GlobalFree(stg.u.hGlobal);
164  }
165  else
166  {
167  /* Try to get some data using some of the other clipboard formats */
168  }
169 
170  fmtetc.cfFormat = cf_link_src_descriptor;
171  if(IDataObject_GetData(ps_struct->ps->lpSrcDataObj, &fmtetc, &stg) == S_OK)
172  {
173  OBJECTDESCRIPTOR *obj_desc = GlobalLock(stg.u.hGlobal);
174  if(obj_desc->dwSrcOfCopy)
175  ps_struct->link_source_name = strdupW((WCHAR*)((char*)obj_desc + obj_desc->dwSrcOfCopy));
176  if(obj_desc->dwFullUserTypeName)
177  ps_struct->link_type_name = strdupW((WCHAR*)((char*)obj_desc + obj_desc->dwFullUserTypeName));
178  GlobalUnlock(stg.u.hGlobal);
179  GlobalFree(stg.u.hGlobal);
180  }
181 
182  if(ps_struct->source_name == NULL && ps_struct->link_source_name == NULL)
183  {
184  WCHAR buf[200];
186  ps_struct->source_name = strdupW(buf);
187  }
188 
189  if(ps_struct->type_name == NULL && ps_struct->link_type_name == NULL)
190  {
191  WCHAR buf[200];
193  ps_struct->type_name = strdupW(buf);
194  }
195 }
#define IDS_PS_UNKNOWN_SRC
Definition: resource.h:61
static WCHAR * strdupW(const WCHAR *str)
Definition: pastespl.c:130
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
OLEUIPASTESPECIALW * ps
Definition: pastespl.c:44
LPOLESTR app_name
Definition: pastespl.c:50
WCHAR * link_type_name
Definition: pastespl.c:49
UINT cf_link_src_descriptor
Definition: oledlg_main.c:46
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
WCHAR * type_name
Definition: pastespl.c:48
UINT cf_object_descriptor
Definition: oledlg_main.c:45
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define IDS_PS_UNKNOWN_TYPE
Definition: resource.h:60
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:681
WCHAR * link_source_name
Definition: pastespl.c:47
WCHAR * source_name
Definition: pastespl.c:46
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409

Referenced by ps_dlg_proc().

◆ init_linklist()

static DWORD init_linklist ( HWND  hdlg,
OLEUIPASTESPECIALW ps 
)
static

Definition at line 260 of file pastespl.c.

261 {
262  HRESULT hr;
263  DWORD supported_mask = 0;
264  DWORD items_added = 0;
265  int link, req_fmt;
266  FORMATETC fmt = {0, NULL, DVASPECT_CONTENT, -1, -1};
267 
268  for(link = 0; link < ps->cLinkTypes && link < PS_MAXLINKTYPES; link++)
269  {
270  fmt.cfFormat = ps->arrLinkTypes[link];
271  hr = IDataObject_QueryGetData(ps->lpSrcDataObj, &fmt);
272  if(hr == S_OK)
273  supported_mask |= 1 << link;
274  }
275  TRACE("supported_mask %02x\n", supported_mask);
276  for(req_fmt = 0; req_fmt < ps->cPasteEntries; req_fmt++)
277  {
278  DWORD linktypes;
280  linktypes = 0xff;
281  else
282  linktypes = ps->arrPasteEntries[req_fmt].dwFlags & 0xff;
283 
284  if(linktypes & supported_mask)
285  {
287  items_added++;
288  }
289  }
290 
291  EnableWindow(GetDlgItem(hdlg, IDC_PS_PASTELINK), items_added != 0);
292  return items_added;
293 }
HRESULT hr
Definition: shlfolder.c:183
LPOLEUIPASTEENTRYW arrPasteEntries
Definition: oledlg.h:410
#define PS_MAXLINKTYPES
Definition: oledlg.h:426
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define S_OK
Definition: intsafe.h:59
#define IDC_PS_PASTELINKLIST
Definition: oledlg.h:453
const WCHAR * link
Definition: db.cpp:985
#define IDC_PS_PASTELINK
Definition: oledlg.h:450
Definition: dsound.c:943
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409
static BOOL add_entry_to_lb(HWND hdlg, UINT id, OLEUIPASTEENTRYW *pe)
Definition: pastespl.c:197

Referenced by init_lists().

◆ init_lists()

static void init_lists ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 323 of file pastespl.c.

324 {
325  DWORD pastes_added = init_pastelist(hdlg, ps_struct->ps);
326  DWORD links_added = init_linklist(hdlg, ps_struct->ps);
327  UINT check_id, list_id;
328 
329  if((ps_struct->flags & (PSF_SELECTPASTE | PSF_SELECTPASTELINK)) == 0)
330  ps_struct->flags |= PSF_SELECTPASTE;
331 
332  if(!pastes_added && !links_added)
333  ps_struct->flags &= ~(PSF_SELECTPASTE | PSF_SELECTPASTELINK);
334  else if(!pastes_added && (ps_struct->flags & PSF_SELECTPASTE))
335  {
336  ps_struct->flags &= ~PSF_SELECTPASTE;
337  ps_struct->flags |= PSF_SELECTPASTELINK;
338  }
339  else if(!links_added && (ps_struct->flags & PSF_SELECTPASTELINK))
340  {
341  ps_struct->flags &= ~PSF_SELECTPASTELINK;
342  ps_struct->flags |= PSF_SELECTPASTE;
343  }
344 
345  check_id = 0;
346  list_id = 0;
347  if(ps_struct->flags & PSF_SELECTPASTE)
348  {
349  check_id = IDC_PS_PASTE;
350  list_id = IDC_PS_PASTELIST;
351  }
352  else if(ps_struct->flags & PSF_SELECTPASTELINK)
353  {
354  check_id = IDC_PS_PASTELINK;
355  list_id = IDC_PS_PASTELINKLIST;
356  }
357 
359 
360  if(list_id)
361  update_display_list(hdlg, list_id);
362  else
363  EnableWindow(GetDlgItem(hdlg, IDOK), 0);
364 }
#define IDC_PS_PASTELIST
Definition: oledlg.h:452
#define IDOK
Definition: winuser.h:824
OLEUIPASTESPECIALW * ps
Definition: pastespl.c:44
static void update_display_list(HWND hdlg, UINT src_list_id)
Definition: pastespl.c:296
static DWORD init_linklist(HWND hdlg, OLEUIPASTESPECIALW *ps)
Definition: pastespl.c:260
DWORD flags
Definition: pastespl.c:45
#define PSF_SELECTPASTELINK
Definition: oledlg.h:430
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static DWORD init_pastelist(HWND hdlg, OLEUIPASTESPECIALW *ps)
Definition: pastespl.c:216
#define IDC_PS_PASTE
Definition: oledlg.h:449
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_PS_PASTELINKLIST
Definition: oledlg.h:453
unsigned int UINT
Definition: ndis.h:50
#define PSF_SELECTPASTE
Definition: oledlg.h:429
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define IDC_PS_PASTELINK
Definition: oledlg.h:450

Referenced by ps_dlg_proc().

◆ init_pastelist()

static DWORD init_pastelist ( HWND  hdlg,
OLEUIPASTESPECIALW ps 
)
static

Definition at line 216 of file pastespl.c.

217 {
218  IEnumFORMATETC *penum;
219  HRESULT hr;
220  FORMATETC fmts[20];
221  DWORD fetched, items_added = 0;
222 
223  hr = IDataObject_EnumFormatEtc(ps->lpSrcDataObj, DATADIR_GET, &penum);
224  if(FAILED(hr))
225  {
226  WARN("Unable to create IEnumFORMATETC\n");
227  return 0;
228  }
229 
230  /* The native version grabs only the first 20 fmts and we do the same */
231  hr = IEnumFORMATETC_Next(penum, ARRAY_SIZE(fmts), fmts, &fetched);
232  TRACE("got %d formats hr %08x\n", fetched, hr);
233 
234  if(SUCCEEDED(hr))
235  {
236  DWORD src_fmt, req_fmt;
237  for(req_fmt = 0; req_fmt < ps->cPasteEntries; req_fmt++)
238  {
239  /* This is used by update_structure() to set nSelectedIndex on exit */
240  ps->arrPasteEntries[req_fmt].dwScratchSpace = req_fmt;
241  TRACE("req_fmt %x\n", ps->arrPasteEntries[req_fmt].fmtetc.cfFormat);
242  for(src_fmt = 0; src_fmt < fetched; src_fmt++)
243  {
244  TRACE("\tenum'ed fmt %x\n", fmts[src_fmt].cfFormat);
245  if(ps->arrPasteEntries[req_fmt].fmtetc.cfFormat == fmts[src_fmt].cfFormat)
246  {
247  add_entry_to_lb(hdlg, IDC_PS_PASTELIST, ps->arrPasteEntries + req_fmt);
248  items_added++;
249  break;
250  }
251  }
252  }
253  }
254 
255  IEnumFORMATETC_Release(penum);
256  EnableWindow(GetDlgItem(hdlg, IDC_PS_PASTE), items_added != 0);
257  return items_added;
258 }
#define IDC_PS_PASTELIST
Definition: oledlg.h:452
HRESULT hr
Definition: shlfolder.c:183
LPOLEUIPASTEENTRYW arrPasteEntries
Definition: oledlg.h:410
#define WARN(fmt,...)
Definition: debug.h:111
FORMATETC fmtetc
Definition: oledlg.h:363
DWORD dwScratchSpace
Definition: oledlg.h:367
static struct fmt fmts[]
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LONG HRESULT
Definition: typedefs.h:77
#define IDC_PS_PASTE
Definition: oledlg.h:449
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SUCCEEDED(hr)
Definition: intsafe.h:57
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409
static BOOL add_entry_to_lb(HWND hdlg, UINT id, OLEUIPASTEENTRYW *pe)
Definition: pastespl.c:197

Referenced by init_lists().

◆ mode_change()

static void mode_change ( HWND  hdlg,
ps_struct_t ps_struct,
UINT  id 
)
static

Definition at line 461 of file pastespl.c.

462 {
463  if(id == IDC_PS_PASTE)
464  {
465  ps_struct->flags &= ~PSF_SELECTPASTELINK;
466  ps_struct->flags |= PSF_SELECTPASTE;
467  }
468  else
469  {
470  ps_struct->flags &= ~PSF_SELECTPASTE;
471  ps_struct->flags |= PSF_SELECTPASTELINK;
472  }
473 
474  update_src_text(hdlg, ps_struct);
476  selection_change(hdlg, ps_struct);
477 }
#define IDC_PS_PASTELIST
Definition: oledlg.h:452
static void update_display_list(HWND hdlg, UINT src_list_id)
Definition: pastespl.c:296
static void update_src_text(HWND hdlg, const ps_struct_t *ps_struct)
Definition: pastespl.c:366
DWORD flags
Definition: pastespl.c:45
static void selection_change(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:455
#define PSF_SELECTPASTELINK
Definition: oledlg.h:430
#define IDC_PS_PASTE
Definition: oledlg.h:449
#define IDC_PS_PASTELINKLIST
Definition: oledlg.h:453
#define PSF_SELECTPASTE
Definition: oledlg.h:429

Referenced by ps_dlg_proc().

◆ OleUIPasteSpecialA()

UINT WINAPI OleUIPasteSpecialA ( LPOLEUIPASTESPECIALA  psA)

Definition at line 636 of file pastespl.c.

637 {
639  UINT ret;
640  TRACE("(%p)\n", psA);
641 
642  memcpy(&ps, psA, psA->cbStruct);
643 
647 
648  if(psA->cPasteEntries > 0)
649  {
650  DWORD size = psA->cPasteEntries * sizeof(ps.arrPasteEntries[0]);
651  INT i;
652 
655  for(i = 0; i < psA->cPasteEntries; i++)
656  {
661  }
662  }
663 
664  ret = OleUIPasteSpecialW(&ps);
665 
666  if(psA->cPasteEntries > 0)
667  {
668  INT i;
669  for(i = 0; i < psA->cPasteEntries; i++)
670  {
673  }
675  }
679 
680  /* Copy back the output fields */
681  psA->dwFlags = ps.dwFlags;
682  psA->lpSrcDataObj = ps.lpSrcDataObj;
683  psA->nSelectedIndex = ps.nSelectedIndex;
684  psA->fLink = ps.fLink;
685  psA->hMetaPict = ps.hMetaPict;
686  psA->sizel = ps.sizel;
687 
688  return ret;
689 }
LPCSTR lpstrFormatName
Definition: oledlg.h:355
UINT WINAPI OleUIPasteSpecialW(LPOLEUIPASTESPECIALW ps)
Definition: pastespl.c:694
LPOLEUIPASTEENTRYW arrPasteEntries
Definition: oledlg.h:410
LPCSTR lpstrResultText
Definition: oledlg.h:356
int32_t INT
Definition: typedefs.h:56
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
LPCWSTR lpszCaption
Definition: oledlg.h:403
static WCHAR * strdupAtoW(const char *str)
Definition: pastespl.c:119
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPCWSTR lpstrFormatName
Definition: oledlg.h:364
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPCWSTR lpstrResultText
Definition: oledlg.h:365
unsigned int UINT
Definition: ndis.h:50
LPOLEUIPASTEENTRYA arrPasteEntries
Definition: oledlg.h:386
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:385
#define HeapFree(x, y, z)
Definition: compat.h:394
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409
LPCWSTR lpszTemplate
Definition: oledlg.h:407

◆ OleUIPasteSpecialW()

UINT WINAPI OleUIPasteSpecialW ( LPOLEUIPASTESPECIALW  ps)

Definition at line 694 of file pastespl.c.

695 {
696  LPCDLGTEMPLATEW dlg_templ = (LPCDLGTEMPLATEW)ps->hResource;
697  UINT ret;
698 
699  TRACE("(%p)\n", ps);
700 
701  if(TRACE_ON(ole)) dump_pastespecial(ps);
702 
703  if(!ps->lpSrcDataObj)
705 
706  if(ps->hInstance || !ps->hResource)
707  {
710  HRSRC hrsrc;
711 
714  if(!hrsrc) return OLEUI_ERR_FINDTEMPLATEFAILURE;
715  dlg_templ = LoadResource(hInst, hrsrc);
716  if(!dlg_templ) return OLEUI_ERR_LOADTEMPLATEFAILURE;
717  }
718 
720 
721  return ret;
722 }
#define OLEUI_ERR_FINDTEMPLATEFAILURE
Definition: oledlg.h:77
#define OLEUI_ERR_LOADTEMPLATEFAILURE
Definition: oledlg.h:78
HINSTANCE hInstance
Definition: oledlg.h:406
#define OLEUI_ERR_LPSZTEMPLATEINVALID
Definition: oledlg.h:75
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HRESULT WINAPI OleGetClipboard(IDataObject **obj)
Definition: clipboard.c:2249
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDD_PASTESPECIAL4
Definition: oledlg.h:446
int ret
static void dump_pastespecial(const OLEUIPASTESPECIALW *ps)
Definition: pastespl.c:85
HINSTANCE hInst
Definition: dxdiag.c:13
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:36
const DLGTEMPLATE * LPCDLGTEMPLATEW
Definition: winuser.h:3022
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static INT_PTR CALLBACK ps_dlg_proc(HWND hdlg, UINT msg, WPARAM wp, LPARAM lp)
Definition: pastespl.c:512
#define TRACE_ON(x)
Definition: compat.h:65
LPDATAOBJECT lpSrcDataObj
Definition: oledlg.h:409
LPCWSTR lpszTemplate
Definition: oledlg.h:407

Referenced by OleUIPasteSpecialA().

◆ post_help_msg()

static void post_help_msg ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 479 of file pastespl.c.

480 {
482 }
OLEUIPASTESPECIALW * ps
Definition: pastespl.c:44
UINT_PTR WPARAM
Definition: windef.h:207
UINT oleui_msg_help
Definition: oledlg_main.c:51
#define IDD_PASTESPECIAL
Definition: oledlg.h:445
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ps_dlg_proc().

◆ ps_dlg_proc()

static INT_PTR CALLBACK ps_dlg_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 512 of file pastespl.c.

513 {
514  /* native uses prop name "Structure", but we're not compatible
515  with that so we'll prepend "Wine_". */
516  static const WCHAR prop_name[] = {'W','i','n','e','_','S','t','r','u','c','t','u','r','e',0};
517  ps_struct_t *ps_struct;
518 
519  TRACE("(%p, %04x, %08lx, %08lx)\n", hdlg, msg, wp, lp);
520 
521  ps_struct = GetPropW(hdlg, prop_name);
522 
523  if(msg != WM_INITDIALOG)
524  {
525  if(!ps_struct)
526  return 0;
527 
528  if(ps_struct->ps->lpfnHook)
529  {
530  INT_PTR ret = ps_struct->ps->lpfnHook(hdlg, msg, wp, lp);
531  if(ret) return ret;
532  }
533  }
534 
535  switch(msg)
536  {
537  case WM_INITDIALOG:
538  {
539  ps_struct = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps_struct));
540  ps_struct->ps = (OLEUIPASTESPECIALW*)lp;
541  ps_struct->type_name = NULL;
542  ps_struct->source_name = NULL;
543  ps_struct->link_type_name = NULL;
544  ps_struct->link_source_name = NULL;
545  ps_struct->app_name = NULL;
546  ps_struct->flags = ps_struct->ps->dwFlags;
547 
548  SetPropW(hdlg, prop_name, ps_struct);
549 
550  if(!(ps_struct->ps->dwFlags & PSF_SHOWHELP))
551  {
554  }
555 
556  if(ps_struct->ps->lpszCaption)
557  SetWindowTextW(hdlg, ps_struct->ps->lpszCaption);
558 
559  get_descriptors(hdlg, ps_struct);
560 
561  init_lists(hdlg, ps_struct);
562 
563  update_src_text(hdlg, ps_struct);
564 
565  selection_change(hdlg, ps_struct);
566 
568 
569  if(ps_struct->ps->lpfnHook)
570  ps_struct->ps->lpfnHook(hdlg, msg, 0, 0);
571  return FALSE; /* use new focus */
572  }
573  case WM_COMMAND:
574  switch(LOWORD(wp))
575  {
576  case IDC_PS_DISPLAYLIST:
577  switch(HIWORD(wp))
578  {
579  case LBN_SELCHANGE:
580  selection_change(hdlg, ps_struct);
581  return FALSE;
582  default:
583  return FALSE;
584  }
585  case IDC_PS_PASTE:
586  case IDC_PS_PASTELINK:
587  switch(HIWORD(wp))
588  {
589  case BN_CLICKED:
590  mode_change(hdlg, ps_struct, LOWORD(wp));
591  return FALSE;
592 
593  default:
594  return FALSE;
595  }
596  case IDC_OLEUIHELP:
597  switch(HIWORD(wp))
598  {
599  case BN_CLICKED:
600  post_help_msg(hdlg, ps_struct);
601  return FALSE;
602  default:
603  return FALSE;
604  }
605  case IDOK:
606  case IDCANCEL:
607  switch(HIWORD(wp))
608  {
609  case BN_CLICKED:
610  send_end_dialog_msg(hdlg, ps_struct, LOWORD(wp));
611  return FALSE;
612  default:
613  return FALSE;
614  }
615  }
616  return FALSE;
617  default:
618  if(msg == oleui_msg_enddialog)
619  {
620  if(wp == IDOK)
621  update_structure(hdlg, ps_struct);
622  EndDialog(hdlg, wp);
623  /* native does its cleanup in WM_DESTROY */
624  RemovePropW(hdlg, prop_name);
625  free_structure(ps_struct);
626  return TRUE;
627  }
628  return FALSE;
629  }
630 
631 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
OLEUIPASTESPECIALW * ps
Definition: pastespl.c:44
UINT oleui_msg_enddialog
Definition: oledlg_main.c:52
LPOLESTR app_name
Definition: pastespl.c:50
#define SW_HIDE
Definition: winuser.h:762
WCHAR * link_type_name
Definition: pastespl.c:49
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
static void update_src_text(HWND hdlg, const ps_struct_t *ps_struct)
Definition: pastespl.c:366
#define LBN_SELCHANGE
Definition: winuser.h:2036
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
static void init_lists(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:323
LPCWSTR lpszCaption
Definition: oledlg.h:403
DWORD flags
Definition: pastespl.c:45
smooth NULL
Definition: ftsmooth.c:416
static void free_structure(ps_struct_t *ps_struct)
Definition: pastespl.c:502
static void selection_change(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:455
LPFNOLEUIHOOK lpfnHook
Definition: oledlg.h:404
static void mode_change(HWND hdlg, ps_struct_t *ps_struct, UINT id)
Definition: pastespl.c:461
#define TRACE(s)
Definition: solgame.cpp:4
static void post_help_msg(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:479
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_PS_PASTE
Definition: oledlg.h:449
#define BN_CLICKED
Definition: winuser.h:1886
static void get_descriptors(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:141
WCHAR * type_name
Definition: pastespl.c:48
int ret
#define WM_COMMAND
Definition: winuser.h:1716
static void update_structure(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:489
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static void send_end_dialog_msg(HWND hdlg, ps_struct_t *ps_struct, UINT id)
Definition: pastespl.c:484
#define msg(x)
Definition: auth_time.c:54
#define PSF_SHOWHELP
Definition: oledlg.h:428
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_PS_DISPLAYLIST
Definition: oledlg.h:454
WCHAR * link_source_name
Definition: pastespl.c:47
#define IDCANCEL
Definition: winuser.h:825
#define IDC_OLEUIHELP
Definition: oledlg.h:51
#define IDC_PS_PASTELINK
Definition: oledlg.h:450
WCHAR * source_name
Definition: pastespl.c:46
#define WM_INITDIALOG
Definition: winuser.h:1715
#define LOWORD(l)
Definition: pedump.c:82

Referenced by OleUIPasteSpecialW().

◆ selection_change()

static void selection_change ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 455 of file pastespl.c.

456 {
457  update_as_icon(hdlg, ps_struct);
458  update_result_text(hdlg, ps_struct);
459 }
static void update_result_text(HWND hdlg, const ps_struct_t *ps_struct)
Definition: pastespl.c:406
static void update_as_icon(HWND hdlg, ps_struct_t *ps_struct)
Definition: pastespl.c:389

Referenced by mode_change(), and ps_dlg_proc().

◆ send_end_dialog_msg()

static void send_end_dialog_msg ( HWND  hdlg,
ps_struct_t ps_struct,
UINT  id 
)
static

Definition at line 484 of file pastespl.c.

485 {
486  SendMessageW(hdlg, oleui_msg_enddialog, id, 0);
487 }
UINT oleui_msg_enddialog
Definition: oledlg_main.c:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ps_dlg_proc().

◆ strdupAtoW()

static WCHAR* strdupAtoW ( const char str)
inlinestatic

Definition at line 119 of file pastespl.c.

120 {
121  DWORD len;
122  WCHAR *ret;
123  if(!str) return NULL;
124  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
125  ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
126  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
127  return ret;
128 }
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by OleUIPasteSpecialA().

◆ strdupW()

static WCHAR* strdupW ( const WCHAR str)
inlinestatic

Definition at line 130 of file pastespl.c.

131 {
132  DWORD len;
133  WCHAR *ret;
134  if(!str) return NULL;
135  len = lstrlenW(str) + 1;
136  ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
137  memcpy(ret, str, len * sizeof(WCHAR));
138  return ret;
139 }
#define lstrlenW
Definition: compat.h:407
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722

Referenced by get_descriptors().

◆ update_as_icon()

static void update_as_icon ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 389 of file pastespl.c.

390 {
391  HWND icon_display = GetDlgItem(hdlg, IDC_PS_ICONDISPLAY);
392  HWND display_as_icon = GetDlgItem(hdlg, IDC_PS_DISPLAYASICON);
393  HWND change_icon = GetDlgItem(hdlg, IDC_PS_CHANGEICON);
394 
395  /* FIXME. No as icon handling */
396  ps_struct->flags &= ~PSF_CHECKDISPLAYASICON;
397 
399  EnableWindow(display_as_icon, 0);
400  ShowWindow(icon_display, SW_HIDE);
401  EnableWindow(icon_display, 0);
402  ShowWindow(change_icon, SW_HIDE);
403  EnableWindow(change_icon, 0);
404 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define SW_HIDE
Definition: winuser.h:762
#define IDC_PS_DISPLAYASICON
Definition: oledlg.h:455
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDC_PS_ICONDISPLAY
Definition: oledlg.h:456
DWORD flags
Definition: pastespl.c:45
#define PSF_CHECKDISPLAYASICON
Definition: oledlg.h:432
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_PS_CHANGEICON
Definition: oledlg.h:457
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by selection_change().

◆ update_display_list()

static void update_display_list ( HWND  hdlg,
UINT  src_list_id 
)
static

Definition at line 296 of file pastespl.c.

297 {
298  LONG count, i, old_pos;
299  WCHAR txt[256];
300  LONG item_data;
301  HWND display_list = GetDlgItem(hdlg, IDC_PS_DISPLAYLIST);
302  HWND list = GetDlgItem(hdlg, src_list_id);
303 
304  old_pos = SendMessageW(display_list, LB_GETCURSEL, 0, 0);
305  if(old_pos == -1) old_pos = 0;
306 
307  SendMessageW(display_list, WM_SETREDRAW, 0, 0);
308  SendMessageW(display_list, LB_RESETCONTENT, 0, 0);
310  for(i = 0; i < count; i++)
311  {
313  item_data = SendMessageW(list, LB_GETITEMDATA, i, 0);
314  SendMessageW(display_list, LB_INSERTSTRING, i, (LPARAM)txt);
315  SendMessageW(display_list, LB_SETITEMDATA, i, item_data);
316  }
317  SendMessageW(display_list, LB_SETCURSEL, 0, 0);
318  SendMessageW(display_list, WM_SETREDRAW, 1, 0);
319  if(GetForegroundWindow() == hdlg)
320  SetFocus(display_list);
321 }
#define LB_SETCURSEL
Definition: winuser.h:2024
#define LB_GETITEMDATA
Definition: winuser.h:2002
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WM_SETREDRAW
Definition: winuser.h:1598
HWND WINAPI SetFocus(_In_opt_ HWND)
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
#define LB_RESETCONTENT
Definition: winuser.h:2016
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:1999
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LB_SETITEMDATA
Definition: winuser.h:2026
#define LB_GETTEXT
Definition: winuser.h:2010
Definition: _list.h:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define IDC_PS_DISPLAYLIST
Definition: oledlg.h:454
#define LB_INSERTSTRING
Definition: winuser.h:2014

Referenced by init_lists(), and mode_change().

◆ update_result_text()

static void update_result_text ( HWND  hdlg,
const ps_struct_t ps_struct 
)
static

Definition at line 406 of file pastespl.c.

407 {
408  WCHAR resource_txt[200];
409  UINT res_id;
410  OLEUIPASTEENTRYW *pent;
411  LONG cur_sel;
412  static const WCHAR percent_s[] = {'%','s',0};
413  WCHAR *result_txt, *ptr;
414 
415  cur_sel = SendMessageW(GetDlgItem(hdlg, IDC_PS_DISPLAYLIST), LB_GETCURSEL, 0, 0);
416  if(cur_sel == -1) return;
418 
419  if(ps_struct->flags & PSF_SELECTPASTE)
420  {
421  if(ps_struct->flags & PSF_CHECKDISPLAYASICON)
423  else
424  res_id = IDS_PS_PASTE_DATA;
425  }
426  else
427  {
428  if(ps_struct->flags & PSF_CHECKDISPLAYASICON)
430  else
431  res_id = IDS_PS_PASTE_LINK_DATA;
432  }
433 
434  LoadStringW(OLEDLG_hInstance, res_id, resource_txt, ARRAY_SIZE(resource_txt));
435  if((ptr = strstrW(resource_txt, percent_s)))
436  {
437  /* FIXME handle %s in ResultText. Sub appname if IDS_PS_PASTE_OBJECT{_AS_ICON}. Else sub appropriate type name */
438  size_t result_txt_len = strlenW(pent->lpstrResultText);
439  ptrdiff_t offs = (char*)ptr - (char*)resource_txt;
440  result_txt = HeapAlloc(GetProcessHeap(), 0, (strlenW(resource_txt) + result_txt_len - 1) * sizeof(WCHAR));
441  memcpy(result_txt, resource_txt, offs);
442  memcpy((char*)result_txt + offs, pent->lpstrResultText, result_txt_len * sizeof(WCHAR));
443  memcpy((char*)result_txt + offs + result_txt_len * sizeof(WCHAR), ptr + 2, (strlenW(ptr + 2) + 1) * sizeof(WCHAR));
444  }
445  else
446  result_txt = resource_txt;
447 
448  SetDlgItemTextW(hdlg, IDC_PS_RESULTTEXT, result_txt);
449 
450  if(result_txt != resource_txt)
451  HeapFree(GetProcessHeap(), 0, result_txt);
452 
453 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define LB_GETITEMDATA
Definition: winuser.h:2002
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
long LONG
Definition: pedump.c:60
#define IDS_PS_PASTE_LINK_DATA
Definition: resource.h:56
static PVOID ptr
Definition: dispmode.c:27
DWORD flags
Definition: pastespl.c:45
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
#define strstrW(d, s)
Definition: unicode.h:32
#define PSF_CHECKDISPLAYASICON
Definition: oledlg.h:432
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_PS_PASTE_DATA
Definition: resource.h:53
#define IDS_PS_PASTE_LINK_OBJECT_AS_ICON
Definition: resource.h:58
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IDS_PS_PASTE_OBJECT_AS_ICON
Definition: resource.h:55
LPCWSTR lpstrResultText
Definition: oledlg.h:365
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
unsigned int UINT
Definition: ndis.h:50
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define PSF_SELECTPASTE
Definition: oledlg.h:429
#define IDC_PS_DISPLAYLIST
Definition: oledlg.h:454
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDC_PS_RESULTTEXT
Definition: oledlg.h:459

Referenced by selection_change().

◆ update_src_text()

static void update_src_text ( HWND  hdlg,
const ps_struct_t ps_struct 
)
static

Definition at line 366 of file pastespl.c.

367 {
368  WCHAR *str;
369 
370  if(ps_struct->flags & PSF_SELECTPASTE)
371  {
372  if(ps_struct->source_name)
373  str = ps_struct->source_name;
374  else
375  str = ps_struct->link_source_name;
376 
377  }
378  else
379  {
380  if(ps_struct->link_source_name)
381  str = ps_struct->link_source_name;
382  else
383  str = ps_struct->source_name;
384 
385  }
387 }
#define IDC_PS_SOURCETEXT
Definition: oledlg.h:451
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
DWORD flags
Definition: pastespl.c:45
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSF_SELECTPASTE
Definition: oledlg.h:429
WCHAR * link_source_name
Definition: pastespl.c:47
WCHAR * source_name
Definition: pastespl.c:46

Referenced by mode_change(), and ps_dlg_proc().

◆ update_structure()

static void update_structure ( HWND  hdlg,
ps_struct_t ps_struct 
)
static

Definition at line 489 of file pastespl.c.

490 {
492  if(cur_sel != -1)
493  {
494  OLEUIPASTEENTRYW *pent;
496  ps_struct->ps->nSelectedIndex = pent->dwScratchSpace;
497  }
498  ps_struct->ps->dwFlags = ps_struct->flags;
499  ps_struct->ps->fLink = (ps_struct->flags & PSF_SELECTPASTELINK) != 0;
500 }
OLEUIPASTESPECIALW * ps
Definition: pastespl.c:44
#define LB_GETITEMDATA
Definition: winuser.h:2002
DWORD dwScratchSpace
Definition: oledlg.h:367
long LONG
Definition: pedump.c:60
DWORD flags
Definition: pastespl.c:45
#define PSF_SELECTPASTELINK
Definition: oledlg.h:430
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
#define IDC_PS_DISPLAYLIST
Definition: oledlg.h:454

Referenced by ps_dlg_proc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ ps_flags

const struct ps_flag ps_flags[]
static
Initial value:
= {
#define PS_FLAG_ENTRY(p)
{-1, NULL}
}
#define PSF_STAYONCLIPBOARDCHANGE
Definition: oledlg.h:435
#define PSF_NOREFRESHDATAOBJECT
Definition: oledlg.h:436
#define PS_FLAG_ENTRY(p)
smooth NULL
Definition: ftsmooth.c:416
#define PSF_CHECKDISPLAYASICON
Definition: oledlg.h:432
#define PSF_SELECTPASTELINK
Definition: oledlg.h:430
#define PSF_HIDECHANGEICON
Definition: oledlg.h:434
#define PSF_DISABLEDISPLAYASICON
Definition: oledlg.h:433
#define PSF_SHOWHELP
Definition: oledlg.h:428
#define PSF_SELECTPASTE
Definition: oledlg.h:429

Referenced by dump_ps_flags().