ReactOS 0.4.16-dev-1946-g52006dd
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)
 
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)
 
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)
 
HRESULT __thiscall fnTextSrv_TxGetHScroll (ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
 
HRESULT __thiscall fnTextSrv_TxGetVScroll (ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
 
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)
 
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)
 
HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate (ITextServices *iface, const RECT *client)
 
HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate (ITextServices *iface)
 
HRESULT __thiscall fnTextSrv_OnTxUIActivate (ITextServices *iface)
 
HRESULT __thiscall fnTextSrv_OnTxUIDeactivate (ITextServices *iface)
 
HRESULT __thiscall fnTextSrv_TxGetText (ITextServices *iface, BSTR *text)
 
HRESULT __thiscall fnTextSrv_TxSetText (ITextServices *iface, const WCHAR *text)
 
HRESULT __thiscall fnTextSrv_TxGetCurTargetX (ITextServices *iface, LONG *x)
 
HRESULT __thiscall fnTextSrv_TxGetBaseLinePos (ITextServices *iface, LONG *x)
 
HRESULT __thiscall fnTextSrv_TxGetNaturalSize (ITextServices *iface, DWORD aspect, HDC draw, HDC target, DVTARGETDEVICE *td, DWORD mode, const SIZEL *extent, LONG *width, LONG *height)
 
HRESULT __thiscall fnTextSrv_TxGetDropTarget (ITextServices *iface, IDropTarget **ppDropTarget)
 
HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange (ITextServices *iface, DWORD mask, DWORD bits)
 
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 579 of file txtsrv.c.

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

Referenced by create_windowed_editor(), and CreateTextServices().

◆ CreateTextServices()

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

Definition at line 610 of file txtsrv.c.

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

◆ 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()

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

Definition at line 256 of file txtsrv.c.

257{
259 HRESULT hr;
260 BOOL old_active = services->editor->in_place_active;
261
262 TRACE( "%p: %s\n", services, wine_dbgstr_rect( client ) );
263
264 services->editor->in_place_active = TRUE;
266 if (FAILED( hr ))
267 {
268 services->editor->in_place_active = old_active;
269 return hr;
270 }
271 ME_RewrapRepaint( services->editor );
272 return S_OK;
273}
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)
Definition: paint.c:160
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FAILED(hr)
Definition: intsafe.h:51
static FILE * client
Definition: client.c:37
HRESULT hr
Definition: shlfolder.c:183

◆ fnTextSrv_OnTxInPlaceDeactivate()

HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate ( ITextServices *  iface)

Definition at line 276 of file txtsrv.c.

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

◆ fnTextSrv_OnTxPropertyBitsChange()

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

Definition at line 412 of file txtsrv.c.

413{
415 DWORD scrollbars;
416 HRESULT hr;
417 BOOL repaint = FALSE;
418
419 TRACE( "%p, mask %08lx, bits %08lx\n", services, mask, bits );
420
421 services->editor->props = (services->editor->props & ~mask) | (bits & mask);
423 services->editor->bWordWrap = (services->editor->props & TXTBIT_WORDWRAP) && (services->editor->props & TXTBIT_MULTILINE);
424
426 {
427 hr = ITextHost_TxGetScrollBars( services->editor->texthost, &scrollbars );
428 if (SUCCEEDED( hr ))
429 {
430 if ((services->editor->scrollbars ^ scrollbars) & WS_HSCROLL)
431 ITextHost_TxShowScrollBar( services->editor->texthost, SB_HORZ, (scrollbars & WS_HSCROLL) &&
432 services->editor->nTotalWidth > services->editor->sizeWindow.cx );
433 if ((services->editor->scrollbars ^ scrollbars) & WS_VSCROLL)
434 ITextHost_TxShowScrollBar( services->editor->texthost, SB_VERT, (scrollbars & WS_VSCROLL) &&
435 services->editor->nTotalLength > services->editor->sizeWindow.cy );
436 services->editor->scrollbars = scrollbars;
437 }
438 }
439
440 if ((mask & TXTBIT_HIDESELECTION) && !services->editor->bHaveFocus) ME_InvalidateSelection( services->editor );
441
443 {
444 LONG width;
445
446 hr = ITextHost_TxGetSelectionBarWidth( services->editor->texthost, &width );
447 if (hr == S_OK)
448 {
449 ITextHost_TxInvalidateRect( services->editor->texthost, &services->editor->rcFormat, TRUE );
450 services->editor->rcFormat.left -= services->editor->selofs;
451 services->editor->selofs = width ? SELECTIONBAR_WIDTH : 0; /* FIXME: convert from HIMETRIC */
452 services->editor->rcFormat.left += services->editor->selofs;
453 repaint = TRUE;
454 }
455 }
456
458 {
460 if (SUCCEEDED( hr )) repaint = TRUE;
461 }
462
464 {
465 if (bits & TXTBIT_USEPASSWORD) ITextHost_TxGetPasswordChar( services->editor->texthost, &services->editor->password_char );
466 else services->editor->password_char = 0;
467 repaint = TRUE;
468 }
469
470 if (repaint) ME_RewrapRepaint( services->editor );
471
472 return S_OK;
473}
void ME_InvalidateSelection(ME_TextEditor *editor)
Definition: paint.c:1253
#define ITextHost_TxShowScrollBar(This, a, b)
Definition: editor.h:334
#define ITextHost_TxInvalidateRect(This, a, b)
Definition: editor.h:338
#define ITextHost_TxGetScrollBars(This, a)
Definition: editor.h:360
#define ITextHost_TxGetSelectionBarWidth(This, a)
Definition: editor.h:370
#define ITextHost_TxGetPasswordChar(This, a)
Definition: editor.h:361
#define SELECTIONBAR_WIDTH
Definition: editstr.h:98
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()

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 226 of file txtsrv.c.

229{
231
232 TRACE( "%p: %ld, %ld, %p, %p, draw %p target %p client %s pos (%d, %d)\n", services, aspect, index, aspect_info, td, draw,
234
235 if (aspect != DVASPECT_CONTENT || index || aspect_info || td || draw || target || client)
236 FIXME( "Ignoring most params\n" );
237
238 link_notify( services->editor, WM_SETCURSOR, 0, MAKELPARAM( x, y ) );
239 editor_set_cursor( services->editor, x, y );
240 return S_OK;
241}
#define FIXME(fmt,...)
Definition: precomp.h:53
void editor_set_cursor(ME_TextEditor *editor, int x, int y)
Definition: editor.c:2831
void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:3133
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
Definition: tools.h:99
#define MAKELPARAM(l, h)
Definition: winuser.h:4110
#define WM_SETCURSOR
Definition: winuser.h:1664

◆ fnTextSrv_OnTxUIActivate()

HRESULT __thiscall fnTextSrv_OnTxUIActivate ( ITextServices *  iface)

Definition at line 286 of file txtsrv.c.

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

◆ fnTextSrv_OnTxUIDeactivate()

HRESULT __thiscall fnTextSrv_OnTxUIDeactivate ( ITextServices *  iface)

Definition at line 295 of file txtsrv.c.

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

◆ 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()

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 %ld, %ld, %p, %p, draw %p, target %p, bounds %s, mf_bounds %s, update %s, %p, %ld, view %ld\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 if (view_id == TXTVIEW_ACTIVE && services->editor->freeze_count) return E_UNEXPECTED;
173
174 hr = update_client_rect( services, (RECT *)bounds );
175 if (FAILED( hr )) return hr;
176 if (hr == S_OK) rewrap = TRUE;
177
178 if (!dc && services->editor->in_place_active)
179 dc = ITextHost_TxGetDC( services->editor->texthost );
180 if (!dc) return E_FAIL;
181
182 if (rewrap)
183 {
186 }
187
188 if (!services->editor->bEmulateVersion10 || services->editor->nEventMask & ENM_UPDATE)
189 ITextHost_TxNotify( services->editor->texthost, EN_UPDATE, NULL );
190
191 editor_draw( services->editor, dc, update );
192
193 if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
194 return S_OK;
195}
HDC dc
Definition: cylfrac.c:34
#define E_FAIL
Definition: ddrawi.h:102
void editor_draw(ME_TextEditor *editor, HDC hDC, const RECT *update)
Definition: paint.c:33
#define ITextHost_TxNotify(This, a, b)
Definition: editor.h:367
BOOL wrap_marked_paras_dc(ME_TextEditor *editor, HDC hdc, BOOL invalidate)
Definition: wrap.c:1032
#define ITextHost_TxGetDC(This)
Definition: editor.h:332
#define ITextHost_TxReleaseDC(This, a)
Definition: editor.h:333
void editor_mark_rewrap_all(ME_TextEditor *editor)
Definition: para.c:235
static HDC
Definition: imagelist.c:88
#define ENM_UPDATE
Definition: richedit.h:469
Definition: windef.h:99
@ TXTVIEW_ACTIVE
Definition: textserv.h:181
#define E_UNEXPECTED
Definition: winerror.h:3528
#define EN_UPDATE
Definition: winuser.h:2057

◆ fnTextSrv_TxGetBaseLinePos()

HRESULT __thiscall fnTextSrv_TxGetBaseLinePos ( ITextServices *  iface,
LONG x 
)

Definition at line 354 of file txtsrv.c.

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

◆ fnTextSrv_TxGetCachedSize()

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

Definition at line 476 of file txtsrv.c.

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

◆ fnTextSrv_TxGetCurTargetX()

HRESULT __thiscall fnTextSrv_TxGetCurTargetX ( ITextServices *  iface,
LONG x 
)

Definition at line 345 of file txtsrv.c.

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

◆ fnTextSrv_TxGetDropTarget()

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

Definition at line 403 of file txtsrv.c.

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

◆ fnTextSrv_TxGetHScroll()

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

Definition at line 198 of file txtsrv.c.

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

◆ fnTextSrv_TxGetNaturalSize()

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 363 of file txtsrv.c.

366{
368 RECT rect;
369 HDC dc = draw;
370 BOOL rewrap = FALSE;
371 HRESULT hr;
372
373 TRACE( "%p: aspect %ld, draw %p, target %p, td %p, mode %08lx, extent %s, *width %ld, *height %ld\n", services,
374 aspect, draw, target, td, mode, wine_dbgstr_point( (POINT *)extent ), *width, *height );
375
376 if (aspect != DVASPECT_CONTENT || target || td || mode != TXTNS_FITTOCONTENT )
377 FIXME( "Many arguments are ignored\n" );
378
379 SetRect( &rect, 0, 0, *width, *height );
380
382 if (FAILED( hr )) return hr;
383 if (hr == S_OK) rewrap = TRUE;
384
385 if (!dc && services->editor->in_place_active)
386 dc = ITextHost_TxGetDC( services->editor->texthost );
387 if (!dc) return E_FAIL;
388
389 if (rewrap)
390 {
393 }
394
395 *width = services->editor->nTotalWidth;
396 *height = services->editor->nTotalLength;
397
398 if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
399 return S_OK;
400}
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()

HRESULT __thiscall fnTextSrv_TxGetText ( ITextServices *  iface,
BSTR text 
)

Definition at line 304 of file txtsrv.c.

305{
307 int length;
308
309 length = ME_GetTextLength( services->editor );
310 if (length)
311 {
313 BSTR bstr;
314 bstr = SysAllocStringByteLen( NULL, length * sizeof(WCHAR) );
315 if (bstr == NULL) return E_OUTOFMEMORY;
316
317 cursor_from_char_ofs( services->editor, 0, &start );
318 ME_GetTextW( services->editor, bstr, length, &start, INT_MAX, FALSE, FALSE );
319 *text = bstr;
320 }
321 else *text = NULL;
322
323 return S_OK;
324}
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:4325
void cursor_from_char_ofs(ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor)
Definition: run.c:245
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()

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

Definition at line 212 of file txtsrv.c.

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

◆ fnTextSrv_TxQueryHitPoint()

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 244 of file txtsrv.c.

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

◆ fnTextSrv_TxSendMessage()

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:3266
GLuint res
Definition: glext.h:9613
GLuint64EXT * result
Definition: glext.h:11304
LONG_PTR LRESULT
Definition: minwindef.h:176

◆ fnTextSrv_TxSetText()

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

Definition at line 327 of file txtsrv.c.

328{
331
334 if (text) ME_InsertTextFromCursor( services->editor, 0, text, -1, services->editor->pBuffer->pDefaultStyle );
335 set_selection_cursors( services->editor, 0, 0);
336 services->editor->nModifyStep = 0;
338 ME_EmptyUndoStack( services->editor );
339 ME_UpdateRepaint( services->editor, FALSE );
340
341 return S_OK;
342}
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:584
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_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
Definition: paint.c:132
void ME_EmptyUndoStack(ME_TextEditor *editor)
Definition: undo.c:53
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 = %ld\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:3479

◆ 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 = %ld\n", services, ref );
80
81 if (!ref)
82 {
84 ME_DestroyEditor( services->editor );
85 free( services );
86 }
87 return ref;
88}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
void ME_DestroyEditor(ME_TextEditor *editor)
Definition: editor.c:3077
void richole_release_children(struct text_services *services)
Definition: richole.c:5943

◆ 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:353
#define S_FALSE
Definition: winerror.h:3451
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:
=
{
}
HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
Definition: txtsrv.c:295
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:226
HRESULT __thiscall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: txtsrv.c:121
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
Definition: txtsrv.c:114
HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate(ITextServices *iface)
Definition: txtsrv.c:276
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:363
HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
Definition: txtsrv.c:354
HRESULT __thiscall fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
Definition: txtsrv.c:212
HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
Definition: txtsrv.c:403
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:244
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID iid, void **obj)
Definition: txtsrv.c:102
HRESULT __thiscall fnTextSrv_TxSetText(ITextServices *iface, const WCHAR *text)
Definition: txtsrv.c:327
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
Definition: txtsrv.c:108
HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
Definition: txtsrv.c:345
HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface)
Definition: txtsrv.c:286
HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate(ITextServices *iface, const RECT *client)
Definition: txtsrv.c:256
HRESULT __thiscall fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos, LONG *page, BOOL *enabled)
Definition: txtsrv.c:198
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
HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD mask, DWORD bits)
Definition: txtsrv.c:412
HRESULT __thiscall fnTextSrv_TxGetText(ITextServices *iface, BSTR *text)
Definition: txtsrv.c:304
#define THISCALL(func)
Definition: asm.h:195

Definition at line 554 of file txtsrv.c.

Referenced by create_text_services().