Commit d0ef9886 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

msctf: Add stub implementation of ITfRange.

parent fe30b79d
......@@ -11,6 +11,7 @@ C_SRCS = \
documentmgr.c \
inputprocessor.c \
msctf.c \
range.c \
regsvr.c \
threadmgr.c
......
......@@ -34,6 +34,7 @@ extern HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink*, ITfDocumentMgr **
extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore);
extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut);
extern HRESULT Context_Initialize(ITfContext *cxt);
extern HRESULT Context_Uninitialize(ITfContext *cxt);
......
/*
* ITfRange implementation
*
* Copyright 2009 Aric Stewart, CodeWeavers
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "shlwapi.h"
#include "winerror.h"
#include "objbase.h"
#include "wine/unicode.h"
#include "msctf.h"
#include "msctf_internal.h"
WINE_DEFAULT_DEBUG_CHANNEL(msctf);
typedef struct tagRange {
const ITfRangeVtbl *RangeVtbl;
/* const ITfRangeACPVtb *RangeACPVtbl; */
LONG refCount;
ITextStoreACP *pITextStoreACP;
ITfContext *pITfContext;
DWORD lockType;
TfGravity gravityStart, gravityEnd;
DWORD anchorStart, anchorEnd;
} Range;
static void Range_Destructor(Range *This)
{
TRACE("destroying %p\n", This);
HeapFree(GetProcessHeap(),0,This);
}
static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID *ppvOut)
{
Range *This = (Range*)iface;
*ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange))
{
*ppvOut = This;
}
if (*ppvOut)
{
IUnknown_AddRef(iface);
return S_OK;
}
WARN("unsupported interface: %s\n", debugstr_guid(iid));
return E_NOINTERFACE;
}
static ULONG WINAPI Range_AddRef(ITfRange *iface)
{
Range *This = (Range *)iface;
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI Range_Release(ITfRange *iface)
{
Range *This = (Range *)iface;
ULONG ret;
ret = InterlockedDecrement(&This->refCount);
if (ret == 0)
Range_Destructor(This);
return ret;
}
/*****************************************************
* ITfRange functions
*****************************************************/
static HRESULT WINAPI Range_GetText(ITfRange *iface, TfEditCookie ec,
DWORD dwFlags, WCHAR *pchText, ULONG cchMax, ULONG *pcch)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_SetText(ITfRange *iface, TfEditCookie ec,
DWORD dwFlags, const WCHAR *pchText, LONG cch)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_GetFormattedText(ITfRange *iface, TfEditCookie ec,
IDataObject **ppDataObject)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_GetEmbedded(ITfRange *iface, TfEditCookie ec,
REFGUID rguidService, REFIID riid, IUnknown **ppunk)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_InsertEmbedded(ITfRange *iface, TfEditCookie ec,
DWORD dwFlags, IDataObject *pDataObject)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftStart(ITfRange *iface, TfEditCookie ec,
LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftEnd(ITfRange *iface, TfEditCookie ec,
LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftStartToRange(ITfRange *iface, TfEditCookie ec,
ITfRange *pRange, TfAnchor aPos)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftEndToRange(ITfRange *iface, TfEditCookie ec,
ITfRange *pRange, TfAnchor aPos)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftStartRegion(ITfRange *iface, TfEditCookie ec,
TfShiftDir dir, BOOL *pfNoRegion)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_ShiftEndRegion(ITfRange *iface, TfEditCookie ec,
TfShiftDir dir, BOOL *pfNoRegion)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_IsEmpty(ITfRange *iface, TfEditCookie ec,
BOOL *pfEmpty)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_Collapse(ITfRange *iface, TfEditCookie ec,
TfAnchor aPos)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_IsEqualStart(ITfRange *iface, TfEditCookie ec,
ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_IsEqualEnd(ITfRange *iface, TfEditCookie ec,
ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_CompareStart(ITfRange *iface, TfEditCookie ec,
ITfRange *pWith, TfAnchor aPos, LONG *plResult)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_CompareEnd(ITfRange *iface, TfEditCookie ec,
ITfRange *pWith, TfAnchor aPos, LONG *plResult)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_AdjustForInsert(ITfRange *iface, TfEditCookie ec,
ULONG cchInsert, BOOL *pfInsertOk)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_GetGravity(ITfRange *iface,
TfGravity *pgStart, TfGravity *pgEnd)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_SetGravity(ITfRange *iface, TfEditCookie ec,
TfGravity gStart, TfGravity gEnd)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_Clone(ITfRange *iface, ITfRange **ppClone)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **ppContext)
{
Range *This = (Range *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static const ITfRangeVtbl Range_RangeVtbl =
{
Range_QueryInterface,
Range_AddRef,
Range_Release,
Range_GetText,
Range_SetText,
Range_GetFormattedText,
Range_GetEmbedded,
Range_InsertEmbedded,
Range_ShiftStart,
Range_ShiftEnd,
Range_ShiftStartToRange,
Range_ShiftEndToRange,
Range_ShiftStartRegion,
Range_ShiftEndRegion,
Range_IsEmpty,
Range_Collapse,
Range_IsEqualStart,
Range_IsEqualEnd,
Range_CompareStart,
Range_CompareEnd,
Range_AdjustForInsert,
Range_GetGravity,
Range_SetGravity,
Range_Clone,
Range_GetContext
};
HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut)
{
Range *This;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Range));
if (This == NULL)
return E_OUTOFMEMORY;
TRACE("(%p) %p %p\n",This, context, textstore);
This->RangeVtbl= &Range_RangeVtbl;
This->refCount = 1;
This->pITfContext = context;
This->pITextStoreACP = textstore;
This->lockType = lockType;
This->anchorStart = anchorStart;
This->anchorEnd = anchorEnd;
*ppOut = (ITfRange*)This;
TRACE("returning %p\n", This);
return S_OK;
}
......@@ -87,6 +87,8 @@ typedef [uuid(77c12f95-b783-450d-879f-1cd2362c6521)] struct TF_PRESERVEDKEY
UINT uModifiers;
} TF_PRESERVEDKEY;
typedef [uuid(5a886226-ae9a-489b-b991-2b1e25ee59a9)] enum { TF_ANCHOR_START = 0, TF_ANCHOR_END = 1 } TfAnchor;
[
object,
uuid(aa80e801-2021-11d2-93e0-0060b067b86e),
......@@ -724,3 +726,142 @@ interface ITfEditSession : IUnknown
HRESULT DoEditSession(
[in] TfEditCookie ec);
}
[
object,
uuid(aa80e7ff-2021-11d2-93e0-0060b067b86e),
pointer_default(unique)
]
interface ITfRange : IUnknown
{
const WCHAR TF_CHAR_EMBEDDED = TS_CHAR_EMBEDDED;
typedef [uuid(cf610f06-2882-46f6-abe5-298568b664c4)] enum { TF_GRAVITY_BACKWARD = 0, TF_GRAVITY_FORWARD = 1 } TfGravity;
typedef [uuid(1e512533-bbdc-4530-9a8e-a1dc0af67468)] enum { TF_SD_BACKWARD = 0, TF_SD_FORWARD = 1 } TfShiftDir;
const DWORD TF_HF_OBJECT = 1;
const DWORD TF_TF_MOVESTART = 1;
const DWORD TF_TF_IGNOREEND = 2;
const DWORD TF_ST_CORRECTION = 1;
const DWORD TF_IE_CORRECTION = 1;
typedef [uuid(49930d51-7d93-448c-a48c-fea5dac192b1)] struct TF_HALTCOND
{
ITfRange *pHaltRange;
TfAnchor aHaltPos;
DWORD dwFlags;
} TF_HALTCOND;
HRESULT GetText(
[in] TfEditCookie ec,
[in] DWORD dwFlags,
[out, size_is(cchMax), length_is(*pcch)] WCHAR *pchText,
[in] ULONG cchMax,
[out] ULONG *pcch);
HRESULT SetText(
[in] TfEditCookie ec,
[in] DWORD dwFlags,
[in, size_is(cch), unique] const WCHAR *pchText,
[in] LONG cch);
HRESULT GetFormattedText(
[in] TfEditCookie ec,
[out] IDataObject **ppDataObject);
HRESULT GetEmbedded(
[in] TfEditCookie ec,
[in] REFGUID rguidService,
[in] REFIID riid,
[out, iid_is(riid)] IUnknown **ppunk);
HRESULT InsertEmbedded(
[in] TfEditCookie ec,
[in] DWORD dwFlags,
[in] IDataObject *pDataObject);
HRESULT ShiftStart(
[in] TfEditCookie ec,
[in] LONG cchReq,
[out] LONG *pcch,
[in, unique] const TF_HALTCOND *pHalt);
HRESULT ShiftEnd(
[in] TfEditCookie ec,
[in] LONG cchReq,
[out] LONG *pcch,
[in, unique] const TF_HALTCOND *pHalt);
HRESULT ShiftStartToRange(
[in] TfEditCookie ec,
[in] ITfRange *pRange,
[in] TfAnchor aPos);
HRESULT ShiftEndToRange(
[in] TfEditCookie ec,
[in] ITfRange *pRange,
[in] TfAnchor aPos);
HRESULT ShiftStartRegion(
[in] TfEditCookie ec,
[in] TfShiftDir dir,
[out] BOOL *pfNoRegion);
HRESULT ShiftEndRegion(
[in] TfEditCookie ec,
[in] TfShiftDir dir,
[out] BOOL *pfNoRegion);
HRESULT IsEmpty(
[in] TfEditCookie ec,
[out] BOOL *pfEmpty);
HRESULT Collapse(
[in] TfEditCookie ec,
[in] TfAnchor aPos);
HRESULT IsEqualStart(
[in] TfEditCookie ec,
[in] ITfRange *pWith,
[in] TfAnchor aPos,
[out] BOOL *pfEqual);
HRESULT IsEqualEnd(
[in] TfEditCookie ec,
[in] ITfRange *pWith,
[in] TfAnchor aPos,
[out] BOOL *pfEqual);
HRESULT CompareStart(
[in] TfEditCookie ec,
[in] ITfRange *pWith,
[in] TfAnchor aPos,
[out] LONG *plResult);
HRESULT CompareEnd(
[in] TfEditCookie ec,
[in] ITfRange *pWith,
[in] TfAnchor aPos,
[out] LONG *plResult);
HRESULT AdjustForInsert(
[in] TfEditCookie ec,
[in] ULONG cchInsert,
[out] BOOL *pfInsertOk);
HRESULT GetGravity(
[out] TfGravity *pgStart,
[out] TfGravity *pgEnd);
HRESULT SetGravity(
[in] TfEditCookie ec,
[in] TfGravity gStart,
[in] TfGravity gEnd);
HRESULT Clone(
[out] ITfRange **ppClone);
HRESULT GetContext(
[out] ITfContext **ppContext);
};
......@@ -44,6 +44,10 @@ const DWORD TS_LF_SYNC = 0x1;
const DWORD TS_LF_READ = 0x2;
const DWORD TS_LF_READWRITE = 0x6;
const WCHAR TS_CHAR_EMBEDDED = 0xfffc;
const WCHAR TS_CHAR_REGION = 0x0000;
const WCHAR TS_CHAR_REPLACEMENT = 0xfffd;
typedef [uuid(05fcf85b-5e9c-4c3e-ab71-29471d4f38e7)] enum { TS_AE_NONE, TS_AE_START, TS_AE_END } TsActiveSelEnd;
typedef [uuid(033b0df0-f193-4170-b47b-141afc247878)] enum { TS_RT_PLAIN, TS_RT_HIDDEN, TS_RT_OPAQUE } TsRunType;
typedef [uuid(ef3457d9-8446-49a7-a9e6-b50d9d5f3fd9)] GUID TS_ATTRID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment