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.

400 lines
9.0 KiB

  1. //**********************************************************************
  2. // File name: IOIPAO.CPP
  3. //
  4. // Implementation file for the CClassFactory Class
  5. //
  6. // Functions:
  7. //
  8. // See ioipao.h for a list of member functions.
  9. //
  10. // Copyright (c) 1993 Microsoft Corporation. All rights reserved.
  11. //**********************************************************************
  12. #include "pre.h"
  13. #include "obj.h"
  14. #include "ioipao.h"
  15. #include "app.h"
  16. #include "doc.h"
  17. //**********************************************************************
  18. //
  19. // COleInPlaceActiveObject::QueryInterface
  20. //
  21. // Purpose:
  22. //
  23. //
  24. // Parameters:
  25. //
  26. // REFIID riid - Interface being queried for.
  27. //
  28. // LPVOID FAR *ppvObj - Out pointer for the interface.
  29. //
  30. // Return Value:
  31. //
  32. // S_OK - Success
  33. // E_NOINTERFACE - Failure
  34. //
  35. // Function Calls:
  36. // Function Location
  37. //
  38. // CSimpSvrObj::QueryInterface OBJ.CPP
  39. //
  40. // Comments:
  41. //
  42. //
  43. //********************************************************************
  44. STDMETHODIMP COleInPlaceActiveObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
  45. {
  46. TestDebugOut("In COleInPlaceActiveObject::QueryInterface\r\n");
  47. // need to NULL the out parameter
  48. return m_lpObj->QueryInterface(riid, ppvObj);
  49. }
  50. //**********************************************************************
  51. //
  52. // COleInPlaceActiveObject::AddRef
  53. //
  54. // Purpose:
  55. //
  56. // Increments the reference count on COleInPlaceActiveObject and the
  57. // "object" object.
  58. //
  59. // Parameters:
  60. //
  61. // None
  62. //
  63. // Return Value:
  64. //
  65. // The Reference count on the "object" object.
  66. //
  67. // Function Calls:
  68. // Function Location
  69. //
  70. // OuputDebugString Windows API
  71. // CSimpSvrObj::AddRef OBJ.CPP
  72. //
  73. // Comments:
  74. //
  75. //
  76. //********************************************************************
  77. STDMETHODIMP_(ULONG) COleInPlaceActiveObject::AddRef ()
  78. {
  79. TestDebugOut("In COleInPlaceActiveObject::AddRef\r\n");
  80. ++m_nCount;
  81. return m_lpObj->AddRef();
  82. }
  83. //**********************************************************************
  84. //
  85. // COleInPlaceActiveObject::Release
  86. //
  87. // Purpose:
  88. //
  89. // Decrements the reference count of COleInPlaceActiveObject.
  90. //
  91. // Parameters:
  92. //
  93. // None
  94. //
  95. // Return Value:
  96. //
  97. // The new reference count
  98. //
  99. // Function Calls:
  100. // Function Location
  101. //
  102. // TestDebugOut Windows API
  103. // CSimpSvrObj::Release OBJ.CPP
  104. //
  105. // Comments:
  106. //
  107. //
  108. //********************************************************************
  109. STDMETHODIMP_(ULONG) COleInPlaceActiveObject::Release ()
  110. {
  111. TestDebugOut("In COleInPlaceActiveObject::Release\r\n");
  112. --m_nCount;
  113. return m_lpObj->Release();
  114. }
  115. //**********************************************************************
  116. //
  117. // COleInPlaceActiveObject::OnDocWindowActivate
  118. //
  119. // Purpose:
  120. //
  121. // Called when the doc window (in an MDI App) is (de)activated.
  122. //
  123. // Parameters:
  124. //
  125. // BOOL fActivate - TRUE if activating, FALSE if deactivating
  126. //
  127. // Return Value:
  128. //
  129. // S_OK
  130. //
  131. // Function Calls:
  132. // Function Location
  133. //
  134. // TestDebugOut Windows API
  135. // IOleInPlaceFrame::SetActiveObject Container
  136. // CSimpSvrObject::AddFrameLevelUI OBJ.CPP
  137. //
  138. //
  139. // Comments:
  140. //
  141. //
  142. //********************************************************************
  143. STDMETHODIMP COleInPlaceActiveObject::OnDocWindowActivate ( BOOL fActivate )
  144. {
  145. TestDebugOut("In COleInPlaceActiveObject::OnDocWindowActivate\r\n");
  146. // Activating?
  147. if (fActivate)
  148. m_lpObj->AddFrameLevelUI();
  149. // No frame level tools to remove...
  150. return ResultFromScode(S_OK);
  151. };
  152. //**********************************************************************
  153. //
  154. // COleInPlaceActiveObject::OnFrameWindowActivate
  155. //
  156. // Purpose:
  157. //
  158. // Called when the Frame window is (de)activating
  159. //
  160. // Parameters:
  161. //
  162. // BOOL fActivate - TRUE if activating, FALSE if Deactivating
  163. //
  164. // Return Value:
  165. //
  166. // S_OK
  167. //
  168. // Function Calls:
  169. // Function Location
  170. //
  171. // TestDebugOut Windows API
  172. // SetFocus Windows API
  173. //
  174. //
  175. // Comments:
  176. //
  177. //
  178. //********************************************************************
  179. STDMETHODIMP COleInPlaceActiveObject::OnFrameWindowActivate ( BOOL fActivate)
  180. {
  181. TestDebugOut("In COleInPlaceActiveObject::OnFrameWindowActivate\r\n");
  182. // set the focus to the object window if we are activating.
  183. /* if (fActivate)
  184. SetFocus(m_lpObj->m_lpDoc->GethDocWnd()); */
  185. return ResultFromScode( S_OK );
  186. };
  187. //**********************************************************************
  188. //
  189. // COleInPlaceActiveObject::GetWindow
  190. //
  191. // Purpose:
  192. //
  193. // Gets the objects Window Handle.
  194. //
  195. // Parameters:
  196. //
  197. // HWND FAR* lphwnd - Location to return the window handle.
  198. //
  199. // Return Value:
  200. //
  201. // S_OK
  202. //
  203. // Function Calls:
  204. // Function Location
  205. //
  206. // TestDebugOut Windows API
  207. // CSimpSvrDoc::GethDocWnd DOC.H
  208. //
  209. //
  210. // Comments:
  211. //
  212. //
  213. //********************************************************************
  214. STDMETHODIMP COleInPlaceActiveObject::GetWindow ( HWND FAR* lphwnd)
  215. {
  216. TestDebugOut("In COleInPlaceActiveObject::GetWindow\r\n");
  217. // need to NULL the out parameter
  218. *lphwnd = m_lpObj->m_lpDoc->GethDocWnd();
  219. return ResultFromScode( S_OK );
  220. };
  221. //**********************************************************************
  222. //
  223. // COleInPlaceActiveObject::ContextSensitiveHelp
  224. //
  225. // Purpose:
  226. //
  227. // Used to implement Context Sensitive help
  228. //
  229. // Parameters:
  230. //
  231. // None
  232. //
  233. // Return Value:
  234. //
  235. // E_NOTIMPL
  236. //
  237. // Function Calls:
  238. // Function Location
  239. //
  240. // TestDebugOut Windows API
  241. //
  242. //
  243. // Comments:
  244. //
  245. // See TECHNOTES.WRI include with the OLE SDK for proper
  246. // implementation of this function.
  247. //
  248. //********************************************************************
  249. STDMETHODIMP COleInPlaceActiveObject::ContextSensitiveHelp ( BOOL fEnterMode )
  250. {
  251. TestDebugOut("In COleInPlaceActiveObject::ContextSensitiveHelp\r\n");
  252. return ResultFromScode( E_NOTIMPL);
  253. };
  254. //**********************************************************************
  255. //
  256. // COleInPlaceActiveObject::TranslateAccelerator
  257. //
  258. // Purpose:
  259. //
  260. // Used for translating accelerators in .DLL objects.
  261. //
  262. // Parameters:
  263. //
  264. // LPMSG lpmsg - Pointer to a message
  265. //
  266. // Return Value:
  267. //
  268. // S_FALSE
  269. //
  270. // Function Calls:
  271. // Function Location
  272. //
  273. // TestDebugOut Windows API
  274. //
  275. //
  276. // Comments:
  277. //
  278. // This method should never be called since we are implemented
  279. // in an executable.
  280. //
  281. //********************************************************************
  282. STDMETHODIMP COleInPlaceActiveObject::TranslateAccelerator ( LPMSG lpmsg)
  283. {
  284. TestDebugOut("In COleInPlaceActiveObject::TranslateAccelerator\r\n");
  285. // no accelerator table, return FALSE
  286. return ResultFromScode( S_FALSE );
  287. };
  288. //**********************************************************************
  289. //
  290. // COleInPlaceActiveObject::ResizeBorder
  291. //
  292. // Purpose:
  293. //
  294. // Called when the border changes size.
  295. //
  296. // Parameters:
  297. //
  298. // LPCRECT lprectBorder - New Border
  299. //
  300. // LPOLEINPLACEUIWINDOW lpUIWindow - Pointer to UIWindow
  301. //
  302. // BOOL fFrameWindow - True if lpUIWindow is the
  303. // frame window.
  304. //
  305. // Return Value:
  306. //
  307. // S_OK
  308. //
  309. // Function Calls:
  310. // Function Location
  311. //
  312. // TestDebugOut Windows API
  313. //
  314. //
  315. // Comments:
  316. //
  317. // Need to call SetBorderSpace again...
  318. //
  319. //********************************************************************
  320. STDMETHODIMP COleInPlaceActiveObject::ResizeBorder ( LPCRECT lprectBorder,
  321. LPOLEINPLACEUIWINDOW lpUIWindow,
  322. BOOL fFrameWindow)
  323. {
  324. TestDebugOut("In COleInPlaceActiveObject::ResizeBorder\r\n");
  325. // should always have an inplace frame...
  326. m_lpObj->GetInPlaceFrame()->SetBorderSpace(NULL);
  327. // There will only be a UIWindow if in an MDI container
  328. if (m_lpObj->GetUIWindow())
  329. m_lpObj->GetUIWindow()->SetBorderSpace(NULL);
  330. return ResultFromScode( S_OK );
  331. };
  332. //**********************************************************************
  333. //
  334. // COleInPlaceActiveObject::EnableModeless
  335. //
  336. // Purpose:
  337. //
  338. // Called to enable/disable modeless dialogs.
  339. //
  340. // Parameters:
  341. //
  342. // BOOL fEnable - TRUE to enable, FALSE to disable
  343. //
  344. // Return Value:
  345. //
  346. // S_OK
  347. //
  348. // Function Calls:
  349. // Function Location
  350. //
  351. // TestDebugOut Windows API
  352. //
  353. //
  354. // Comments:
  355. //
  356. // Called by the container when a model dialog box is added/removed
  357. // from the screen. The appropriate action for a server application
  358. // is to disable/enable any modeless dialogs currently being displayed.
  359. // Since this application doesn't display any modeless dialogs,
  360. // this method is essentially ignored.
  361. //
  362. //********************************************************************
  363. STDMETHODIMP COleInPlaceActiveObject::EnableModeless ( BOOL fEnable)
  364. {
  365. TestDebugOut("In COleInPlaceActiveObject::EnableModeless\r\n");
  366. return ResultFromScode( S_OK );
  367. };