Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
6.6 KiB

  1. //
  2. // emptyic.cpp
  3. //
  4. #include "private.h"
  5. #include "emptyic.h"
  6. #include "globals.h"
  7. #include "compart.h"
  8. #include "dim.h"
  9. DBG_ID_INSTANCE(CEmptyInputContext);
  10. //+---------------------------------------------------------------------------
  11. //
  12. // ctor
  13. //
  14. //----------------------------------------------------------------------------
  15. CEmptyInputContext::CEmptyInputContext(CDocumentInputManager *dim)
  16. : CCompartmentMgr(TF_INVALID_GUIDATOM, COMPTYPE_IC)
  17. {
  18. Dbg_MemSetThisNameIDCounter(TEXT("CEmptyInputContext"), PERF_CONTEXT_COUNTER);
  19. _dim = dim;
  20. }
  21. //+---------------------------------------------------------------------------
  22. //
  23. // dtor
  24. //
  25. //----------------------------------------------------------------------------
  26. CEmptyInputContext::~CEmptyInputContext()
  27. {
  28. }
  29. //+---------------------------------------------------------------------------
  30. //
  31. // Init
  32. //
  33. //----------------------------------------------------------------------------
  34. HRESULT CEmptyInputContext::Init()
  35. {
  36. HRESULT hr = MySetCompartmentDWORD(TF_INVALID_GUIDATOM, this, GUID_COMPARTMENT_EMPTYCONTEXT, 1);
  37. return hr;
  38. }
  39. //+---------------------------------------------------------------------------
  40. //
  41. // GetDocumentMgr
  42. //
  43. //----------------------------------------------------------------------------
  44. STDAPI CEmptyInputContext::RequestEditSession(TfClientId tid, ITfEditSession *pes, DWORD dwFlags, HRESULT *phrSession)
  45. {
  46. if (phrSession)
  47. *phrSession = TF_E_EMPTYCONTEXT;
  48. return TF_E_EMPTYCONTEXT;
  49. }
  50. //+---------------------------------------------------------------------------
  51. //
  52. // GetDocumentMgr
  53. //
  54. //----------------------------------------------------------------------------
  55. STDAPI CEmptyInputContext::InWriteSession(TfClientId tid, BOOL *pfWriteSession)
  56. {
  57. if (pfWriteSession)
  58. *pfWriteSession = FALSE;
  59. return TF_E_EMPTYCONTEXT;
  60. }
  61. //+---------------------------------------------------------------------------
  62. //
  63. // GetDocumentMgr
  64. //
  65. //----------------------------------------------------------------------------
  66. STDAPI CEmptyInputContext::GetSelection(TfEditCookie ec, ULONG ulIndex, ULONG ulCount, TF_SELECTION *pSelection, ULONG *pcFetched)
  67. {
  68. if (pSelection)
  69. memset(pSelection, 0, sizeof(TF_SELECTION));
  70. if (pcFetched)
  71. *pcFetched = 0;
  72. return TF_E_EMPTYCONTEXT;
  73. }
  74. //+---------------------------------------------------------------------------
  75. //
  76. // GetDocumentMgr
  77. //
  78. //----------------------------------------------------------------------------
  79. STDAPI CEmptyInputContext::SetSelection(TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
  80. {
  81. return TF_E_EMPTYCONTEXT;
  82. }
  83. //+---------------------------------------------------------------------------
  84. //
  85. // GetDocumentMgr
  86. //
  87. //----------------------------------------------------------------------------
  88. STDAPI CEmptyInputContext::GetStart(TfEditCookie ec, ITfRange **ppStart)
  89. {
  90. if (ppStart)
  91. *ppStart = NULL;
  92. return TF_E_EMPTYCONTEXT;
  93. }
  94. //+---------------------------------------------------------------------------
  95. //
  96. // GetDocumentMgr
  97. //
  98. //----------------------------------------------------------------------------
  99. STDAPI CEmptyInputContext::GetEnd(TfEditCookie ec, ITfRange **ppEnd)
  100. {
  101. if (ppEnd)
  102. *ppEnd = NULL;
  103. return TF_E_EMPTYCONTEXT;
  104. }
  105. //+---------------------------------------------------------------------------
  106. //
  107. // GetDocumentMgr
  108. //
  109. //----------------------------------------------------------------------------
  110. STDAPI CEmptyInputContext::GetStatus(TS_STATUS *pdcs)
  111. {
  112. if (pdcs)
  113. memset(pdcs, 0, sizeof(TS_STATUS));
  114. return TF_E_EMPTYCONTEXT;
  115. }
  116. //+---------------------------------------------------------------------------
  117. //
  118. // GetDocumentMgr
  119. //
  120. //----------------------------------------------------------------------------
  121. STDAPI CEmptyInputContext::GetActiveView(ITfContextView **ppView)
  122. {
  123. if (ppView)
  124. *ppView = NULL;
  125. return TF_E_EMPTYCONTEXT;
  126. }
  127. //+---------------------------------------------------------------------------
  128. //
  129. // GetDocumentMgr
  130. //
  131. //----------------------------------------------------------------------------
  132. STDAPI CEmptyInputContext::EnumViews(IEnumTfContextViews **ppEnum)
  133. {
  134. if (ppEnum)
  135. *ppEnum = NULL;
  136. return TF_E_EMPTYCONTEXT;
  137. }
  138. //+---------------------------------------------------------------------------
  139. //
  140. // GetDocumentMgr
  141. //
  142. //----------------------------------------------------------------------------
  143. STDAPI CEmptyInputContext::GetProperty(REFGUID guidProp, ITfProperty **ppv)
  144. {
  145. if (ppv)
  146. *ppv = NULL;
  147. return TF_E_EMPTYCONTEXT;
  148. }
  149. //+---------------------------------------------------------------------------
  150. //
  151. // GetDocumentMgr
  152. //
  153. //----------------------------------------------------------------------------
  154. STDAPI CEmptyInputContext::GetAppProperty(REFGUID guidProp, ITfReadOnlyProperty **ppProp)
  155. {
  156. if (ppProp)
  157. *ppProp = NULL;
  158. return TF_E_EMPTYCONTEXT;
  159. }
  160. //+---------------------------------------------------------------------------
  161. //
  162. // GetDocumentMgr
  163. //
  164. //----------------------------------------------------------------------------
  165. STDAPI CEmptyInputContext::TrackProperties(const GUID **pguidProp, ULONG cProp, const GUID **pguidAppProp, ULONG cAppProp, ITfReadOnlyProperty **ppPropX)
  166. {
  167. if (ppPropX)
  168. *ppPropX = NULL;
  169. return TF_E_EMPTYCONTEXT;
  170. }
  171. //+---------------------------------------------------------------------------
  172. //
  173. // GetDocumentMgr
  174. //
  175. //----------------------------------------------------------------------------
  176. STDAPI CEmptyInputContext::EnumProperties(IEnumTfProperties **ppEnum)
  177. {
  178. if (ppEnum)
  179. *ppEnum = NULL;
  180. return TF_E_EMPTYCONTEXT;
  181. }
  182. //+---------------------------------------------------------------------------
  183. //
  184. // GetDocumentMgr
  185. //
  186. //----------------------------------------------------------------------------
  187. STDAPI CEmptyInputContext::GetDocumentMgr(ITfDocumentMgr **ppDm)
  188. {
  189. if (ppDm == NULL)
  190. return E_INVALIDARG;
  191. *ppDm = _dim;
  192. if (*ppDm)
  193. (*ppDm)->AddRef();
  194. return S_OK;
  195. }
  196. //+---------------------------------------------------------------------------
  197. //
  198. // GetDocumentMgr
  199. //
  200. //----------------------------------------------------------------------------
  201. STDAPI CEmptyInputContext::CreateRangeBackup(TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup)
  202. {
  203. if (ppBackup)
  204. *ppBackup = NULL;
  205. return TF_E_EMPTYCONTEXT;
  206. }