Source code of Windows XP (NT5)
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.

302 lines
6.8 KiB

  1. //**********************************************************************
  2. // File name: IAS.CPP
  3. //
  4. // Implementation file of CAdviseSink
  5. //
  6. //
  7. // Functions:
  8. //
  9. // See IAS.H for Class Definition
  10. //
  11. // Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
  12. //**********************************************************************
  13. #include "pre.h"
  14. #include "iocs.h"
  15. #include "ias.h"
  16. #include "app.h"
  17. #include "site.h"
  18. #include "doc.h"
  19. //**********************************************************************
  20. //
  21. // CAdviseSink::QueryInterface
  22. //
  23. // Purpose:
  24. //
  25. // Used for interface negotiation
  26. //
  27. // Parameters:
  28. //
  29. // REFIID riid - The requested interface
  30. //
  31. // LPVOID FAR* ppvObj - Place to return the interface
  32. //
  33. // Return Value:
  34. //
  35. // HRESULT from CSimpleSite::QueryInterface
  36. //
  37. // Function Calls:
  38. // Function Location
  39. //
  40. // CSimpleSite::QueryInterface SITE.CPP
  41. // TestDebugOut Windows API
  42. //
  43. // Comments:
  44. //
  45. // This function simply delegates to the Object class, which is
  46. // aware of the supported interfaces.
  47. //
  48. //********************************************************************
  49. STDMETHODIMP CAdviseSink::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
  50. {
  51. TestDebugOut("In IAS::QueryInterface\r\n");
  52. // delegate to the document Object
  53. return m_pSite->QueryInterface(riid, ppvObj);
  54. }
  55. //**********************************************************************
  56. //
  57. // CAdviseSink::AddRef
  58. //
  59. // Purpose:
  60. //
  61. // Increments the reference count on the CSimpleSite. Since CAdviseSink
  62. // is a nested class of CSimpleSite, we don't need a separate reference
  63. // count for CAdviseSink. We can just use the reference count of
  64. // CSimpleSite.
  65. //
  66. // Parameters:
  67. //
  68. // None
  69. //
  70. // Return Value:
  71. //
  72. // The new reference count of CSimpleSite
  73. //
  74. // Function Calls:
  75. // Function Location
  76. //
  77. // CSimpleSite::AddRef SITE.CPP
  78. // TestDebugOut Windows API
  79. //
  80. //
  81. //********************************************************************
  82. STDMETHODIMP_(ULONG) CAdviseSink::AddRef()
  83. {
  84. TestDebugOut("In IAS::AddRef\r\n");
  85. // delegate to the container Site
  86. return m_pSite->AddRef();
  87. }
  88. //**********************************************************************
  89. //
  90. // CAdviseSink::Release
  91. //
  92. // Purpose:
  93. //
  94. // Decrements the reference count on the CSimpleSite. Since CAdviseSink
  95. // is a nested class of CSimpleSite, we don't need a separate reference
  96. // count for CAdviseSink. We can just use the reference count of
  97. // CSimpleSite.
  98. //
  99. // Parameters:
  100. //
  101. // None
  102. //
  103. // Return Value:
  104. //
  105. // The new reference count of CSimpleSite
  106. //
  107. // Function Calls:
  108. // Function Location
  109. //
  110. // CSimpleSite::Release SITE.CPP
  111. // TestDebugOut Windows API
  112. //
  113. //
  114. //********************************************************************
  115. STDMETHODIMP_(ULONG) CAdviseSink::Release()
  116. {
  117. TestDebugOut("In IAS::Release\r\n");
  118. // delegate to the container Site
  119. return m_pSite->Release();
  120. }
  121. //**********************************************************************
  122. //
  123. // CAdviseSink::OnDataChange
  124. //
  125. // Purpose:
  126. //
  127. // Not Implemented (needs to be stubbed out)
  128. //
  129. // Parameters:
  130. //
  131. // FORMATETC pFormatetc - data format infomation
  132. // STGMEDIUM pStgmed - storage medium on which data is passed
  133. //
  134. // Return Value:
  135. //
  136. // None
  137. //
  138. // Function Calls:
  139. // Function Location
  140. //
  141. // TestDebugOut Windows API
  142. //
  143. //
  144. //********************************************************************
  145. STDMETHODIMP_(void) CAdviseSink::OnDataChange (FORMATETC FAR* pFormatetc,
  146. STGMEDIUM FAR* pStgmed)
  147. {
  148. TestDebugOut("In IAS::OnDataChange\r\n");
  149. }
  150. //**********************************************************************
  151. //
  152. // CAdviseSink::OnViewChange
  153. //
  154. // Purpose:
  155. //
  156. // Notifies us that the view has changed and needs to be updated.
  157. //
  158. // Parameters:
  159. //
  160. // DWORD dwAspect - Aspect that has changed
  161. //
  162. // LONG lindex - Index that has changed
  163. //
  164. // Return Value:
  165. //
  166. // None
  167. //
  168. // Function Calls:
  169. // Function Location
  170. //
  171. // TestDebugOut Windows API
  172. // InvalidateRect Windows API
  173. // IViewObject2::GetExtent Object
  174. // IViewObject2::Release Object
  175. // IOleObject::QueryInterface Object
  176. //
  177. //
  178. //********************************************************************
  179. STDMETHODIMP_(void) CAdviseSink::OnViewChange (DWORD dwAspect, LONG lindex)
  180. {
  181. LPVIEWOBJECT2 lpViewObject2;
  182. TestDebugOut("In IAS::OnViewChange\r\n");
  183. // get a pointer to IViewObject2
  184. HRESULT hErr = m_pSite->m_lpOleObject->QueryInterface(
  185. IID_IViewObject2,
  186. (LPVOID FAR *)&lpViewObject2);
  187. if (hErr == NOERROR)
  188. {
  189. // get extent of the object
  190. // NOTE: this method will never be remoted; it can be called w/i
  191. // this async method
  192. lpViewObject2->GetExtent(DVASPECT_CONTENT, -1 , NULL,
  193. &m_pSite->m_sizel);
  194. lpViewObject2->Release();
  195. }
  196. // need to clean up the region
  197. InvalidateRect(m_pSite->m_lpDoc->m_hDocWnd, NULL, TRUE);
  198. }
  199. //**********************************************************************
  200. //
  201. // CAdviseSink::OnRename
  202. //
  203. // Purpose:
  204. //
  205. // Not Implemented (needs to be stubbed out)
  206. //
  207. // Parameters:
  208. //
  209. // LPMONIKER pmk - pointer to moniker
  210. //
  211. // Return Value:
  212. //
  213. // None
  214. //
  215. // Function Calls:
  216. // Function Location
  217. //
  218. // TestDebugOut Windows API
  219. //
  220. //
  221. //********************************************************************
  222. STDMETHODIMP_(void) CAdviseSink::OnRename (LPMONIKER pmk)
  223. {
  224. TestDebugOut("In IAS::OnRename\r\n");
  225. }
  226. //**********************************************************************
  227. //
  228. // CAdviseSink::OnSave
  229. //
  230. // Purpose:
  231. //
  232. // Not Implemented (needs to be stubbed out)
  233. //
  234. // Parameters:
  235. //
  236. // None
  237. //
  238. // Return Value:
  239. //
  240. // None
  241. //
  242. // Function Calls:
  243. // Function Location
  244. //
  245. // TestDebugOut Windows API
  246. //
  247. //
  248. //********************************************************************
  249. STDMETHODIMP_(void) CAdviseSink::OnSave ()
  250. {
  251. TestDebugOut("In IAS::OnSave\r\n");
  252. }
  253. //**********************************************************************
  254. //
  255. // CAdviseSink::OnClose
  256. //
  257. // Purpose:
  258. //
  259. // Not Implemented (needs to be stubbed out)
  260. //
  261. // Parameters:
  262. //
  263. // None
  264. //
  265. // Return Value:
  266. //
  267. // None
  268. //
  269. // Function Calls:
  270. // Function Location
  271. //
  272. // TestDebugOut Windows API
  273. //
  274. //
  275. //********************************************************************
  276. STDMETHODIMP_(void) CAdviseSink::OnClose()
  277. {
  278. TestDebugOut("In IAS::OnClose\r\n");
  279. }