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.

230 lines
10 KiB

  1. /*
  2. * d o c . h
  3. *
  4. * Purpose:
  5. *
  6. * History
  7. *
  8. * Copyright (C) Microsoft Corp. 1995, 1996.
  9. */
  10. #ifndef _DOC_H
  11. #define _DOC_H
  12. #include "privunk.h"
  13. #include "mimeedit.h"
  14. class CBody;
  15. interface IOleObject;
  16. interface IOleDocument;
  17. interface IOleDocumentView;
  18. interface IPersistMime;
  19. interface IMimeMessage;
  20. //#define OFFICE_BINDER
  21. enum OLE_SERVER_STATE
  22. {
  23. OS_PASSIVE,
  24. OS_LOADED, // handler but no server
  25. OS_RUNNING, // server running, invisible
  26. OS_INPLACE, // server running, inplace-active, no U.
  27. OS_UIACTIVE, // server running, inplace-active, w/ U.
  28. };
  29. class CDoc:
  30. public IOleObject,
  31. public IOleInPlaceObject,
  32. public IOleInPlaceActiveObject,
  33. public IOleDocument,
  34. public IOleDocumentView,
  35. public IOleCommandTarget,
  36. public IServiceProvider,
  37. public IPersistMime,
  38. public IPersistStreamInit,
  39. public IPersistFile,
  40. public IPersistMoniker,
  41. public IMimeEdit,
  42. public IQuickActivate,
  43. #ifdef OFFICE_BINDER
  44. public IPersistStorage,
  45. #endif
  46. public CPrivateUnknown
  47. {
  48. public:
  49. // ---------------------------------------------------------------------------
  50. // IUnknown members
  51. // ---------------------------------------------------------------------------
  52. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) {
  53. return CPrivateUnknown::QueryInterface(riid, ppvObj); };
  54. virtual STDMETHODIMP_(ULONG) AddRef(void) {
  55. return CPrivateUnknown::AddRef();};
  56. virtual STDMETHODIMP_(ULONG) Release(void) {
  57. return CPrivateUnknown::Release(); };
  58. // *** IOleDocument ***
  59. virtual HRESULT STDMETHODCALLTYPE CreateView(IOleInPlaceSite *pSite, IStream *pstm, DWORD dwReserved, IOleDocumentView **ppView);
  60. virtual HRESULT STDMETHODCALLTYPE GetDocMiscStatus(DWORD *pdwStatus);
  61. virtual HRESULT STDMETHODCALLTYPE EnumViews(IEnumOleDocumentViews **ppEnum, IOleDocumentView **ppView);
  62. // *** IOleDocumentView ***
  63. virtual HRESULT STDMETHODCALLTYPE SetInPlaceSite(IOleInPlaceSite *pIPSite);
  64. virtual HRESULT STDMETHODCALLTYPE GetInPlaceSite(IOleInPlaceSite **ppIPSite);
  65. virtual HRESULT STDMETHODCALLTYPE GetDocument(IUnknown **ppunk);
  66. virtual HRESULT STDMETHODCALLTYPE SetRect(LPRECT prcView);
  67. virtual HRESULT STDMETHODCALLTYPE GetRect(LPRECT prcView);
  68. virtual HRESULT STDMETHODCALLTYPE SetRectComplex(LPRECT prcView, LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox);
  69. virtual HRESULT STDMETHODCALLTYPE Show(BOOL fShow);
  70. virtual HRESULT STDMETHODCALLTYPE UIActivate(BOOL fUIActivate);
  71. virtual HRESULT STDMETHODCALLTYPE Open();
  72. virtual HRESULT STDMETHODCALLTYPE CloseView(DWORD dwReserved);
  73. virtual HRESULT STDMETHODCALLTYPE SaveViewState(LPSTREAM pstm);
  74. virtual HRESULT STDMETHODCALLTYPE ApplyViewState(LPSTREAM pstm);
  75. virtual HRESULT STDMETHODCALLTYPE Clone(IOleInPlaceSite *pIPSiteNew, IOleDocumentView **ppViewNew);
  76. // *** IOleObject ***
  77. virtual HRESULT STDMETHODCALLTYPE SetClientSite(IOleClientSite *pClientSite);
  78. virtual HRESULT STDMETHODCALLTYPE GetClientSite(IOleClientSite **ppClientSite);
  79. virtual HRESULT STDMETHODCALLTYPE SetHostNames(LPCOLESTR szContainerApp, LPCOLESTR szContainerObj);
  80. virtual HRESULT STDMETHODCALLTYPE Close(DWORD dwSaveOption);
  81. virtual HRESULT STDMETHODCALLTYPE SetMoniker(DWORD dwWhichMoniker, IMoniker *pmk);
  82. virtual HRESULT STDMETHODCALLTYPE GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
  83. virtual HRESULT STDMETHODCALLTYPE InitFromData(IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved);
  84. virtual HRESULT STDMETHODCALLTYPE GetClipboardData(DWORD dwReserved, IDataObject **ppDataObject);
  85. virtual HRESULT STDMETHODCALLTYPE DoVerb(LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect);
  86. virtual HRESULT STDMETHODCALLTYPE EnumVerbs(IEnumOLEVERB **ppEnumOleVerb);
  87. virtual HRESULT STDMETHODCALLTYPE Update();
  88. virtual HRESULT STDMETHODCALLTYPE IsUpToDate();
  89. virtual HRESULT STDMETHODCALLTYPE GetUserClassID(CLSID *pClsid);
  90. virtual HRESULT STDMETHODCALLTYPE GetUserType(DWORD dwFormOfType, LPOLESTR *pszUserType);
  91. virtual HRESULT STDMETHODCALLTYPE SetExtent(DWORD dwDrawAspect, SIZEL *psizel);
  92. virtual HRESULT STDMETHODCALLTYPE GetExtent(DWORD dwDrawAspect, SIZEL *psizel);
  93. virtual HRESULT STDMETHODCALLTYPE Advise(IAdviseSink *pAdvSink, DWORD *pdwConnection);
  94. virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwConnection);
  95. virtual HRESULT STDMETHODCALLTYPE EnumAdvise(IEnumSTATDATA **ppenumAdvise);
  96. virtual HRESULT STDMETHODCALLTYPE GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus);
  97. virtual HRESULT STDMETHODCALLTYPE SetColorScheme(LOGPALETTE *pLogpal);
  98. // *** IOleInPlaceObject ***
  99. virtual HRESULT STDMETHODCALLTYPE InPlaceDeactivate();
  100. virtual HRESULT STDMETHODCALLTYPE UIDeactivate();
  101. virtual HRESULT STDMETHODCALLTYPE SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
  102. virtual HRESULT STDMETHODCALLTYPE ReactivateAndUndo();
  103. // *** IOleWindow ***
  104. virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
  105. virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
  106. // *** IOleInPlaceActiveObject ***
  107. virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(LPMSG lpmsg);
  108. virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(BOOL fActivate);
  109. virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(BOOL fActivate);
  110. virtual HRESULT STDMETHODCALLTYPE ResizeBorder(LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow);
  111. virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable);
  112. // *** IOleCommandTarget ***
  113. virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText);
  114. virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
  115. // *** IServiceProvider ***
  116. virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, LPVOID *ppvObject);
  117. // *** IPersist ***
  118. virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
  119. // *** IPersistMime ***
  120. virtual HRESULT STDMETHODCALLTYPE Load(IMimeMessage *pMsg);
  121. virtual HRESULT STDMETHODCALLTYPE Save(IMimeMessage *pMsg, DWORD dwFlags);
  122. // *** IPersistStreamInit ***
  123. virtual HRESULT STDMETHODCALLTYPE IsDirty();
  124. virtual HRESULT STDMETHODCALLTYPE Load(LPSTREAM pstm);
  125. virtual HRESULT STDMETHODCALLTYPE Save(LPSTREAM pstm, BOOL fClearDirty);
  126. virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER * pCbSize);
  127. virtual HRESULT STDMETHODCALLTYPE InitNew();
  128. // IPersistMoniker Members
  129. virtual HRESULT STDMETHODCALLTYPE Load(BOOL fFullyAvailable, IMoniker *pMoniker, IBindCtx *pBindCtx, DWORD grfMode);
  130. virtual HRESULT STDMETHODCALLTYPE GetCurMoniker(IMoniker **ppMoniker);
  131. virtual HRESULT STDMETHODCALLTYPE Save(IMoniker *pMoniker, IBindCtx *pBindCtx, BOOL fRemember);
  132. virtual HRESULT STDMETHODCALLTYPE SaveCompleted(IMoniker *pMoniker, IBindCtx *pBindCtx);
  133. #ifdef OFFICE_BINDER
  134. // *** IPersistStorage ***
  135. virtual HRESULT STDMETHODCALLTYPE InitNew(IStorage *pStg);
  136. virtual HRESULT STDMETHODCALLTYPE Load(IStorage *pStg);
  137. virtual HRESULT STDMETHODCALLTYPE Save(IStorage *pStgSave, BOOL fSameAsLoad);
  138. virtual HRESULT STDMETHODCALLTYPE SaveCompleted(IStorage *pStgNew);
  139. virtual HRESULT STDMETHODCALLTYPE HandsOffStorage();
  140. #endif
  141. // *** IDispatch ***
  142. virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
  143. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo);
  144. virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid);
  145. virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr);
  146. // *** IMimeEdit **
  147. virtual HRESULT STDMETHODCALLTYPE put_src(BSTR bstr);
  148. virtual HRESULT STDMETHODCALLTYPE get_src(BSTR *pbstr);
  149. virtual HRESULT STDMETHODCALLTYPE put_header(LONG lStyle);
  150. virtual HRESULT STDMETHODCALLTYPE get_header(LONG *plStyle);
  151. virtual HRESULT STDMETHODCALLTYPE put_editMode(VARIANT_BOOL b);
  152. virtual HRESULT STDMETHODCALLTYPE get_editMode(VARIANT_BOOL *pbool);
  153. virtual HRESULT STDMETHODCALLTYPE get_messageSource(BSTR *pbstr);
  154. // OE5_BETA2 needs to be defined in public headers
  155. virtual HRESULT STDMETHODCALLTYPE get_text(BSTR *pbstr);
  156. virtual HRESULT STDMETHODCALLTYPE get_html(BSTR *pbstr);
  157. virtual HRESULT STDMETHODCALLTYPE clear();
  158. virtual HRESULT STDMETHODCALLTYPE get_doc(IDispatch **ppDoc);
  159. // OE5_BETA2 needs to be defined in public headers
  160. // *** IQuickActivate ***
  161. virtual HRESULT STDMETHODCALLTYPE QuickActivate(QACONTAINER *pQaContainer, QACONTROL *pQaControl);
  162. virtual HRESULT STDMETHODCALLTYPE SetContentExtent(LPSIZEL pSizel);
  163. virtual HRESULT STDMETHODCALLTYPE GetContentExtent(LPSIZEL pSizel);
  164. // *** IPersistFile ***
  165. virtual HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pszFileName, DWORD dwMode);
  166. virtual HRESULT STDMETHODCALLTYPE Save(LPCOLESTR pszFileName, BOOL fRemember);
  167. virtual HRESULT STDMETHODCALLTYPE SaveCompleted(LPCOLESTR pszFileName);
  168. virtual HRESULT STDMETHODCALLTYPE GetCurFile(LPOLESTR * ppszFileName);
  169. CDoc(IUnknown *pUnkOuter=NULL);
  170. virtual ~CDoc();
  171. private:
  172. ULONG m_ulState;
  173. HWND m_hwndParent;
  174. LPSTR m_lpszAppName;
  175. IOleClientSite *m_pClientSite;
  176. IOleInPlaceSite *m_pIPSite;
  177. IOleInPlaceFrame *m_pInPlaceFrame;
  178. IOleInPlaceUIWindow *m_pInPlaceUIWindow;
  179. CBody *m_pBodyObj;
  180. LPTYPEINFO m_pTypeInfo;
  181. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  182. HRESULT ActivateView();
  183. HRESULT ActivateInPlace();
  184. HRESULT DeactivateInPlace();
  185. HRESULT ActivateUI();
  186. HRESULT DeactivateUI();
  187. HRESULT DoShow(IOleClientSite *pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
  188. HRESULT AttachWin(HWND hwndParent, LPRECT lprcPos);
  189. BOOL OnCreate(HWND hwnd);
  190. BOOL OnNCDestroy();
  191. HRESULT GetHostName(LPSTR szTitle, ULONG cch);
  192. HRESULT EnsureTypeLibrary();
  193. };
  194. #endif