wined3d: Explicitly pass data and gl_info to shader_deselect_depth_blt().
[wine.git] / dlls / msctf / range.c
blobdc9eae15c60a8f0fab75cb3d92d169cff062daef
1 /*
2 * ITfRange implementation
4 * Copyright 2009 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "wine/debug.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "shlwapi.h"
33 #include "winerror.h"
34 #include "objbase.h"
36 #include "wine/unicode.h"
38 #include "msctf.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
43 typedef struct tagRange {
44 const ITfRangeVtbl *RangeVtbl;
45 /* const ITfRangeACPVtb *RangeACPVtbl; */
46 LONG refCount;
48 ITextStoreACP *pITextStoreACP;
49 ITfContext *pITfContext;
51 DWORD lockType;
52 TfGravity gravityStart, gravityEnd;
53 DWORD anchorStart, anchorEnd;
55 } Range;
57 static void Range_Destructor(Range *This)
59 TRACE("destroying %p\n", This);
60 HeapFree(GetProcessHeap(),0,This);
63 static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID *ppvOut)
65 Range *This = (Range*)iface;
66 *ppvOut = NULL;
68 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange))
70 *ppvOut = This;
73 if (*ppvOut)
75 IUnknown_AddRef(iface);
76 return S_OK;
79 WARN("unsupported interface: %s\n", debugstr_guid(iid));
80 return E_NOINTERFACE;
83 static ULONG WINAPI Range_AddRef(ITfRange *iface)
85 Range *This = (Range *)iface;
86 return InterlockedIncrement(&This->refCount);
89 static ULONG WINAPI Range_Release(ITfRange *iface)
91 Range *This = (Range *)iface;
92 ULONG ret;
94 ret = InterlockedDecrement(&This->refCount);
95 if (ret == 0)
96 Range_Destructor(This);
97 return ret;
100 /*****************************************************
101 * ITfRange functions
102 *****************************************************/
104 static HRESULT WINAPI Range_GetText(ITfRange *iface, TfEditCookie ec,
105 DWORD dwFlags, WCHAR *pchText, ULONG cchMax, ULONG *pcch)
107 Range *This = (Range *)iface;
108 FIXME("STUB:(%p)\n",This);
109 return E_NOTIMPL;
112 static HRESULT WINAPI Range_SetText(ITfRange *iface, TfEditCookie ec,
113 DWORD dwFlags, const WCHAR *pchText, LONG cch)
115 Range *This = (Range *)iface;
116 FIXME("STUB:(%p)\n",This);
117 return E_NOTIMPL;
120 static HRESULT WINAPI Range_GetFormattedText(ITfRange *iface, TfEditCookie ec,
121 IDataObject **ppDataObject)
123 Range *This = (Range *)iface;
124 FIXME("STUB:(%p)\n",This);
125 return E_NOTIMPL;
128 static HRESULT WINAPI Range_GetEmbedded(ITfRange *iface, TfEditCookie ec,
129 REFGUID rguidService, REFIID riid, IUnknown **ppunk)
131 Range *This = (Range *)iface;
132 FIXME("STUB:(%p)\n",This);
133 return E_NOTIMPL;
136 static HRESULT WINAPI Range_InsertEmbedded(ITfRange *iface, TfEditCookie ec,
137 DWORD dwFlags, IDataObject *pDataObject)
139 Range *This = (Range *)iface;
140 FIXME("STUB:(%p)\n",This);
141 return E_NOTIMPL;
144 static HRESULT WINAPI Range_ShiftStart(ITfRange *iface, TfEditCookie ec,
145 LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt)
147 Range *This = (Range *)iface;
148 FIXME("STUB:(%p)\n",This);
149 return E_NOTIMPL;
152 static HRESULT WINAPI Range_ShiftEnd(ITfRange *iface, TfEditCookie ec,
153 LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt)
155 Range *This = (Range *)iface;
156 FIXME("STUB:(%p)\n",This);
157 return E_NOTIMPL;
160 static HRESULT WINAPI Range_ShiftStartToRange(ITfRange *iface, TfEditCookie ec,
161 ITfRange *pRange, TfAnchor aPos)
163 Range *This = (Range *)iface;
164 FIXME("STUB:(%p)\n",This);
165 return E_NOTIMPL;
168 static HRESULT WINAPI Range_ShiftEndToRange(ITfRange *iface, TfEditCookie ec,
169 ITfRange *pRange, TfAnchor aPos)
171 Range *This = (Range *)iface;
172 FIXME("STUB:(%p)\n",This);
173 return E_NOTIMPL;
176 static HRESULT WINAPI Range_ShiftStartRegion(ITfRange *iface, TfEditCookie ec,
177 TfShiftDir dir, BOOL *pfNoRegion)
179 Range *This = (Range *)iface;
180 FIXME("STUB:(%p)\n",This);
181 return E_NOTIMPL;
184 static HRESULT WINAPI Range_ShiftEndRegion(ITfRange *iface, TfEditCookie ec,
185 TfShiftDir dir, BOOL *pfNoRegion)
187 Range *This = (Range *)iface;
188 FIXME("STUB:(%p)\n",This);
189 return E_NOTIMPL;
192 static HRESULT WINAPI Range_IsEmpty(ITfRange *iface, TfEditCookie ec,
193 BOOL *pfEmpty)
195 Range *This = (Range *)iface;
196 FIXME("STUB:(%p)\n",This);
197 return E_NOTIMPL;
200 static HRESULT WINAPI Range_Collapse(ITfRange *iface, TfEditCookie ec,
201 TfAnchor aPos)
203 Range *This = (Range *)iface;
204 TRACE("(%p) %i %i\n",This,ec,aPos);
206 switch (aPos)
208 case TF_ANCHOR_START:
209 This->anchorEnd = This->anchorStart;
210 break;
211 case TF_ANCHOR_END:
212 This->anchorStart = This->anchorEnd;
213 break;
214 default:
215 return E_INVALIDARG;
218 return S_OK;
221 static HRESULT WINAPI Range_IsEqualStart(ITfRange *iface, TfEditCookie ec,
222 ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual)
224 Range *This = (Range *)iface;
225 FIXME("STUB:(%p)\n",This);
226 return E_NOTIMPL;
229 static HRESULT WINAPI Range_IsEqualEnd(ITfRange *iface, TfEditCookie ec,
230 ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual)
232 Range *This = (Range *)iface;
233 FIXME("STUB:(%p)\n",This);
234 return E_NOTIMPL;
237 static HRESULT WINAPI Range_CompareStart(ITfRange *iface, TfEditCookie ec,
238 ITfRange *pWith, TfAnchor aPos, LONG *plResult)
240 Range *This = (Range *)iface;
241 FIXME("STUB:(%p)\n",This);
242 return E_NOTIMPL;
245 static HRESULT WINAPI Range_CompareEnd(ITfRange *iface, TfEditCookie ec,
246 ITfRange *pWith, TfAnchor aPos, LONG *plResult)
248 Range *This = (Range *)iface;
249 FIXME("STUB:(%p)\n",This);
250 return E_NOTIMPL;
253 static HRESULT WINAPI Range_AdjustForInsert(ITfRange *iface, TfEditCookie ec,
254 ULONG cchInsert, BOOL *pfInsertOk)
256 Range *This = (Range *)iface;
257 FIXME("STUB:(%p)\n",This);
258 return E_NOTIMPL;
261 static HRESULT WINAPI Range_GetGravity(ITfRange *iface,
262 TfGravity *pgStart, TfGravity *pgEnd)
264 Range *This = (Range *)iface;
265 FIXME("STUB:(%p)\n",This);
266 return E_NOTIMPL;
269 static HRESULT WINAPI Range_SetGravity(ITfRange *iface, TfEditCookie ec,
270 TfGravity gStart, TfGravity gEnd)
272 Range *This = (Range *)iface;
273 FIXME("STUB:(%p)\n",This);
274 return E_NOTIMPL;
277 static HRESULT WINAPI Range_Clone(ITfRange *iface, ITfRange **ppClone)
279 Range *This = (Range *)iface;
280 FIXME("STUB:(%p)\n",This);
281 return E_NOTIMPL;
284 static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **ppContext)
286 Range *This = (Range *)iface;
287 TRACE("(%p)\n",This);
288 if (!ppContext)
289 return E_INVALIDARG;
290 *ppContext = This->pITfContext;
291 return S_OK;
294 static const ITfRangeVtbl Range_RangeVtbl =
296 Range_QueryInterface,
297 Range_AddRef,
298 Range_Release,
300 Range_GetText,
301 Range_SetText,
302 Range_GetFormattedText,
303 Range_GetEmbedded,
304 Range_InsertEmbedded,
305 Range_ShiftStart,
306 Range_ShiftEnd,
307 Range_ShiftStartToRange,
308 Range_ShiftEndToRange,
309 Range_ShiftStartRegion,
310 Range_ShiftEndRegion,
311 Range_IsEmpty,
312 Range_Collapse,
313 Range_IsEqualStart,
314 Range_IsEqualEnd,
315 Range_CompareStart,
316 Range_CompareEnd,
317 Range_AdjustForInsert,
318 Range_GetGravity,
319 Range_SetGravity,
320 Range_Clone,
321 Range_GetContext
324 HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut)
326 Range *This;
328 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Range));
329 if (This == NULL)
330 return E_OUTOFMEMORY;
332 TRACE("(%p) %p %p\n",This, context, textstore);
334 This->RangeVtbl= &Range_RangeVtbl;
335 This->refCount = 1;
336 This->pITfContext = context;
337 This->pITextStoreACP = textstore;
338 This->lockType = lockType;
339 This->anchorStart = anchorStart;
340 This->anchorEnd = anchorEnd;
342 *ppOut = (ITfRange*)This;
343 TRACE("returning %p\n", This);
345 return S_OK;
348 /* Internal conversion functions */
350 HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_ACP *tsAcp)
352 Range *This;
354 if (!tf || !tsAcp || !tf->range)
355 return E_INVALIDARG;
357 This = (Range *)tf->range;
359 tsAcp->acpStart = This->anchorStart;
360 tsAcp->acpEnd = This->anchorEnd;
361 tsAcp->style.ase = tf->style.ase;
362 tsAcp->style.fInterimChar = tf->style.fInterimChar;
363 return S_OK;