dhuihdlr.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 7k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //+----------------------------------------------------------------------------
  2. //
  3. //  HTML property pages
  4. //
  5. //  Microsoft Windows
  6. //  Copyright (C) Microsoft Corporation, 1992 - 1997.
  7. //
  8. //  File:      dhuihdlr.cpp
  9. //
  10. //  Contents:  CDocHostUiHandler implimentation
  11. //
  12. //  History:   22-Jan-97 EricB      Created.
  13. //
  14. //-----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #include "SiteObj.h"
  17. #pragma hdrstop
  18. CDocHostUiHandler::CDocHostUiHandler(LPSITE pSite) :
  19.     m_cRef(0)
  20. {
  21. #ifdef _DEBUG
  22.     ASSERT(pSite != NULL);
  23.     strcpy(szClass, "CDocHostUiHandler");
  24. #endif
  25.     m_pSite = pSite;
  26. }
  27. CDocHostUiHandler::~CDocHostUiHandler(void)
  28. {
  29.     ASSERT(m_cRef == 0);
  30. }
  31. STDMETHODIMP CDocHostUiHandler::QueryInterface(REFIID riid, void **ppv)
  32. {
  33.     return m_pSite->QueryInterface(riid, ppv);
  34. }
  35. STDMETHODIMP_(ULONG) CDocHostUiHandler::AddRef(void)
  36. {
  37.     ++m_cRef;
  38.     return m_pSite->AddRef();
  39. }
  40. STDMETHODIMP_(ULONG) CDocHostUiHandler::Release(void)
  41. {
  42.     ASSERT(m_cRef > 0);
  43.     --m_cRef;
  44.     return m_pSite->Release();
  45. }
  46. // * CDocHostUiHandler::GetHostInfo
  47. // *
  48. // * Purpose: Called at initialisation
  49. // *
  50. STDMETHODIMP CDocHostUiHandler::GetHostInfo(DOCHOSTUIINFO * pInfo)
  51. {
  52.     pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_SCROLL_NO;
  53.     pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
  54.     return S_OK;
  55. }
  56. // * CDocHostUiHandler::ShowUI
  57. // *
  58. // * Purpose: Called when trident shows its UI
  59. // *
  60. STDMETHODIMP
  61. CDocHostUiHandler::ShowUI(DWORD dwID,
  62.                           IOleInPlaceActiveObject * /*pActiveObject*/,
  63.                           IOleCommandTarget * pCommandTarget,
  64.                           IOleInPlaceFrame * /*pFrame*/,
  65.                           IOleInPlaceUIWindow * /*pDoc*/)
  66. {
  67. #ifdef DONTNEED
  68.     // Set the Browse/Edit mode flag using the ID
  69.     if (dwID == DOCHOSTUITYPE_AUTHOR)
  70.     {
  71.         m_pSite->GetFrame()->m_bBrowse = FALSE;
  72.     }
  73.     else
  74.     {
  75.         m_pSite->GetFrame()->m_bBrowse = TRUE;
  76.     }
  77. #endif // DONTNEED
  78.     // If we havent already got the CommandTraget interface then store it
  79.     // away now.
  80.     //
  81.     if (m_pSite->GetCommandTarget() == NULL)
  82.     {
  83.         if (pCommandTarget != NULL)
  84.         {
  85.             // Don't forget to AddRef or Trident will assume we aren't using
  86.             // it, and it'll go away.
  87.             //
  88.             pCommandTarget->AddRef();
  89.             m_pSite->SetCommandTarget(pCommandTarget);
  90.         }
  91.     }
  92.     // We've already got our own UI in place so just return S_OK
  93.     return S_OK;
  94. }
  95. // * CDocHostUiHandler::HideUI
  96. // *
  97. // * Purpose: Called when Trident hides its UI
  98. // *
  99. STDMETHODIMP CDocHostUiHandler::HideUI(void)
  100. {
  101.     return S_OK;
  102. }
  103. // * CDocHostUiHandler::UpdateUI
  104. // *
  105. // * Purpose: Called when Trident updates its UI
  106. // *
  107. STDMETHODIMP CDocHostUiHandler::UpdateUI(void)
  108. {
  109.     // MFC is pretty good about updating it's UI in it's Idle loop so I don't do anything here
  110.     return S_OK;
  111. }
  112. // * CDocHostUiHandler::EnableModeless
  113. // *
  114. // * Purpose: Called from Trident's IOleInPlaceActiveObject::EnableModeless
  115. // *
  116. STDMETHODIMP CDocHostUiHandler::EnableModeless(BOOL /*fEnable*/)
  117. {
  118.     return E_NOTIMPL;
  119. }
  120. // * CDocHostUiHandler::OnDocWindowActivate
  121. // *
  122. // * Purpose: Called from Trident's IOleInPlaceActiveObject::OnDocWindowActivate
  123. // *
  124. STDMETHODIMP CDocHostUiHandler::OnDocWindowActivate(BOOL /*fActivate*/)
  125. {
  126.     return E_NOTIMPL;
  127. }
  128. // * CDocHostUiHandler::OnFrameWindowActivate
  129. // *
  130. // * Purpose: Called from Trident's IOleInPlaceActiveObject::OnFrameWindowActivate
  131. // *
  132. STDMETHODIMP CDocHostUiHandler::OnFrameWindowActivate(BOOL /*fActivate*/)
  133. {
  134.     return E_NOTIMPL;
  135. }
  136. // * CDocHostUiHandler::ResizeBorder
  137. // *
  138. // * Purpose: Called from Trident's IOleInPlaceActiveObject::ResizeBorder
  139. // *
  140. STDMETHODIMP CDocHostUiHandler::ResizeBorder(
  141.                 LPCRECT /*prcBorder*/, 
  142.                 IOleInPlaceUIWindow* /*pUIWindow*/,
  143.                 BOOL /*fRameWindow*/)
  144. {
  145.     return E_NOTIMPL;
  146. }
  147. // * CDocHostUiHandler::ShowContextMenu
  148. // *
  149. // * Purpose: Called when Trident would normally display its context menu
  150. // *
  151. STDMETHODIMP CDocHostUiHandler::ShowContextMenu(
  152.                 DWORD /*dwID*/, 
  153.                 POINT* /*pptPosition*/,
  154.                 IUnknown* /*pCommandTarget*/,
  155.                 IDispatch* /*pDispatchObjectHit*/)
  156. {
  157.     return E_NOTIMPL;
  158. }
  159. // * CDocHostUiHandler::TranslateAccelerator
  160. // *
  161. // * Purpose: Called from Trident's TranslateAccelerator routines
  162. // *
  163. STDMETHODIMP CDocHostUiHandler::TranslateAccelerator(LPMSG lpMsg,
  164.             /* [in] */ const GUID __RPC_FAR *pguidCmdGroup,
  165.             /* [in] */ DWORD nCmdID)
  166. {
  167.     return S_FALSE;
  168. }
  169. // * CDocHostUiHandler::GetOptionKeyPath
  170. // *
  171. // * Purpose: Called by Trident to find where the host wishes to store 
  172. // *    its options in the registry
  173. // *
  174. STDMETHODIMP CDocHostUiHandler::GetOptionKeyPath(BSTR* pbstrKey, ULONG cchpstrKey)
  175. {
  176. #if 0 
  177.     // BUGBUG: more MFC to remove
  178.     CProptestApp * pApp = (CProptestApp *)AfxGetApp();
  179.     CString strPath = pApp->m_pszRegistryKey;
  180.     BSTR bstr = strPath.AllocSysString();
  181.     pbstrKey = &bstr;
  182.     return S_OK;
  183. #else
  184.     return E_NOTIMPL;
  185. #endif
  186. }
  187. STDMETHODIMP CDocHostUiHandler::GetDropTarget(
  188.             /* [in] */ IDropTarget __RPC_FAR *pDropTarget,
  189.             /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget)
  190. {
  191.     return E_NOTIMPL;
  192. }
  193. //+----------------------------------------------------------------------------
  194. //
  195. //  CDocHostUiHandler::GetExternal
  196. //
  197. //  BUGBUG: GetExternal not implemented.
  198. //
  199. //-----------------------------------------------------------------------------
  200. STDMETHODIMP
  201. CDocHostUiHandler::GetExternal(IDispatch **pDispath)
  202. {
  203.     return E_NOTIMPL;
  204. }
  205. //+----------------------------------------------------------------------------
  206. //
  207. //  CDocHostUiHandler::TranslateUrl
  208. //
  209. //  BUGBUG: TranslateUrl not implemented.
  210. //
  211. //-----------------------------------------------------------------------------
  212. STDMETHODIMP
  213. CDocHostUiHandler::TranslateUrl(DWORD dwTranslate,
  214.                                 OLECHAR *pStr,
  215.                                 OLECHAR **ppStr)
  216. {
  217.     return E_NOTIMPL;
  218. }
  219. //+----------------------------------------------------------------------------
  220. //
  221. //  CDocHostUiHandler::FilterDataObject
  222. //
  223. //  BUGBUG: FilterDataObject not implemented.
  224. //
  225. //-----------------------------------------------------------------------------
  226. STDMETHODIMP
  227. CDocHostUiHandler::FilterDataObject(IDataObject *pObj,
  228.                                     IDataObject **ppObj)
  229. {
  230.     return E_NOTIMPL;
  231. }