2006-02-01 12:31:40 +01:00
|
|
|
/*
|
|
|
|
* RichEdit - functions and interfaces around CreateTextServices
|
|
|
|
*
|
|
|
|
* Copyright 2005, 2006, Maarten Lankhorst
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-02-01 12:31:40 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "editor.h"
|
|
|
|
#include "ole2.h"
|
2009-01-20 07:41:44 +01:00
|
|
|
#include "oleauto.h"
|
2006-02-01 12:31:40 +01:00
|
|
|
#include "richole.h"
|
2014-10-28 13:10:46 +01:00
|
|
|
#include "tom.h"
|
2006-02-01 12:31:40 +01:00
|
|
|
#include "imm.h"
|
|
|
|
#include "textserv.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "editstr.h"
|
|
|
|
|
|
|
|
#ifdef __i386__ /* thiscall functions are i386-specific */
|
|
|
|
|
|
|
|
#define THISCALL(func) __thiscall_ ## func
|
2009-06-14 15:34:20 +02:00
|
|
|
#define DEFINE_THISCALL_WRAPPER(func,args) \
|
2006-02-01 12:31:40 +01:00
|
|
|
extern typeof(func) THISCALL(func); \
|
2009-06-14 15:34:20 +02:00
|
|
|
__ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
|
2006-02-01 12:31:40 +01:00
|
|
|
"popl %eax\n\t" \
|
|
|
|
"pushl %ecx\n\t" \
|
|
|
|
"pushl %eax\n\t" \
|
2009-06-14 15:34:20 +02:00
|
|
|
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
|
2006-02-01 12:31:40 +01:00
|
|
|
#else /* __i386__ */
|
|
|
|
|
|
|
|
#define THISCALL(func) func
|
2009-06-14 15:34:20 +02:00
|
|
|
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
#endif /* __i386__ */
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
|
|
|
|
|
|
|
typedef struct ITextServicesImpl {
|
2012-03-28 00:33:10 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServices ITextServices_iface;
|
2012-03-28 00:33:10 +02:00
|
|
|
IUnknown *outer_unk;
|
2006-02-01 12:31:40 +01:00
|
|
|
LONG ref;
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextHost *pMyHost;
|
2006-02-01 12:31:40 +01:00
|
|
|
CRITICAL_SECTION csTxtSrv;
|
2009-01-20 07:41:40 +01:00
|
|
|
ME_TextEditor *editor;
|
2008-10-09 23:14:39 +02:00
|
|
|
char spare[256];
|
2006-02-01 12:31:40 +01:00
|
|
|
} ITextServicesImpl;
|
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
static inline ITextServicesImpl *impl_from_IUnknown(IUnknown *iface)
|
2011-04-10 21:44:44 +02:00
|
|
|
{
|
2012-03-28 00:33:10 +02:00
|
|
|
return CONTAINING_RECORD(iface, ITextServicesImpl, IUnknown_inner);
|
2011-04-10 21:44:44 +02:00
|
|
|
}
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
|
|
|
*ppv = &This->IUnknown_inner;
|
2013-02-06 23:14:05 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_ITextServices))
|
2012-03-28 00:33:10 +02:00
|
|
|
*ppv = &This->ITextServices_iface;
|
2014-10-28 13:10:46 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument)) {
|
|
|
|
if (!This->editor->reOle)
|
|
|
|
if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
if (IsEqualIID(riid, &IID_ITextDocument))
|
|
|
|
ME_GetITextDocumentInterface(This->editor->reOle, ppv);
|
|
|
|
else
|
|
|
|
*ppv = This->editor->reOle;
|
|
|
|
} else {
|
2012-03-28 00:33:10 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
FIXME("Unknown interface: %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
2012-03-28 00:33:10 +02:00
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
static ULONG WINAPI ITextServicesImpl_AddRef(IUnknown *iface)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
2014-10-28 13:10:03 +01:00
|
|
|
ME_DestroyEditor(This->editor);
|
2007-03-10 22:10:28 +01:00
|
|
|
This->csTxtSrv.DebugInfo->Spare[0] = 0;
|
2006-02-01 12:31:40 +01:00
|
|
|
DeleteCriticalSection(&This->csTxtSrv);
|
|
|
|
CoTaskMemFree(This);
|
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
static const IUnknownVtbl textservices_inner_vtbl =
|
|
|
|
{
|
|
|
|
ITextServicesImpl_QueryInterface,
|
|
|
|
ITextServicesImpl_AddRef,
|
|
|
|
ITextServicesImpl_Release
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
|
|
|
|
{
|
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
|
|
|
|
{
|
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
|
|
|
return IUnknown_Release(This->outer_unk);
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
|
2011-04-10 21:44:44 +02:00
|
|
|
LPARAM lparam, LRESULT *plresult)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2009-01-20 07:41:40 +01:00
|
|
|
HRESULT hresult;
|
2009-02-26 09:43:14 +01:00
|
|
|
LRESULT lresult;
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2009-02-26 09:43:14 +01:00
|
|
|
lresult = ME_HandleMessage(This->editor, msg, wparam, lparam, TRUE, &hresult);
|
|
|
|
if (plresult) *plresult = lresult;
|
2009-01-20 07:41:40 +01:00
|
|
|
return hresult;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
|
2011-04-10 21:44:44 +02:00
|
|
|
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hdcTargetDev,
|
|
|
|
LPCRECTL lprcBounds, LPCRECTL lprcWBounds, LPRECT lprcUpdate,
|
|
|
|
BOOL (CALLBACK * pfnContinue)(DWORD), DWORD dwContinue,
|
2006-02-01 12:31:40 +01:00
|
|
|
LONG lViewId)
|
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
|
2011-04-10 21:44:44 +02:00
|
|
|
LONG *plPage, BOOL *pfEnabled)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2009-01-21 16:13:56 +01:00
|
|
|
*plMin = This->editor->horz_si.nMin;
|
|
|
|
*plMax = This->editor->horz_si.nMax;
|
|
|
|
*plPos = This->editor->horz_si.nPos;
|
|
|
|
*plPage = This->editor->horz_si.nPage;
|
|
|
|
*pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
|
|
|
|
return S_OK;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
|
2011-04-10 21:44:44 +02:00
|
|
|
LONG *plPage, BOOL *pfEnabled)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2009-01-21 16:13:56 +01:00
|
|
|
*plMin = This->editor->vert_si.nMin;
|
|
|
|
*plMax = This->editor->vert_si.nMax;
|
|
|
|
*plPos = This->editor->vert_si.nPos;
|
|
|
|
*plPage = This->editor->vert_si.nPage;
|
|
|
|
*pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
|
|
|
|
return S_OK;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
|
2011-04-10 21:44:44 +02:00
|
|
|
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
|
|
|
|
HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
|
2011-04-10 21:44:44 +02:00
|
|
|
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
|
|
|
|
HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y,
|
|
|
|
DWORD *pHitResult)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface, LPCRECT prcClient)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, BSTR *pbstrText)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2009-01-20 07:41:44 +01:00
|
|
|
int length;
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2009-01-20 07:41:44 +01:00
|
|
|
length = ME_GetTextLength(This->editor);
|
|
|
|
if (length)
|
|
|
|
{
|
2009-08-12 15:05:51 +02:00
|
|
|
ME_Cursor start;
|
2009-01-20 07:41:44 +01:00
|
|
|
BSTR bstr;
|
|
|
|
bstr = SysAllocStringByteLen(NULL, length * sizeof(WCHAR));
|
|
|
|
if (bstr == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2009-08-12 15:05:51 +02:00
|
|
|
ME_CursorFromCharOfs(This->editor, 0, &start);
|
2014-07-21 18:41:29 +02:00
|
|
|
ME_GetTextW(This->editor, bstr, length, &start, INT_MAX, FALSE, FALSE);
|
2009-01-20 07:41:44 +01:00
|
|
|
*pbstrText = bstr;
|
|
|
|
} else {
|
|
|
|
*pbstrText = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, LPCWSTR pszText)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2009-08-13 14:44:18 +02:00
|
|
|
ME_Cursor cursor;
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2009-08-13 14:44:18 +02:00
|
|
|
ME_SetCursorToStart(This->editor, &cursor);
|
|
|
|
ME_InternalDeleteText(This->editor, &cursor,
|
|
|
|
ME_GetTextLength(This->editor), FALSE);
|
2009-01-20 07:41:44 +01:00
|
|
|
ME_InsertTextFromCursor(This->editor, 0, pszText, -1,
|
|
|
|
This->editor->pBuffer->pDefaultStyle);
|
|
|
|
ME_SetSelection(This->editor, 0, 0);
|
|
|
|
This->editor->nModifyStep = 0;
|
|
|
|
OleFlushClipboard();
|
|
|
|
ME_EmptyUndoStack(This->editor);
|
2010-07-29 03:17:40 +02:00
|
|
|
ME_UpdateRepaint(This->editor, FALSE);
|
2009-01-20 07:41:44 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2006-02-01 12:31:40 +01:00
|
|
|
}
|
|
|
|
|
2014-03-12 14:43:35 +01:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw,
|
2011-04-10 21:44:44 +02:00
|
|
|
HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode,
|
|
|
|
const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD dwMask, DWORD dwBits)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-13 18:04:03 +02:00
|
|
|
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
2011-04-10 21:44:44 +02:00
|
|
|
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
2006-02-01 12:31:40 +01:00
|
|
|
|
|
|
|
FIXME("%p: STUB\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-06-14 15:34:20 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage,20)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw,52)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll,24)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll,24)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor,40)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint,44)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceActivate,8)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceDeactivate,4)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate,4)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8)
|
2014-03-12 14:43:35 +01:00
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8)
|
2009-06-14 15:34:20 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange,12)
|
|
|
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize,12)
|
2006-02-01 12:31:40 +01:00
|
|
|
|
2012-03-28 00:31:45 +02:00
|
|
|
static const ITextServicesVtbl textservices_vtbl =
|
2006-02-01 12:31:40 +01:00
|
|
|
{
|
|
|
|
fnTextSrv_QueryInterface,
|
|
|
|
fnTextSrv_AddRef,
|
|
|
|
fnTextSrv_Release,
|
|
|
|
THISCALL(fnTextSrv_TxSendMessage),
|
|
|
|
THISCALL(fnTextSrv_TxDraw),
|
|
|
|
THISCALL(fnTextSrv_TxGetHScroll),
|
|
|
|
THISCALL(fnTextSrv_TxGetVScroll),
|
|
|
|
THISCALL(fnTextSrv_OnTxSetCursor),
|
|
|
|
THISCALL(fnTextSrv_TxQueryHitPoint),
|
|
|
|
THISCALL(fnTextSrv_OnTxInplaceActivate),
|
|
|
|
THISCALL(fnTextSrv_OnTxInplaceDeactivate),
|
|
|
|
THISCALL(fnTextSrv_OnTxUIActivate),
|
|
|
|
THISCALL(fnTextSrv_OnTxUIDeactivate),
|
|
|
|
THISCALL(fnTextSrv_TxGetText),
|
|
|
|
THISCALL(fnTextSrv_TxSetText),
|
2014-03-12 14:43:35 +01:00
|
|
|
THISCALL(fnTextSrv_TxGetCurTargetX),
|
2006-02-01 12:31:40 +01:00
|
|
|
THISCALL(fnTextSrv_TxGetBaseLinePos),
|
|
|
|
THISCALL(fnTextSrv_TxGetNaturalSize),
|
|
|
|
THISCALL(fnTextSrv_TxGetDropTarget),
|
|
|
|
THISCALL(fnTextSrv_OnTxPropertyBitsChange),
|
|
|
|
THISCALL(fnTextSrv_TxGetCachedSize)
|
|
|
|
};
|
2012-03-28 00:31:45 +02:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* CreateTextServices (RICHED20.4)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, IUnknown **ppUnk)
|
|
|
|
{
|
|
|
|
ITextServicesImpl *ITextImpl;
|
2015-05-30 09:01:45 +02:00
|
|
|
|
2012-03-28 00:31:45 +02:00
|
|
|
TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
|
|
|
|
if (pITextHost == NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
|
|
|
|
if (ITextImpl == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
InitializeCriticalSection(&ITextImpl->csTxtSrv);
|
|
|
|
ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
|
|
|
|
ITextImpl->ref = 1;
|
|
|
|
ITextHost_AddRef(pITextHost);
|
|
|
|
ITextImpl->pMyHost = pITextHost;
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
|
2012-03-28 00:31:45 +02:00
|
|
|
ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl;
|
2015-11-06 10:35:35 +01:00
|
|
|
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE, ES_LEFT);
|
2012-03-28 00:31:45 +02:00
|
|
|
ITextImpl->editor->exStyleFlags = 0;
|
2016-03-08 11:48:07 +01:00
|
|
|
SetRectEmpty(&ITextImpl->editor->rcFormat);
|
2012-03-28 00:31:45 +02:00
|
|
|
|
|
|
|
if (pUnkOuter)
|
2012-03-28 00:33:10 +02:00
|
|
|
ITextImpl->outer_unk = pUnkOuter;
|
|
|
|
else
|
|
|
|
ITextImpl->outer_unk = &ITextImpl->IUnknown_inner;
|
2012-03-28 00:31:45 +02:00
|
|
|
|
2012-03-28 00:33:10 +02:00
|
|
|
*ppUnk = &ITextImpl->IUnknown_inner;
|
2012-03-28 00:31:45 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|