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.

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