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.

67 lines
2.0 KiB

  1. #ifndef _LEARNDOC_H
  2. #define _LEARNDOC_H
  3. #include "sapilayr.h"
  4. class CSapiIMX;
  5. class CSpTask;
  6. #define SIZE_DOCUMENT_BLOCK 256
  7. #define SIZE_FIRST_BLOCK 64
  8. // This structure will keep the feed state for specified dim.
  9. typedef struct _DimRef
  10. {
  11. ITfDocumentMgr *pDim;
  12. BOOL _fFeed;
  13. } DIMREF;
  14. class __declspec(novtable) CLearnFromDoc
  15. {
  16. public:
  17. CLearnFromDoc(CSapiIMX *psi);
  18. virtual ~CLearnFromDoc( );
  19. BOOL GetLearnFromDoc( ) { return _fLearnFromDoc; }
  20. void UpdateLearnDocState( );
  21. HRESULT HandleLearnFromDoc(ITfDocumentMgr *pDim = NULL);
  22. ULONG _GetDocBlockSize( );
  23. HRESULT _HandleLearnFromDoc(TfEditCookie ec,ITfContext *pic, ITfDocumentMgr *pDim);
  24. HRESULT _GetNextRangeEditSession( );
  25. HRESULT _HandleNextRange(TfEditCookie ec, ULONG cchSizeRange);
  26. HRESULT _GetNextRangeContent(TfEditCookie ec, ULONG cchSizeRange);
  27. HRESULT _FeedContentRangeToSR( );
  28. HRESULT _UpdateRecoContextInterestSet(BOOL fLearnFromDoc );
  29. BOOL _HasMoreContent( ) { return _fMoreContent; }
  30. HRESULT _AddDimToList(ITfDocumentMgr *pDim, BOOL fFed );
  31. HRESULT _RemoveDimFromList(ITfDocumentMgr *pDim);
  32. HRESULT _SetDimFeedState(ITfDocumentMgr *pDim, BOOL fFed );
  33. HRESULT _IsDimAlreadyFed(ITfDocumentMgr *pDim, BOOL *fFeed);
  34. HRESULT _ClearDimList( );
  35. HRESULT _ResetDimListFeedState( );
  36. private:
  37. CSapiIMX *m_psi;
  38. WCHAR *m_pwszDocBlock;
  39. ULONG _cchBlockSize;
  40. ULONG _cchContent; // size of the real document block content in WCHAR.
  41. CComPtr<ITfRange> _cpStartRange; // This is for Cicero App's Doc Content Range.
  42. BOOL _fMoreContent;
  43. ITfContext *_pic;
  44. CSpTask *_pCSpTask;
  45. // PerfConsider: we may need to change this CPtrArray to CPtrStruct.
  46. CPtrArray<DIMREF> _rgDim;
  47. BOOL _fLearnFromDoc;
  48. };
  49. #endif // _LEARNDOC_H