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.

316 lines
7.0 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. // Returns a pointer to a requested interface.
  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 this interface
  62. //
  63. // Parameters:
  64. //
  65. // None
  66. //
  67. // Return Value:
  68. //
  69. // The current reference count on this interface.
  70. //
  71. // Function Calls:
  72. // Function Location
  73. //
  74. // CSimpleSite::AddReff SITE.CPP
  75. // TestDebugOut Windows API
  76. //
  77. // Comments:
  78. //
  79. // This function adds one to the ref count of the interface,
  80. // and calls then calls CSimpleSite to increment its ref.
  81. // count.
  82. //
  83. //********************************************************************
  84. STDMETHODIMP_(ULONG) CAdviseSink::AddRef()
  85. {
  86. TestDebugOut("In IAS::AddRef\r\n");
  87. // increment the interface reference count (for debugging only)
  88. ++m_nCount;
  89. // delegate to the container Site
  90. return m_pSite->AddRef();
  91. }
  92. //**********************************************************************
  93. //
  94. // CAdviseSink::Release
  95. //
  96. // Purpose:
  97. //
  98. // Decrements the reference count on this interface
  99. //
  100. // Parameters:
  101. //
  102. // None
  103. //
  104. // Return Value:
  105. //
  106. // The current reference count on this interface.
  107. //
  108. // Function Calls:
  109. // Function Location
  110. //
  111. // CSimpleSite::Release SITE.CPP
  112. // TestDebugOut Windows API
  113. //
  114. // Comments:
  115. //
  116. // This function subtracts one from the ref count of the interface,
  117. // and calls then calls CSimpleSite to decrement its ref.
  118. // count.
  119. //
  120. //********************************************************************
  121. STDMETHODIMP_(ULONG) CAdviseSink::Release()
  122. {
  123. TestDebugOut("In IAS::Release\r\n");
  124. // decrement the interface reference count (for debugging only)
  125. m_nCount--;
  126. // delegate to the container Site
  127. return m_pSite->Release();
  128. }
  129. //**********************************************************************
  130. //
  131. // CAdviseSink::OnDataChange
  132. //
  133. // Purpose:
  134. //
  135. // Not Implemented (needs to be stubbed out)
  136. //
  137. // Parameters:
  138. //
  139. // Not Implemented (needs to be stubbed out)
  140. //
  141. // Return Value:
  142. //
  143. // Not Implemented (needs to be stubbed out)
  144. //
  145. // Function Calls:
  146. // Function Location
  147. //
  148. // TestDebugOut Windows API
  149. //
  150. // Comments:
  151. //
  152. // Not Implemented (needs to be stubbed out)
  153. //
  154. //********************************************************************
  155. STDMETHODIMP_(void) CAdviseSink::OnDataChange (FORMATETC FAR* pFormatetc, STGMEDIUM FAR* pStgmed)
  156. {
  157. TestDebugOut("In IAS::OnDataChange\r\n");
  158. }
  159. //**********************************************************************
  160. //
  161. // CAdviseSink::OnViewChange
  162. //
  163. // Purpose:
  164. //
  165. // Notifies us that the view has changed and needs to be updated.
  166. //
  167. // Parameters:
  168. //
  169. // DWORD dwAspect - Aspect that has changed
  170. //
  171. // LONG lindex - Index that has changed
  172. //
  173. // Return Value:
  174. //
  175. // None
  176. //
  177. // Function Calls:
  178. // Function Location
  179. //
  180. // TestDebugOut Windows API
  181. // InvalidateRect Windows API
  182. // IViewObject2::GetExtent Object
  183. //
  184. // Comments:
  185. //
  186. //********************************************************************
  187. STDMETHODIMP_(void) CAdviseSink::OnViewChange (DWORD dwAspect, LONG lindex)
  188. {
  189. LPVIEWOBJECT2 lpViewObject2;
  190. TestDebugOut("In IAS::OnViewChange\r\n");
  191. // get a pointer to IViewObject2
  192. HRESULT hErr = m_pSite->m_lpOleObject->QueryInterface(
  193. IID_IViewObject2,(LPVOID FAR *)&lpViewObject2);
  194. if (hErr == NOERROR) {
  195. // get extent of the object
  196. // NOTE: this method will never be remoted; it can be called w/i this async method
  197. lpViewObject2->GetExtent(DVASPECT_CONTENT, -1 , NULL, &m_pSite->m_sizel);
  198. lpViewObject2->Release();
  199. }
  200. InvalidateRect(m_pSite->m_lpDoc->m_hDocWnd, NULL, TRUE);
  201. }
  202. //**********************************************************************
  203. //
  204. // CAdviseSink::OnRename
  205. //
  206. // Purpose:
  207. //
  208. // Not Implemented (needs to be stubbed out)
  209. //
  210. // Parameters:
  211. //
  212. // Not Implemented (needs to be stubbed out)
  213. //
  214. // Return Value:
  215. //
  216. // Not Implemented (needs to be stubbed out)
  217. //
  218. // Function Calls:
  219. // Function Location
  220. //
  221. // TestDebugOut Windows API
  222. //
  223. // Comments:
  224. //
  225. // Not Implemented (needs to be stubbed out)
  226. //
  227. //********************************************************************
  228. STDMETHODIMP_(void) CAdviseSink::OnRename (LPMONIKER pmk)
  229. {
  230. TestDebugOut("In IAS::OnRename\r\n");
  231. }
  232. //**********************************************************************
  233. //
  234. // CAdviseSink::OnSave
  235. //
  236. // Purpose:
  237. //
  238. // Not Implemented (needs to be stubbed out)
  239. //
  240. // Parameters:
  241. //
  242. // Not Implemented (needs to be stubbed out)
  243. //
  244. // Return Value:
  245. //
  246. // Not Implemented (needs to be stubbed out)
  247. //
  248. // Function Calls:
  249. // Function Location
  250. //
  251. // TestDebugOut Windows API
  252. //
  253. // Comments:
  254. //
  255. // Not Implemented (needs to be stubbed out)
  256. //
  257. //********************************************************************
  258. STDMETHODIMP_(void) CAdviseSink::OnSave ()
  259. {
  260. TestDebugOut("In IAS::OnSave\r\n");
  261. }
  262. //**********************************************************************
  263. //
  264. // CAdviseSink::OnClose
  265. //
  266. // Purpose:
  267. //
  268. // Not Implemented (needs to be stubbed out)
  269. //
  270. // Parameters:
  271. //
  272. // Not Implemented (needs to be stubbed out)
  273. //
  274. // Return Value:
  275. //
  276. // Not Implemented (needs to be stubbed out)
  277. //
  278. // Function Calls:
  279. // Function Location
  280. //
  281. // TestDebugOut Windows API
  282. //
  283. // Comments:
  284. //
  285. // Not Implemented (needs to be stubbed out)
  286. //
  287. //********************************************************************
  288. STDMETHODIMP_(void) CAdviseSink::OnClose()
  289. {
  290. TestDebugOut("In IAS::OnClose\r\n");
  291. }