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.

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