ReactOS 0.4.16-dev-1044-ga6558c0
txtsrv.c File Reference
#include "editor.h"
#include "ole2.h"
#include "oleauto.h"
#include "richole.h"
#include "tom.h"
#include "imm.h"
#include "textserv.h"
#include "wine/debug.h"
#include "editstr.h"
#include "riched20.h"
Include dependency graph for txtsrv.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (richedit)
 
static struct text_servicesimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI ITextServicesImpl_QueryInterface (IUnknown *iface, REFIID iid, void **obj)
 
static ULONG WINAPI ITextServicesImpl_AddRef (IUnknown *iface)
 
static ULONG WINAPI ITextServicesImpl_Release (IUnknown *iface)
 
static struct text_servicesimpl_from_ITextServices (ITextServices *iface)
 
static HRESULT WINAPI fnTextSrv_QueryInterface (ITextServices *iface, REFIID iid, void **obj)
 
static ULONG WINAPI fnTextSrv_AddRef (ITextServices *iface)
 
static ULONG WINAPI fnTextSrv_Release (ITextServices *iface)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage (ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result)
 
static HRESULT update_client_rect (struct text_services *services, const RECT *client)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw (ITextServices *iface, DWORD aspect, LONG index, void *aspect_info, DVTARGETDEVICE *td, HDC draw, HDC target, const RECTL *bounds, const RECTL *mf_bounds, RECT *update, BOOL(CALLBACK *continue_fn)(DWORD), DWORD continue_param, LONG view_id)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll (ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll (ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor (ITextServices *iface, DWORD aspect, LONG index, void *aspect_info, DVTARGETDEVICE *td, HDC draw, HDC target, const RECT *client, INT x, INT y)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint (ITextServices *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y, DWORD *pHitResult)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate (ITextServices *iface, const RECT *client)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate (ITextServices *iface)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate (ITextServices *iface)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate (ITextServices *iface)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText (ITextServices *iface, BSTR *text)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText (ITextServices *iface, const WCHAR *text)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX (ITextServices *iface, LONG *x)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos (ITextServices *iface, LONG *x)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize (ITextServices *iface, DWORD aspect, HDC draw, HDC target, DVTARGETDEVICE *td, DWORD mode, const SIZEL *extent, LONG *width, LONG *height)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget (ITextServices *iface, IDropTarget **ppDropTarget)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange (ITextServices *iface, DWORD mask, DWORD bits)
 
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCachedSize (ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
 
HRESULT create_text_services (IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10)
 
HRESULT WINAPI CreateTextServices (IUnknown *outer, ITextHost *text_host, IUnknown **unk)
 

Variables

static const IUnknownVtbl textservices_inner_vtbl
 
static const ITextServicesVtbl textservices_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file txtsrv.c.

Function Documentation

◆ create_text_services()

HRESULT create_text_services ( IUnknown outer,
ITextHost *  text_host,
IUnknown **  unk,
BOOL  emulate_10 
)

Definition at line 577 of file txtsrv.c.

578{
579 struct text_services *services;
580
581 TRACE( "%p %p --> %p\n", outer, text_host, unk );
582 if (text_host == NULL) return E_POINTER;
583
584 services = CoTaskMemAlloc( sizeof(*services) );
585 if (services == NULL) return E_OUTOFMEMORY;
586 services->ref = 1;
587 services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
588 services->ITextServices_iface.lpVtbl = &textservices_vtbl;
589 services->IRichEditOle_iface.lpVtbl = &re_ole_vtbl;
590 services->ITextDocument2Old_iface.lpVtbl = &text_doc2old_vtbl;
591 services->editor = ME_MakeEditor( text_host, emulate_10 );
592 services->editor->richole = &services->IRichEditOle_iface;
593
594 if (outer) services->outer_unk = outer;
595 else services->outer_unk = &services->IUnknown_inner;
596
597 services->text_selection = NULL;
598 list_init( &services->rangelist );
599 list_init( &services->clientsites );
600
601 *unk = &services->IUnknown_inner;
602 return S_OK;
603}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
ME_TextEditor * ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
Definition: editor.c:2933
const IRichEditOleVtbl re_ole_vtbl
Definition: richole.c:1408
const ITextDocument2OldVtbl text_doc2old_vtbl
Definition: richole.c:4469
static const IUnknownVtbl textservices_inner_vtbl
Definition: txtsrv.c:90
static const ITextServicesVtbl textservices_vtbl
Definition: txtsrv.c:552
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4
#define E_POINTER
Definition: winerror.h:2365

Referenced by create_windowed_editor(), and CreateTextServices().

◆ CreateTextServices()

HRESULT WINAPI CreateTextServices ( IUnknown outer,
ITextHost *  text_host,
IUnknown **  unk 
)

Definition at line 608 of file txtsrv.c.

609{
610 return create_text_services( outer, text_host, unk, FALSE );
611}
#define FALSE
Definition: types.h:117
HRESULT create_text_services(IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10)
Definition: txtsrv.c:577

◆ fnTextSrv_AddRef()

static ULONG WINAPI fnTextSrv_AddRef ( ITextServices *  iface)
static

Definition at line 108 of file txtsrv.c.

109{
111 return IUnknown_AddRef( services->outer_unk );
112}
static struct text_services * impl_from_ITextServices(ITextServices *iface)
Definition: txtsrv.c:97

◆ fnTextSrv_OnTxInPlaceActivate()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate ( ITextServices *  iface,
const RECT client 
)

Definition at line 254 of file txtsrv.c.

255{
257 HRESULT hr;
258 BOOL old_active = services->editor->in_place_active;
259
260 TRACE( "%p: %s\n", services, wine_dbgstr_rect( client ) );
261
262 services->editor->in_place_active = TRUE;
264 if (FAILED( hr ))
265 {
266 services->editor->in_place_active = old_active;
267 return hr;
268 }
269 ME_RewrapRepaint( services->editor );
270 return S_OK;
271}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define TRUE
Definition: types.h:120
static HRESULT update_client_rect(struct text_services *services, const RECT *client)
Definition: txtsrv.c:133
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:156
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FAILED(hr)
Definition: intsafe.h:51
static FILE * client
Definition: client.c:41
HRESULT hr
Definition: shlfolder.c:183

◆ fnTextSrv_OnTxInPlaceDeactivate()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate ( ITextServices *  iface)

Definition at line 274 of file txtsrv.c.

275{
277
278 TRACE( "%p\n", services );
279 services->editor->in_place_active = FALSE;
280 return S_OK;
281}

◆ fnTextSrv_OnTxPropertyBitsChange()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange ( ITextServices *  iface,
DWORD  mask,
DWORD  bits 
)

Definition at line 410 of file txtsrv.c.

411{
413 DWORD scrollbars;
414 HRESULT hr;
415 BOOL repaint = FALSE;
416
417 TRACE( "%p, mask %08x, bits %08x\n", services, mask, bits );
418
419 services->editor->props = (services->editor->props & ~mask) | (bits & mask);
421 services->editor->bWordWrap = (services->editor->props & TXTBIT_WORDWRAP) && (services->editor->props & TXTBIT_MULTILINE);
422
424 {
425 hr = ITextHost_TxGetScrollBars( services->editor->texthost, &scrollbars );
426 if (SUCCEEDED( hr ))
427 {
428 if ((services->editor->scrollbars ^ scrollbars) & WS_HSCROLL)
429 ITextHost_TxShowScrollBar( services->editor->texthost, SB_HORZ, (scrollbars & WS_HSCROLL) &&
430 services->editor->nTotalWidth > services->editor->sizeWindow.cx );
431 if ((services->editor->scrollbars ^ scrollbars) & WS_VSCROLL)
432 ITextHost_TxShowScrollBar( services->editor->texthost, SB_VERT, (scrollbars & WS_VSCROLL) &&
433 services->editor->nTotalLength > services->editor->sizeWindow.cy );
434 services->editor->scrollbars = scrollbars;
435 }
436 }
437
438 if ((mask & TXTBIT_HIDESELECTION) && !services->editor->bHaveFocus) ME_InvalidateSelection( services->editor );
439
441 {
442 LONG width;
443
444 hr = ITextHost_TxGetSelectionBarWidth( services->editor->texthost, &width );
445 if (hr == S_OK)
446 {
447 ITextHost_TxInvalidateRect( services->editor->texthost, &services->editor->rcFormat, TRUE );
448 services->editor->rcFormat.left -= services->editor->selofs;
449 services->editor->selofs = width ? SELECTIONBAR_WIDTH : 0; /* FIXME: convert from HIMETRIC */
450 services->editor->rcFormat.left += services->editor->selofs;
451 repaint = TRUE;
452 }
453 }
454
456 {
458 if (SUCCEEDED( hr )) repaint = TRUE;
459 }
460
462 {
463 if (bits & TXTBIT_USEPASSWORD) ITextHost_TxGetPasswordChar( services->editor->texthost, &services->editor->password_char );
464 else services->editor->password_char = 0;
465 repaint = TRUE;
466 }
467
468 if (repaint) ME_RewrapRepaint( services->editor );
469
470 return S_OK;
471}
#define ITextHost_TxShowScrollBar(This, a, b)
Definition: editor.h:335
#define ITextHost_TxInvalidateRect(This, a, b)
Definition: editor.h:339
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:1247
#define ITextHost_TxGetScrollBars(This, a)
Definition: editor.h:361
#define ITextHost_TxGetSelectionBarWidth(This, a)
Definition: editor.h:371
#define ITextHost_TxGetPasswordChar(This, a)
Definition: editor.h:362
#define SELECTIONBAR_WIDTH
Definition: editstr.h:99
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define WS_VSCROLL
Definition: pedump.c:627
long LONG
Definition: pedump.c:60
#define WS_HSCROLL
Definition: pedump.c:628
#define TXTBIT_WORDWRAP
Definition: textserv.h:195
#define TXTBIT_CLIENTRECTCHANGE
Definition: textserv.h:205
#define TXTBIT_MULTILINE
Definition: textserv.h:186
#define TXTBIT_SCROLLBARCHANGE
Definition: textserv.h:201
#define TXTBIT_USEPASSWORD
Definition: textserv.h:189
#define TXTBIT_HIDESELECTION
Definition: textserv.h:190
#define TXTBIT_SELBARCHANGE
Definition: textserv.h:194
#define SB_VERT
Definition: winuser.h:553
#define SB_HORZ
Definition: winuser.h:552

◆ fnTextSrv_OnTxSetCursor()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor ( ITextServices *  iface,
DWORD  aspect,
LONG  index,
void aspect_info,
DVTARGETDEVICE *  td,
HDC  draw,
HDC  target,
const RECT client,
INT  x,
INT  y 
)

Definition at line 224 of file txtsrv.c.

227{
229
230 TRACE( "%p: %d, %d, %p, %p, draw %p target %p client %s pos (%d, %d)\n", services, aspect, index, aspect_info, td, draw,
232
233 if (aspect != DVASPECT_CONTENT || index || aspect_info || td || draw || target || client)
234 FIXME( "Ignoring most params\n" );
235
236 link_notify( services->editor, WM_SETCURSOR, 0, MAKELPARAM( x, y ) );
237 editor_set_cursor( services->editor, x, y );
238 return S_OK;
239}
#define FIXME(fmt,...)
Definition: precomp.h:53
void editor_set_cursor(ME_TextEditor *editor, int x, int y)
Definition: editor.c:2824
void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:3122
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint index
Definition: glext.h:6031
GLenum target
Definition: glext.h:7315
#define MAKELPARAM(l, h)
Definition: winuser.h:4019
#define WM_SETCURSOR
Definition: winuser.h:1647

◆ fnTextSrv_OnTxUIActivate()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate ( ITextServices *  iface)

Definition at line 284 of file txtsrv.c.

285{
287
288 FIXME( "%p: STUB\n", services );
289 return E_NOTIMPL;
290}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ fnTextSrv_OnTxUIDeactivate()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate ( ITextServices *  iface)

Definition at line 293 of file txtsrv.c.

294{
296
297 FIXME( "%p: STUB\n", services );
298 return E_NOTIMPL;
299}

◆ fnTextSrv_QueryInterface()

static HRESULT WINAPI fnTextSrv_QueryInterface ( ITextServices *  iface,
REFIID  iid,
void **  obj 
)
static

Definition at line 102 of file txtsrv.c.

103{
105 return IUnknown_QueryInterface( services->outer_unk, iid, obj );
106}

◆ fnTextSrv_Release()

static ULONG WINAPI fnTextSrv_Release ( ITextServices *  iface)
static

Definition at line 114 of file txtsrv.c.

115{
117 return IUnknown_Release( services->outer_unk );
118}

◆ fnTextSrv_TxDraw()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw ( ITextServices *  iface,
DWORD  aspect,
LONG  index,
void aspect_info,
DVTARGETDEVICE *  td,
HDC  draw,
HDC  target,
const RECTL bounds,
const RECTL mf_bounds,
RECT update,
BOOL(CALLBACK *continue_fn)(DWORD ,
DWORD  continue_param,
LONG  view_id 
)

Definition at line 154 of file txtsrv.c.

159{
161 HRESULT hr;
162 HDC dc = draw;
163 BOOL rewrap = FALSE;
164
165 TRACE( "%p: aspect %d, %d, %p, %p, draw %p, target %p, bounds %s, mf_bounds %s, update %s, %p, %d, view %d\n",
166 services, aspect, index, aspect_info, td, draw, target, wine_dbgstr_rect( (RECT *)bounds ),
167 wine_dbgstr_rect( (RECT *)mf_bounds ), wine_dbgstr_rect( update ), continue_fn, continue_param, view_id );
168
169 if (aspect != DVASPECT_CONTENT || aspect_info || td || target || mf_bounds || continue_fn )
170 FIXME( "Many arguments are ignored\n" );
171
172 hr = update_client_rect( services, (RECT *)bounds );
173 if (FAILED( hr )) return hr;
174 if (hr == S_OK) rewrap = TRUE;
175
176 if (!dc && services->editor->in_place_active)
177 dc = ITextHost_TxGetDC( services->editor->texthost );
178 if (!dc) return E_FAIL;
179
180 if (rewrap)
181 {
184 }
185
186 if (!services->editor->bEmulateVersion10 || services->editor->nEventMask & ENM_UPDATE)
187 ITextHost_TxNotify( services->editor->texthost, EN_UPDATE, NULL );
188
189 editor_draw( services->editor, dc, update );
190
191 if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
192 return S_OK;
193}
HDC dc
Definition: cylfrac.c:34
#define E_FAIL
Definition: ddrawi.h:102
void editor_draw(ME_TextEditor *editor, HDC hDC, const RECT *update) DECLSPEC_HIDDEN
Definition: paint.c:33
BOOL wrap_marked_paras_dc(ME_TextEditor *editor, HDC hdc, BOOL invalidate) DECLSPEC_HIDDEN
Definition: wrap.c:1023
void editor_mark_rewrap_all(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: para.c:237
#define ITextHost_TxNotify(This, a, b)
Definition: editor.h:368
#define ITextHost_TxGetDC(This)
Definition: editor.h:333
#define ITextHost_TxReleaseDC(This, a)
Definition: editor.h:334
static HDC
Definition: imagelist.c:88
#define ENM_UPDATE
Definition: richedit.h:469
#define EN_UPDATE
Definition: winuser.h:2039

◆ fnTextSrv_TxGetBaseLinePos()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos ( ITextServices *  iface,
LONG x 
)

Definition at line 352 of file txtsrv.c.

353{
355
356 FIXME( "%p: STUB\n", services );
357 return E_NOTIMPL;
358}

◆ fnTextSrv_TxGetCachedSize()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCachedSize ( ITextServices *  iface,
DWORD pdwWidth,
DWORD pdwHeight 
)

Definition at line 474 of file txtsrv.c.

475{
477
478 FIXME( "%p: STUB\n", services );
479 return E_NOTIMPL;
480}

◆ fnTextSrv_TxGetCurTargetX()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX ( ITextServices *  iface,
LONG x 
)

Definition at line 343 of file txtsrv.c.

344{
346
347 FIXME( "%p: STUB\n", services );
348 return E_NOTIMPL;
349}

◆ fnTextSrv_TxGetDropTarget()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget ( ITextServices *  iface,
IDropTarget **  ppDropTarget 
)

Definition at line 401 of file txtsrv.c.

402{
404
405 FIXME( "%p: STUB\n", services );
406 return E_NOTIMPL;
407}

◆ fnTextSrv_TxGetHScroll()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll ( ITextServices *  iface,
LONG min_pos,
LONG max_pos,
LONG pos,
LONG page,
BOOL enabled 
)

Definition at line 196 of file txtsrv.c.

198{
200
201 if (min_pos) *min_pos = services->editor->horz_si.nMin;
202 if (max_pos) *max_pos = services->editor->horz_si.nMax;
203 if (pos) *pos = services->editor->horz_si.nPos;
204 if (page) *page = services->editor->horz_si.nPage;
205 if (enabled) *enabled = services->editor->horz_sb_enabled;
206 return S_OK;
207}
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
Definition: module.h:576

◆ fnTextSrv_TxGetNaturalSize()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize ( ITextServices *  iface,
DWORD  aspect,
HDC  draw,
HDC  target,
DVTARGETDEVICE *  td,
DWORD  mode,
const SIZEL extent,
LONG width,
LONG height 
)

Definition at line 361 of file txtsrv.c.

364{
366 RECT rect;
367 HDC dc = draw;
368 BOOL rewrap = FALSE;
369 HRESULT hr;
370
371 TRACE( "%p: aspect %d, draw %p, target %p, td %p, mode %08x, extent %s, *width %d, *height %d\n", services,
372 aspect, draw, target, td, mode, wine_dbgstr_point( (POINT *)extent ), *width, *height );
373
374 if (aspect != DVASPECT_CONTENT || target || td || mode != TXTNS_FITTOCONTENT )
375 FIXME( "Many arguments are ignored\n" );
376
377 SetRect( &rect, 0, 0, *width, *height );
378
380 if (FAILED( hr )) return hr;
381 if (hr == S_OK) rewrap = TRUE;
382
383 if (!dc && services->editor->in_place_active)
384 dc = ITextHost_TxGetDC( services->editor->texthost );
385 if (!dc) return E_FAIL;
386
387 if (rewrap)
388 {
391 }
392
393 *width = services->editor->nTotalWidth;
394 *height = services->editor->nTotalLength;
395
396 if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
397 return S_OK;
398}
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLenum mode
Definition: glext.h:6217
& rect
Definition: startmenu.cpp:1413
@ TXTNS_FITTOCONTENT
Definition: textserv.h:176
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

◆ fnTextSrv_TxGetText()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText ( ITextServices *  iface,
BSTR text 
)

Definition at line 302 of file txtsrv.c.

303{
305 int length;
306
307 length = ME_GetTextLength( services->editor );
308 if (length)
309 {
311 BSTR bstr;
312 bstr = SysAllocStringByteLen( NULL, length * sizeof(WCHAR) );
313 if (bstr == NULL) return E_OUTOFMEMORY;
314
315 cursor_from_char_ofs( services->editor, 0, &start );
316 ME_GetTextW( services->editor, bstr, length, &start, INT_MAX, FALSE, FALSE );
317 *text = bstr;
318 }
319 else *text = NULL;
320
321 return S_OK;
322}
OLECHAR * BSTR
Definition: compat.h:2293
const WCHAR * text
Definition: package.c:1794
int ME_GetTextLength(ME_TextEditor *editor)
Definition: caret.c:83
int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen, const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP)
Definition: editor.c:4310
void cursor_from_char_ofs(ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: run.c:240
GLuint start
Definition: gl.h:1545
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define INT_MAX
Definition: intsafe.h:150
BSTR WINAPI DECLSPEC_HOTPATCH SysAllocStringByteLen(LPCSTR str, UINT len)
Definition: oleaut.c:428
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ fnTextSrv_TxGetVScroll()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll ( ITextServices *  iface,
LONG min_pos,
LONG max_pos,
LONG pos,
LONG page,
BOOL enabled 
)

Definition at line 210 of file txtsrv.c.

212{
214
215 if (min_pos) *min_pos = services->editor->vert_si.nMin;
216 if (max_pos) *max_pos = services->editor->vert_si.nMax;
217 if (pos) *pos = services->editor->vert_si.nPos;
218 if (page) *page = services->editor->vert_si.nPage;
219 if (enabled) *enabled = services->editor->vert_sb_enabled;
220 return S_OK;
221}

◆ fnTextSrv_TxQueryHitPoint()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint ( ITextServices *  iface,
DWORD  dwDrawAspect,
LONG  lindex,
void pvAspect,
DVTARGETDEVICE *  ptd,
HDC  hdcDraw,
HDC  hicTargetDev,
LPCRECT  lprcClient,
INT  x,
INT  y,
DWORD pHitResult 
)

Definition at line 242 of file txtsrv.c.

246{
248
249 FIXME( "%p: STUB\n", services );
250 return E_NOTIMPL;
251}

◆ fnTextSrv_TxSendMessage()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage ( ITextServices *  iface,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam,
LRESULT result 
)

Definition at line 121 of file txtsrv.c.

123{
125 HRESULT hr;
126 LRESULT res;
127
129 if (result) *result = res;
130 return hr;
131}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
LRESULT editor_handle_message(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam, HRESULT *phresult)
Definition: editor.c:3256
GLuint res
Definition: glext.h:9613
GLuint64EXT * result
Definition: glext.h:11304
LONG_PTR LRESULT
Definition: windef.h:209

◆ fnTextSrv_TxSetText()

DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText ( ITextServices *  iface,
const WCHAR text 
)

Definition at line 325 of file txtsrv.c.

326{
329
332 if (text) ME_InsertTextFromCursor( services->editor, 0, text, -1, services->editor->pBuffer->pDefaultStyle );
333 set_selection_cursors( services->editor, 0, 0);
334 services->editor->nModifyStep = 0;
336 ME_EmptyUndoStack( services->editor );
337 ME_UpdateRepaint( services->editor, FALSE );
338
339 return S_OK;
340}
HRESULT WINAPI OleFlushClipboard(void)
Definition: clipboard.c:2293
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:27
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style)
Definition: caret.c:553
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce)
Definition: caret.c:339
int set_selection_cursors(ME_TextEditor *editor, int from, int to)
Definition: caret.c:132
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:53
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN
Definition: paint.c:129
const char cursor[]
Definition: icontest.c:13

◆ impl_from_ITextServices()

◆ impl_from_IUnknown()

static struct text_services * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 36 of file txtsrv.c.

37{
38 return CONTAINING_RECORD( iface, struct text_services, IUnknown_inner );
39}

Referenced by ITextServicesImpl_AddRef(), ITextServicesImpl_QueryInterface(), ITextServicesImpl_Release(), unk_AddRef(), unk_QueryInterface(), and unk_Release().

◆ ITextServicesImpl_AddRef()

static ULONG WINAPI ITextServicesImpl_AddRef ( IUnknown iface)
static

Definition at line 64 of file txtsrv.c.

65{
66 struct text_services *services = impl_from_IUnknown( iface );
68
69 TRACE( "(%p) ref = %d\n", services, ref );
70
71 return ref;
72}
#define InterlockedIncrement
Definition: armddk.h:53
static struct text_services * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:36
Definition: send.c:48

◆ ITextServicesImpl_QueryInterface()

static HRESULT WINAPI ITextServicesImpl_QueryInterface ( IUnknown iface,
REFIID  iid,
void **  obj 
)
static

Definition at line 41 of file txtsrv.c.

42{
43 struct text_services *services = impl_from_IUnknown( iface );
44
45 TRACE( "(%p)->(%s, %p)\n", iface, debugstr_guid( iid ), obj );
46
47 if (IsEqualIID( iid, &IID_IUnknown )) *obj = &services->IUnknown_inner;
48 else if (IsEqualIID( iid, &IID_ITextServices )) *obj = &services->ITextServices_iface;
49 else if (IsEqualIID( iid, &IID_IRichEditOle )) *obj= &services->IRichEditOle_iface;
50 else if (IsEqualIID( iid, &IID_IDispatch ) ||
51 IsEqualIID( iid, &IID_ITextDocument ) ||
52 IsEqualIID( iid, &IID_ITextDocument2Old )) *obj = &services->ITextDocument2Old_iface;
53 else
54 {
55 *obj = NULL;
56 FIXME( "Unknown interface: %s\n", debugstr_guid( iid ) );
57 return E_NOINTERFACE;
58 }
59
60 IUnknown_AddRef( (IUnknown *)*obj );
61 return S_OK;
62}
const GUID IID_IUnknown
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IDispatch
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
EXTERN_C const IID IID_ITextServices
Definition: textserv.h:36
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ITextServicesImpl_Release()

static ULONG WINAPI ITextServicesImpl_Release ( IUnknown iface)
static

Definition at line 74 of file txtsrv.c.

75{
76 struct text_services *services = impl_from_IUnknown( iface );
78
79 TRACE( "(%p) ref = %d\n", services, ref );
80
81 if (!ref)
82 {
84 ME_DestroyEditor( services->editor );
86 }
87 return ref;
88}
#define InterlockedDecrement
Definition: armddk.h:52
void ME_DestroyEditor(ME_TextEditor *editor)
Definition: editor.c:3066
void richole_release_children(struct text_services *services) DECLSPEC_HIDDEN
Definition: richole.c:5853
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

◆ update_client_rect()

static HRESULT update_client_rect ( struct text_services services,
const RECT client 
)
static

Definition at line 133 of file txtsrv.c.

134{
135 RECT rect;
136 HRESULT hr;
137
138 if (!client)
139 {
140 if (!services->editor->in_place_active) return E_INVALIDARG;
141 hr = ITextHost_TxGetClientRect( services->editor->texthost, &rect );
142 if (FAILED( hr )) return hr;
143 }
144 else rect = *client;
145
146 rect.left += services->editor->selofs;
147
148 if (EqualRect( &rect, &services->editor->rcFormat )) return S_FALSE;
149 services->editor->rcFormat = rect;
150 return S_OK;
151}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define ITextHost_TxGetClientRect(This, a)
Definition: editor.h:354
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by fnTextSrv_OnTxInPlaceActivate(), fnTextSrv_OnTxPropertyBitsChange(), fnTextSrv_TxDraw(), and fnTextSrv_TxGetNaturalSize().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( richedit  )

Variable Documentation

◆ textservices_inner_vtbl

const IUnknownVtbl textservices_inner_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
Definition: txtsrv.c:74
static ULONG WINAPI ITextServicesImpl_AddRef(IUnknown *iface)
Definition: txtsrv.c:64
static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID iid, void **obj)
Definition: txtsrv.c:41

Definition at line 90 of file txtsrv.c.

Referenced by create_text_services().

◆ textservices_vtbl

const ITextServicesVtbl textservices_vtbl
static
Initial value:
=
{
}
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD mask, DWORD bits)
Definition: txtsrv.c:410
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
Definition: txtsrv.c:196
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
Definition: txtsrv.c:114
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
Definition: txtsrv.c:210
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID iid, void **obj)
Definition: txtsrv.c:102
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD aspect, HDC draw, HDC target, DVTARGETDEVICE *td, DWORD mode, const SIZEL *extent, LONG *width, LONG *height)
Definition: txtsrv.c:361
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
Definition: txtsrv.c:108
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw(ITextServices *iface, DWORD aspect, LONG index, void *aspect_info, DVTARGETDEVICE *td, HDC draw, HDC target, const RECTL *bounds, const RECTL *mf_bounds, RECT *update, BOOL(CALLBACK *continue_fn)(DWORD), DWORD continue_param, LONG view_id)
Definition: txtsrv.c:154
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor(ITextServices *iface, DWORD aspect, LONG index, void *aspect_info, DVTARGETDEVICE *td, HDC draw, HDC target, const RECT *client, INT x, INT y)
Definition: txtsrv.c:224
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
Definition: txtsrv.c:401
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate(ITextServices *iface, const RECT *client)
Definition: txtsrv.c:254
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y, DWORD *pHitResult)
Definition: txtsrv.c:242
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
Definition: txtsrv.c:352
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText(ITextServices *iface, const WCHAR *text)
Definition: txtsrv.c:325
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface)
Definition: txtsrv.c:284
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate(ITextServices *iface)
Definition: txtsrv.c:274
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
Definition: txtsrv.c:293
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: txtsrv.c:121
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText(ITextServices *iface, BSTR *text)
Definition: txtsrv.c:302
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
Definition: txtsrv.c:343
#define THISCALL(func)
Definition: asm.h:153

Definition at line 552 of file txtsrv.c.

Referenced by create_text_services().