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.

66 lines
2.4 KiB

  1. /*
  2. * @doc TOM
  3. *
  4. * @module _tomdoc.H -- CTxtDoc Class |
  5. *
  6. * This class implements the TOM ITextDocument interface
  7. *
  8. * @devnote
  9. * This class depends on the internal RichEdit CTxtStory class, but is
  10. * separate, that is, a CTxtDoc has a ptr to the internal CTxtStory,
  11. * rather than CTxtDoc deriving from ITextDocument. This choice
  12. * was made so that edit control instances that don't use the
  13. * ITextDocument interface don't have to have the extra vtable ptr.
  14. *
  15. * When this class is destroyed, it doesn't destroy the internal
  16. * CTxtStory object (CTxtEdit::_pdoc). However the TOM client's
  17. * perception is that the document is no longer in memory, so the internal
  18. * document should be cleared. It's the client's responsibility to save
  19. * the document, if desired, before releasing it.
  20. *
  21. * @future
  22. * Generalize so that CTxtDoc can handle multiple CTxtStory's.
  23. */
  24. #ifndef _tomdoc_H
  25. #define _tomdoc_H
  26. #include "_range.h"
  27. class CTxtDoc : public ITextDocument
  28. {
  29. //@access Public methods
  30. public:
  31. CTxtDoc(CTxtEdit *ped);
  32. // IUnknown methods
  33. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  34. STDMETHOD_(ULONG, AddRef)();
  35. STDMETHOD_(ULONG, Release)();
  36. // IDispatch methods
  37. STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
  38. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo ** pptinfo);
  39. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR ** rgszNames, UINT cNames,
  40. LCID lcid, DISPID * rgdispid) ;
  41. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
  42. DISPPARAMS * pdispparams, VARIANT * pvarResult,
  43. EXCEPINFO * pexcepinfo, UINT * puArgErr) ;
  44. // ITextDocument methods
  45. STDMETHODIMP GetName (BSTR * pName); //@cmember Get document filename
  46. STDMETHODIMP GetCount (long *pCount); //@cmember Get count of stories in document
  47. STDMETHODIMP _NewEnum(IEnumRange **ppenum); //@cmember Get stories enumerator
  48. STDMETHODIMP Item (long Index, ITextRange **pprange);//@cmember Get <p Index>th story
  49. STDMETHODIMP Save (VARIANT * pVar); //@cmember Save this document
  50. STDMETHODIMP BeginEditCollection (); //@cmember Turn on undo grouping
  51. STDMETHODIMP EndEditCollection (); //@cmember Turn off undo grouping
  52. //@access Private data
  53. private:
  54. CTxtEdit * _ped; //@cmember CTxtEdit this belongs to
  55. TCHAR * _pName; //@cmember Filename of document
  56. LONG _cRefs; //@cmember Reference count
  57. };
  58. #endif