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.

556 lines
13 KiB

  1. //**********************************************************************
  2. // File name: IOIPF.CPP
  3. //
  4. // Implementation file for COleInPlaceFrame
  5. //
  6. // Functions:
  7. //
  8. // See IOIPF.H for class definition
  9. //
  10. // Copyright (c) 1992 - 1996 Microsoft Corporation. All rights reserved.
  11. //**********************************************************************
  12. #include "pre.h"
  13. //**********************************************************************
  14. //
  15. // CConnWizApp::QueryInterface
  16. //
  17. // Purpose:
  18. //
  19. // Used for interface negotiation at the Interface level.
  20. //
  21. // Parameters:
  22. //
  23. // REFIID riid - A reference to the interface that is
  24. // being queried.
  25. //
  26. // LPVOID FAR* ppvObj - An out parameter to return a pointer to
  27. // the interface.
  28. //
  29. // Return Value:
  30. //
  31. // S_OK - The interface is supported.
  32. // S_FALSE - The interface is not supported
  33. //
  34. // Function Calls:
  35. // Function Location
  36. //
  37. // CConnWizApp::QueryInterface APP.CPP
  38. //
  39. // Comments:
  40. //
  41. //********************************************************************
  42. STDMETHODIMP COleInPlaceFrame::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
  43. {
  44. TraceMsg(TF_GENERAL, "In IOIPF::QueryInterface\r\n");
  45. // delegate to the document Object
  46. return m_pSite->QueryInterface(riid, ppvObj);
  47. }
  48. //**********************************************************************
  49. //
  50. // CConnWizApp::AddRef
  51. //
  52. // Purpose:
  53. //
  54. // Adds to the reference count at the interface level.
  55. //
  56. // Parameters:
  57. //
  58. // None
  59. //
  60. // Return Value:
  61. //
  62. // ULONG - The new reference count of the interface.
  63. //
  64. // Function Calls:
  65. // Function Location
  66. //
  67. //
  68. // Comments:
  69. //
  70. //********************************************************************
  71. STDMETHODIMP_(ULONG) COleInPlaceFrame::AddRef()
  72. {
  73. TraceMsg(TF_GENERAL, "In IOIPF::AddRef\r\n");
  74. // delegate to the document Object
  75. m_pSite->AddRef();
  76. // increment the interface reference count
  77. return ++m_nCount;
  78. }
  79. //**********************************************************************
  80. //
  81. // CConnWizApp::Release
  82. //
  83. // Purpose:
  84. //
  85. // Decrements the reference count at this level
  86. //
  87. // Parameters:
  88. //
  89. // None
  90. //
  91. // Return Value:
  92. //
  93. // ULONG - The new reference count of the interface.
  94. //
  95. // Function Calls:
  96. // Function Location
  97. //
  98. // CConnWizApp::Release APP.CPP
  99. //
  100. // Comments:
  101. //
  102. //********************************************************************
  103. STDMETHODIMP_(ULONG) COleInPlaceFrame::Release()
  104. {
  105. TraceMsg(TF_GENERAL, "In IOIPF::Release\r\n");
  106. // delegate to the document object
  107. m_pSite->Release();
  108. // decrement the interface reference count
  109. return --m_nCount;
  110. }
  111. //**********************************************************************
  112. //
  113. // COleInPlaceFrame::GetWindow
  114. //
  115. // Purpose:
  116. //
  117. // Returns the frame window handle
  118. //
  119. // Parameters:
  120. //
  121. // HWND FAR* lphwnd - Location to return the window handle
  122. //
  123. // Return Value:
  124. //
  125. // S_OK
  126. //
  127. // Function Calls:
  128. // Function Location
  129. //
  130. // ResultFromScode OLE API
  131. //
  132. // Comments:
  133. //
  134. //********************************************************************
  135. STDMETHODIMP COleInPlaceFrame::GetWindow (HWND FAR* lphwnd)
  136. {
  137. TraceMsg(TF_GENERAL, "In IOIPF::GetWindow\r\n");
  138. *lphwnd = m_pSite->m_hWnd;
  139. return ResultFromScode(S_OK);
  140. }
  141. //**********************************************************************
  142. //
  143. // COleInPlaceFrame::ContextSensitiveHelp
  144. //
  145. // Purpose:
  146. //
  147. // Used in implementing Context sensitive help
  148. //
  149. // Parameters:
  150. //
  151. // BOOL fEnterMode - TRUE if starting Context Sensitive help mode
  152. //
  153. // Return Value:
  154. //
  155. // S_OK
  156. //
  157. // Function Calls:
  158. // Function Location
  159. //
  160. // ResultFromScode OLE API
  161. //
  162. // Comments:
  163. //
  164. // Be sure to read the technotes in the OLE toolkit.
  165. //
  166. //********************************************************************
  167. STDMETHODIMP COleInPlaceFrame::ContextSensitiveHelp (BOOL fEnterMode)
  168. {
  169. TraceMsg(TF_GENERAL, "In IOIPF::ContextSensitiveHelp\r\n");
  170. return ResultFromScode(S_OK);
  171. }
  172. //**********************************************************************
  173. //
  174. // COleInPlaceFrame::GetBorder
  175. //
  176. // Purpose:
  177. //
  178. // Returns the outermost border that frame adornments can be attached
  179. // during InPlace Activation.
  180. //
  181. // Parameters:
  182. //
  183. // LPRECT lprectBorder - return parameter to contain the outermost
  184. // rect for frame adornments
  185. //
  186. // Return Value:
  187. //
  188. // S_OK
  189. //
  190. // Function Calls:
  191. // Function Location
  192. //
  193. // GetClientRect Windows API
  194. // CopyRect Windows API
  195. // ResultFromScode OLE API
  196. //
  197. // Comments:
  198. //
  199. //********************************************************************
  200. STDMETHODIMP COleInPlaceFrame::GetBorder (LPRECT lprectBorder)
  201. {
  202. RECT rect;
  203. TraceMsg(TF_GENERAL, "In IOIPF::GetBorder\r\n");
  204. // get the rect for the entire frame.
  205. GetClientRect(m_pSite->m_hWnd, &rect);
  206. CopyRect(lprectBorder, &rect);
  207. return ResultFromScode(S_OK);
  208. }
  209. //**********************************************************************
  210. //
  211. // COleInPlaceFrame::RequestBorderSpace
  212. //
  213. // Purpose:
  214. //
  215. // Approves/Denies requests for border space during InPlace
  216. // negotiation.
  217. //
  218. // Parameters:
  219. //
  220. // LPCBORDERWIDTHS lpborderwidths - The width in pixels needed on
  221. // each side of the frame.
  222. //
  223. // Return Value:
  224. //
  225. // S_OK
  226. //
  227. // Function Calls:
  228. // Function Location
  229. //
  230. // ResultFromScode OLE API
  231. //
  232. // Comments:
  233. //
  234. // This implementation doesn't care about how much border space
  235. // is used. It always returns S_OK.
  236. //
  237. //********************************************************************
  238. STDMETHODIMP COleInPlaceFrame::RequestBorderSpace (LPCBORDERWIDTHS lpborderwidths)
  239. {
  240. TraceMsg(TF_GENERAL, "In IOIPF::RequestBorderSpace\r\n");
  241. // always approve the request
  242. return ResultFromScode(S_OK);
  243. }
  244. //**********************************************************************
  245. //
  246. // COleInPlaceFrame::SetBorderSpace
  247. //
  248. // Purpose:
  249. //
  250. // The object calls this method when it is actually going to
  251. // start using the border space.
  252. //
  253. // Parameters:
  254. //
  255. // LPCBORDERWIDTHS lpborderwidths - Border space actually being used
  256. // by the object
  257. //
  258. // Return Value:
  259. //
  260. // S_OK
  261. //
  262. // Function Calls:
  263. // Function Location
  264. //
  265. // CConnWizApp::AddFrameLevelTools APP.CPP
  266. // GetClientRect Windows API
  267. // MoveWindow Windows API
  268. // ResultFromScode Windows API
  269. //
  270. // Comments:
  271. //
  272. // This routine could be a little smarter and check to see if
  273. // the object is requesting the entire client area of the
  274. // window.
  275. //
  276. //********************************************************************
  277. STDMETHODIMP COleInPlaceFrame::SetBorderSpace (LPCBORDERWIDTHS lpborderwidths)
  278. {
  279. TraceMsg(TF_GENERAL, "In IOIPF::SetBorderSpace\r\n");
  280. return ResultFromScode(S_OK);
  281. }
  282. //**********************************************************************
  283. //
  284. // COleInPlaceFrame::SetActiveObject
  285. //
  286. // Purpose:
  287. //
  288. //
  289. // Parameters:
  290. //
  291. // LPOLEINPLACEACTIVEOBJECT lpActiveObject - Pointer to the
  292. // objects
  293. // IOleInPlaceActiveObject
  294. // interface
  295. //
  296. //@@WTK WIN32, UNICODE
  297. // //LPCSTR lpszObjName - Name of the object
  298. // LPCOLESTR lpszObjName - Name of the object
  299. //
  300. // Return Value:
  301. //
  302. // S_OK
  303. //
  304. // Function Calls:
  305. // Function Location
  306. //
  307. // IOleInPlaceActiveObject::AddRef Object
  308. // IOleInPlaceActiveObject::Release Object
  309. // ResultFromScode OLE API
  310. //
  311. // Comments:
  312. //
  313. //********************************************************************
  314. //@@WTK WIN32, UNICODE
  315. //STDMETHODIMP COleInPlaceFrame::SetActiveObject (LPOLEINPLACEACTIVEOBJECT lpActiveObject,LPCSTR lpszObjName)
  316. STDMETHODIMP COleInPlaceFrame::SetActiveObject (
  317. LPOLEINPLACEACTIVEOBJECT lpActiveObject,
  318. LPCOLESTR lpszObjName)
  319. {
  320. TraceMsg(TF_GENERAL, "In IOIPF::SetActiveObject\r\n");
  321. return ResultFromScode(S_OK);
  322. }
  323. //**********************************************************************
  324. //
  325. // COleInPlaceFrame::InsertMenus
  326. //
  327. // Purpose:
  328. //
  329. // Inserts the container menu into the combined menu
  330. //
  331. // Parameters:
  332. //
  333. // HMENU hmenuShared - Menu Handle to be set.
  334. // LPOLEMENUGROUPWIDTHS lpMenuWidths - Width of menus
  335. //
  336. // Return Value:
  337. //
  338. // Function Calls:
  339. // Function Location
  340. //
  341. // AppendMenu Windows API
  342. // ResultFromScode OLE API
  343. //
  344. // Comments:
  345. //
  346. //********************************************************************
  347. STDMETHODIMP COleInPlaceFrame::InsertMenus (HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
  348. {
  349. TraceMsg(TF_GENERAL, "In IOIPF::InsertMenus\r\n");
  350. return ResultFromScode(S_OK);
  351. }
  352. //**********************************************************************
  353. //
  354. // COleInPlaceFrame::SetMenu
  355. //
  356. // Purpose:
  357. //
  358. // Sets the application menu to the combined menu
  359. //
  360. // Parameters:
  361. //
  362. // HMENU hmenuShared - The combined menu
  363. //
  364. // HOLEMENU holemenu - Used by OLE
  365. //
  366. // HWND hwndActiveObject - Used by OLE
  367. //
  368. // Return Value:
  369. //
  370. // S_OK
  371. //
  372. // Function Calls:
  373. // Function Location
  374. //
  375. // SetMenu Windows API
  376. // OleSetMenuDescriptor OLE API
  377. // ResultFromScode OLE API
  378. //
  379. // Comments:
  380. //
  381. //********************************************************************
  382. STDMETHODIMP COleInPlaceFrame::SetMenu (HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
  383. {
  384. TraceMsg(TF_GENERAL, "In IOIPF::SetMenu\r\n");
  385. return ResultFromScode(S_OK);
  386. }
  387. //**********************************************************************
  388. //
  389. // COleInPlaceFrame::RemoveMenus
  390. //
  391. // Purpose:
  392. //
  393. // Removes the container menus from the combined menu
  394. //
  395. // Parameters:
  396. //
  397. // HMENU hmenuShared - Handle to the combined menu.
  398. //
  399. // Return Value:
  400. //
  401. // S_OK
  402. //
  403. // Function Calls:
  404. // Function Location
  405. //
  406. // GetMenuItemCount Windows API
  407. // RemoveMenu Windows API
  408. // ResultFromScode OLE API
  409. //
  410. // Comments:
  411. //
  412. //********************************************************************
  413. STDMETHODIMP COleInPlaceFrame::RemoveMenus (HMENU hmenuShared)
  414. {
  415. return ResultFromScode(S_OK);
  416. }
  417. //**********************************************************************
  418. //
  419. // COleInPlaceFrame::SetStatusText
  420. //
  421. // Purpose:
  422. //
  423. // Not Implemented
  424. //
  425. // Parameters:
  426. //
  427. // Not Implemented
  428. //
  429. // Return Value:
  430. //
  431. // Not Implemented
  432. //
  433. // Function Calls:
  434. // Function Location
  435. //
  436. //
  437. // Comments:
  438. //
  439. // This function is not implemented due to the fact
  440. // that this application does not have a status bar.
  441. //
  442. //********************************************************************
  443. //@@WTK WIN32, UNICODE
  444. //STDMETHODIMP COleInPlaceFrame::SetStatusText (LPCSTR lpszStatusText)
  445. STDMETHODIMP COleInPlaceFrame::SetStatusText (LPCOLESTR lpszStatusText)
  446. {
  447. return ResultFromScode(E_FAIL);
  448. }
  449. //**********************************************************************
  450. //
  451. // COleInPlaceFrame::EnableModeless
  452. //
  453. // Purpose:
  454. //
  455. // Enables/Disables container modeless dialogs
  456. //
  457. // Parameters:
  458. //
  459. // BOOL fEnable - Enable/Disable
  460. //
  461. // Return Value:
  462. //
  463. // S_OK
  464. //
  465. // Function Calls:
  466. // Function Location
  467. //
  468. //
  469. // Comments:
  470. //
  471. // There are no modeless dialogs in this application, so the
  472. // implementation of this method is trivial.
  473. //
  474. //********************************************************************
  475. STDMETHODIMP COleInPlaceFrame::EnableModeless (BOOL fEnable)
  476. {
  477. TraceMsg(TF_GENERAL, "In IOIPF::EnableModeless\r\n");
  478. return ResultFromScode(S_OK);
  479. }
  480. //**********************************************************************
  481. //
  482. // COleInPlaceFrame::TranslateAccelerator
  483. //
  484. // Purpose:
  485. //
  486. // Not Implemented
  487. //
  488. // Parameters:
  489. //
  490. // Not Implemented
  491. //
  492. // Return Value:
  493. //
  494. // Not Implemented
  495. //
  496. // Function Calls:
  497. // Function Location
  498. //
  499. //
  500. // Comments:
  501. //
  502. // Not Implemented
  503. //
  504. //********************************************************************
  505. STDMETHODIMP COleInPlaceFrame::TranslateAccelerator (LPMSG lpmsg, WORD wID)
  506. {
  507. TraceMsg(TF_GENERAL, "In IOIPF::TranslateAccelerator\r\n");
  508. return ResultFromScode(S_FALSE);
  509. }