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.

1082 lines
25 KiB

  1. //**********************************************************************
  2. // File name: IOO.CPP
  3. //
  4. // Implementation file for the COleObject Class
  5. //
  6. // Functions:
  7. //
  8. // See ioo.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 "ioo.h"
  15. #include "app.h"
  16. #include "doc.h"
  17. #define VERB_OPEN 1
  18. //**********************************************************************
  19. //
  20. // COleObject::QueryInterface
  21. //
  22. // Purpose:
  23. //
  24. //
  25. // Parameters:
  26. //
  27. // REFIID riid - Interface being queried for.
  28. //
  29. // LPVOID FAR *ppvObj - Out pointer for the interface.
  30. //
  31. // Return Value:
  32. //
  33. // S_OK - Success
  34. // E_NOINTERFACE - Failure
  35. //
  36. // Function Calls:
  37. // Function Location
  38. //
  39. // CSimpSvrObj::QueryInterface OBJ.CPP
  40. //
  41. // Comments:
  42. //
  43. //
  44. //********************************************************************
  45. STDMETHODIMP COleObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
  46. {
  47. TestDebugOut("In COleObject::QueryInterface\r\n");
  48. return m_lpObj->QueryInterface(riid, ppvObj);
  49. }
  50. //**********************************************************************
  51. //
  52. // COleObject::AddRef
  53. //
  54. // Purpose:
  55. //
  56. // Increments the reference count on COleObject and the "object"
  57. // object.
  58. //
  59. // Parameters:
  60. //
  61. // None
  62. //
  63. // Return Value:
  64. //
  65. // The Reference count on the 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) COleObject::AddRef ()
  78. {
  79. TestDebugOut("In COleObject::AddRef\r\n");
  80. ++m_nCount;
  81. return m_lpObj->AddRef();
  82. }
  83. //**********************************************************************
  84. //
  85. // COleObject::Release
  86. //
  87. // Purpose:
  88. //
  89. // Decrements the reference count of COleObject and the
  90. // "object" object.
  91. //
  92. // Parameters:
  93. //
  94. // None
  95. //
  96. // Return Value:
  97. //
  98. // The new reference count
  99. //
  100. // Function Calls:
  101. // Function Location
  102. //
  103. // TestDebugOut Windows API
  104. // CSimpSvrObj::Release OBJ.CPP
  105. //
  106. // Comments:
  107. //
  108. //
  109. //********************************************************************
  110. STDMETHODIMP_(ULONG) COleObject::Release ()
  111. {
  112. TestDebugOut("In COleObject::Release\r\n");
  113. --m_nCount;
  114. return m_lpObj->Release();
  115. }
  116. //**********************************************************************
  117. //
  118. // COleObject::SetClientSite
  119. //
  120. // Purpose:
  121. //
  122. // Called to notify the object of it's client site.
  123. //
  124. // Parameters:
  125. //
  126. // LPOLECLIENTSITE pClientSite - ptr to new client site
  127. //
  128. // Return Value:
  129. //
  130. // S_OK
  131. //
  132. // Function Calls:
  133. // Function Location
  134. //
  135. // TestDebugOut Windows API
  136. // IOleClientSite::Release Container
  137. // IOleClientSite::AddRef Container
  138. //
  139. // Comments:
  140. //
  141. //
  142. //********************************************************************
  143. STDMETHODIMP COleObject::SetClientSite ( LPOLECLIENTSITE pClientSite)
  144. {
  145. TestDebugOut("In COleObject::SetClientSite\r\n");
  146. // if we already have a client site, release it.
  147. if (m_lpObj->m_lpOleClientSite)
  148. {
  149. m_lpObj->m_lpOleClientSite->Release();
  150. m_lpObj->m_lpOleClientSite = NULL;
  151. }
  152. // store copy of the client site.
  153. m_lpObj->m_lpOleClientSite = pClientSite;
  154. // AddRef it so it doesn't go away.
  155. if (m_lpObj->m_lpOleClientSite)
  156. m_lpObj->m_lpOleClientSite->AddRef();
  157. return ResultFromScode(S_OK);
  158. }
  159. //**********************************************************************
  160. //
  161. // COleObject::Advise
  162. //
  163. // Purpose:
  164. //
  165. // Called to set up an advise on the OLE object.
  166. //
  167. // Parameters:
  168. //
  169. // LPADVISESINK pAdvSink - ptr to the Advise Sink for notification
  170. //
  171. // DWORD FAR* pdwConnection - place to return the connection ID.
  172. //
  173. // Return Value:
  174. //
  175. // Passed back from IOleAdviseHolder::Advise.
  176. //
  177. // Function Calls:
  178. // Function Location
  179. //
  180. // TestDebugOut Windows API
  181. // CreateOleAdviseHolder OLE API
  182. // IOleAdviseHolder::Advise OLE
  183. //
  184. // Comments:
  185. //
  186. //
  187. //********************************************************************
  188. STDMETHODIMP COleObject::Advise ( LPADVISESINK pAdvSink, DWORD FAR* pdwConnection)
  189. {
  190. TestDebugOut("In COleObject::Advise\r\n");
  191. // if we haven't made an OleAdviseHolder yet, make one.
  192. if (!m_lpObj->m_lpOleAdviseHolder)
  193. CreateOleAdviseHolder(&m_lpObj->m_lpOleAdviseHolder);
  194. // pass this call onto the OleAdviseHolder.
  195. return m_lpObj->m_lpOleAdviseHolder->Advise(pAdvSink, pdwConnection);
  196. }
  197. //**********************************************************************
  198. //
  199. // COleObject::SetHostNames
  200. //
  201. // Purpose:
  202. //
  203. // Called to pass strings for Window titles.
  204. //
  205. // Parameters:
  206. //
  207. // LPCSTR szContainerApp - ptr to string describing Container App
  208. //
  209. // LPCSTR szContainerObj - ptr to string describing Object
  210. //
  211. // Return Value:
  212. //
  213. // S_OK
  214. //
  215. // Function Calls:
  216. // Function Location
  217. //
  218. // TestDebugOut Windows API
  219. //
  220. // Comments:
  221. //
  222. // This routine is called so that the server application can
  223. // set the window title appropriately.
  224. //
  225. //********************************************************************
  226. STDMETHODIMP COleObject::SetHostNames ( LPCSTR szContainerApp, LPCSTR szContainerObj)
  227. {
  228. TestDebugOut("In COleObject::SetHostNames\r\n");
  229. return ResultFromScode( S_OK);
  230. };
  231. //**********************************************************************
  232. //
  233. // COleObject::DoVerb
  234. //
  235. // Purpose:
  236. //
  237. // Called by the container application to invoke a verb.
  238. //
  239. // Parameters:
  240. //
  241. // LONG iVerb - The value of the verb to be
  242. // invoked.
  243. //
  244. // LPMSG lpmsg - The message that caused the
  245. // verb to be invoked.
  246. //
  247. // LPOLECLIENTSITE pActiveSite - Ptr to the active client site.
  248. //
  249. // LONG lindex - Used in extended layout
  250. //
  251. // HWND hwndParent - This should be the window handle of
  252. // the window in which we are contained.
  253. // This value could be used to "fake"
  254. // inplace activation in a manner similar
  255. // to Video for Windows in OLE 1.0.
  256. //
  257. // LPCRECT lprcPosRect - The rectangle that contains the object
  258. // within hwndParent. Also used to
  259. // "fake" inplace activation.
  260. //
  261. // Return Value:
  262. //
  263. // OLE_E_NOTINPLACEACTIVE - Returned if attempted to undo while not
  264. // inplace active.
  265. // S_OK
  266. //
  267. // Function Calls:
  268. // Function Location
  269. //
  270. // TestDebugOut Windows API
  271. // ShowWindow Windows API
  272. // CSimpSvrObj::DoInPlaceActivate OBJ.CPP
  273. // CSimpSvrObj::DoInPlaceHide OBJ.CPP
  274. // COleObject::OpenEdit IOO.CPP
  275. // CSimpSvrDoc::GethDocWnd DOC.H
  276. // COleInPlaceObj::InPlaceDeactivate IOIPO.CPP
  277. //
  278. // Comments:
  279. //
  280. // Be sure to look at TECHNOTES.WRI included with the OLE
  281. // SDK for a description of handling the inplace verbs
  282. // properly.
  283. //
  284. //********************************************************************
  285. STDMETHODIMP COleObject::DoVerb ( LONG iVerb,
  286. LPMSG lpmsg,
  287. LPOLECLIENTSITE pActiveSite,
  288. LONG lindex,
  289. HWND hwndParent,
  290. LPCRECT lprcPosRect)
  291. {
  292. TestDebugOut("In COleObject::DoVerb\r\n");
  293. switch (iVerb)
  294. {
  295. case OLEIVERB_SHOW:
  296. case OLEIVERB_PRIMARY:
  297. if (m_fOpen)
  298. SetFocus(m_lpObj->m_lpDoc->GethAppWnd());
  299. else if (m_lpObj->DoInPlaceActivate(iVerb) == FALSE)
  300. OpenEdit(pActiveSite);
  301. break;
  302. case OLEIVERB_UIACTIVATE:
  303. if (m_fOpen)
  304. return ResultFromScode (E_FAIL);
  305. // inplace activate
  306. if (!m_lpObj->DoInPlaceActivate(iVerb))
  307. return ResultFromScode (E_FAIL);
  308. break;
  309. case OLEIVERB_DISCARDUNDOSTATE:
  310. // don't have to worry about this situation as we don't
  311. // support an undo state.
  312. if (!m_lpObj->m_fInPlaceActive)
  313. return ResultFromScode(OLE_E_NOT_INPLACEACTIVE);
  314. break;
  315. case OLEIVERB_HIDE:
  316. // if inplace active, do an "inplace" hide, otherwise
  317. // just hide the app window.
  318. if (m_lpObj->m_fInPlaceActive)
  319. {
  320. m_lpObj->DeactivateUI();
  321. m_lpObj->DoInPlaceHide();
  322. }
  323. else
  324. m_lpObj->m_lpDoc->GetApp()->HideAppWnd();
  325. break;
  326. case OLEIVERB_OPEN:
  327. case VERB_OPEN:
  328. // if inplace active, deactivate
  329. if (m_lpObj->m_fInPlaceActive)
  330. m_lpObj->m_OleInPlaceObject.InPlaceDeactivate();
  331. // open into another window.
  332. OpenEdit(pActiveSite);
  333. break;
  334. default:
  335. if (iVerb < 0)
  336. return ResultFromScode(E_FAIL);
  337. }
  338. return ResultFromScode( S_OK);
  339. };
  340. //**********************************************************************
  341. //
  342. // COleObject::GetExtent
  343. //
  344. // Purpose:
  345. //
  346. // Returns the extent of the object.
  347. //
  348. // Parameters:
  349. //
  350. // DWORD dwDrawAspect - The aspect in which to get the size.
  351. //
  352. // LPSIZEL lpsizel - Out ptr to return the size.
  353. //
  354. // Return Value:
  355. //
  356. //
  357. //
  358. // Function Calls:
  359. // Function Location
  360. //
  361. // TestDebugOut Windows API
  362. // XformWidthInPixelsToHimetric OLE2UI
  363. // XformHeightInPixelsToHimetric OLE2UI
  364. //
  365. // Comments:
  366. //
  367. //
  368. //********************************************************************
  369. STDMETHODIMP COleObject::GetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel)
  370. {
  371. TestDebugOut("In COleObject::GetExtent\r\n");
  372. SCODE sc = E_FAIL;
  373. // Only DVASPECT_CONTENT is supported....
  374. if (dwDrawAspect == DVASPECT_CONTENT)
  375. {
  376. sc = S_OK;
  377. // return the correct size in HIMETRIC...
  378. lpsizel->cx = XformWidthInPixelsToHimetric(NULL, m_lpObj->m_size.x);
  379. lpsizel->cy = XformHeightInPixelsToHimetric(NULL, m_lpObj->m_size.y);
  380. }
  381. return ResultFromScode( sc );
  382. };
  383. //**********************************************************************
  384. //
  385. // COleObject::Update
  386. //
  387. // Purpose:
  388. //
  389. // Called to get the most up to date data
  390. //
  391. // Parameters:
  392. //
  393. // None
  394. //
  395. // Return Value:
  396. //
  397. // S_OK
  398. //
  399. // Function Calls:
  400. // Function Location
  401. //
  402. // TestDebugOut Windows API
  403. // IDataAdviseHolder::SendOnDataChange OLE
  404. //
  405. // Comments:
  406. //
  407. //
  408. //********************************************************************
  409. STDMETHODIMP COleObject::Update()
  410. {
  411. TestDebugOut("In COleObject::Update\r\n");
  412. // force an update
  413. m_lpObj->SendOnDataChange();
  414. return ResultFromScode( S_OK );
  415. };
  416. //**********************************************************************
  417. //
  418. // COleObject::Close
  419. //
  420. // Purpose:
  421. //
  422. // Called when the OLE object needs to be closed
  423. //
  424. // Parameters:
  425. //
  426. // DWORD dwSaveOption - Flags to instruct the server how to prompt
  427. // the user.
  428. //
  429. // Return Value:
  430. //
  431. // S_OK
  432. //
  433. // Function Calls:
  434. // Function Location
  435. //
  436. // TestDebugOut Windows API
  437. // CSimpSvrDoc::Close DOC.CPP
  438. //
  439. // Comments:
  440. //
  441. //
  442. //********************************************************************
  443. STDMETHODIMP COleObject::Close ( DWORD dwSaveOption)
  444. {
  445. TestDebugOut("In COleObject::Close\r\n");
  446. // delegate to the document object.
  447. m_lpObj->m_lpDoc->Close();
  448. return ResultFromScode( S_OK );
  449. };
  450. //**********************************************************************
  451. //
  452. // COleObject::Unadvise
  453. //
  454. // Purpose:
  455. //
  456. // Breaks down an OLE advise that has been set up on this object.
  457. //
  458. // Parameters:
  459. //
  460. // DWORD dwConnection - Connection that needs to be broken down
  461. //
  462. // Return Value:
  463. //
  464. // Passed back from IOleAdviseHolder::Unadvise
  465. //
  466. // Function Calls:
  467. // Function Location
  468. //
  469. // TestDebugOut Windows API
  470. // IOleAdviseHolder::Unadvise OLE
  471. //
  472. // Comments:
  473. //
  474. //
  475. //********************************************************************
  476. STDMETHODIMP COleObject::Unadvise ( DWORD dwConnection)
  477. {
  478. TestDebugOut("In COleObject::Unadvise\r\n");
  479. // pass on to OleAdviseHolder.
  480. return m_lpObj->m_lpOleAdviseHolder->Unadvise(dwConnection);
  481. };
  482. //**********************************************************************
  483. //
  484. // COleObject::EnumVerbs
  485. //
  486. // Purpose:
  487. //
  488. // Enumerates the verbs associated with this object.
  489. //
  490. // Parameters:
  491. //
  492. // LPENUMOLEVERB FAR* ppenumOleVerb - Out ptr in which to return
  493. // the enumerator
  494. //
  495. // Return Value:
  496. //
  497. // OLE_S_USEREG - Instructs OLE to use the verbs found in the
  498. // REG DB for this server.
  499. //
  500. // Function Calls:
  501. // Function Location
  502. //
  503. // TestDebugOut Windows API
  504. //
  505. // Comments:
  506. //
  507. // In a .DLL, an application cannot return OLE_S_USEREG. This is
  508. // due to the fact that the default object handler is not being
  509. // used, and the container is really making direct function calls
  510. // into the server .DLL.
  511. //
  512. //********************************************************************
  513. STDMETHODIMP COleObject::EnumVerbs ( LPENUMOLEVERB FAR* ppenumOleVerb)
  514. {
  515. TestDebugOut("In COleObject::EnumVerbs\r\n");
  516. return ResultFromScode( OLE_S_USEREG );
  517. };
  518. //**********************************************************************
  519. //
  520. // COleObject::GetClientSite
  521. //
  522. // Purpose:
  523. //
  524. // Called to get the current client site of the object.
  525. //
  526. // Parameters:
  527. //
  528. // LPOLECLIENTSITE FAR* ppClientSite - Out ptr in which to return the
  529. // client site.
  530. //
  531. // Return Value:
  532. //
  533. // S_OK
  534. //
  535. // Function Calls:
  536. // Function Location
  537. //
  538. // TestDebugOut Windows API
  539. //
  540. // Comments:
  541. //
  542. //
  543. //********************************************************************
  544. STDMETHODIMP COleObject::GetClientSite ( LPOLECLIENTSITE FAR* ppClientSite)
  545. {
  546. TestDebugOut("In COleObject::GetClientSite\r\n");
  547. *ppClientSite = m_lpObj->m_lpOleClientSite;
  548. return ResultFromScode( S_OK );
  549. }
  550. //**********************************************************************
  551. //
  552. // COleObject::SetMoniker
  553. //
  554. // Purpose:
  555. //
  556. // Used to set the objects moniker
  557. //
  558. // Parameters:
  559. //
  560. // DWORD dwWhichMoniker - Type of moniker being set
  561. //
  562. // LPMONIKER pmk - Pointer to the moniker
  563. //
  564. // Return Value:
  565. //
  566. //
  567. // Function Calls:
  568. // Function Location
  569. //
  570. // TestDebugOut Windows API
  571. //
  572. // Comments:
  573. //
  574. //
  575. //********************************************************************
  576. STDMETHODIMP COleObject::SetMoniker ( DWORD dwWhichMoniker, LPMONIKER pmk)
  577. {
  578. TestDebugOut("In COleObject::SetMoniker\r\n");
  579. LPMONIKER lpmk;
  580. if (! m_lpObj->GetOleClientSite())
  581. return ResultFromScode (E_FAIL);
  582. if (m_lpObj->GetOleClientSite()->GetMoniker (OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, &lpmk) != NOERROR)
  583. return ResultFromScode (E_FAIL);
  584. if (m_lpObj->GetOleAdviseHolder())
  585. m_lpObj->GetOleAdviseHolder()->SendOnRename(lpmk);
  586. LPRUNNINGOBJECTTABLE lpRot;
  587. if (GetRunningObjectTable(0, &lpRot) == NOERROR)
  588. {
  589. if (m_lpObj->m_dwRegister)
  590. lpRot->Revoke(m_lpObj->m_dwRegister);
  591. lpRot->Register(0, m_lpObj, lpmk, &m_lpObj->m_dwRegister);
  592. lpRot->Release();
  593. }
  594. return ResultFromScode( S_OK );
  595. };
  596. //**********************************************************************
  597. //
  598. // COleObject::GetMoniker
  599. //
  600. // Purpose:
  601. //
  602. ////
  603. // Parameters:
  604. //
  605. // DWORD dwAssign - Assignment for the moniker
  606. //
  607. // DWORD dwWhichMoniker - Which moniker to return
  608. //
  609. // LPMONIKER FAR* ppmk - An out ptr to return the moniker
  610. //
  611. // Return Value:
  612. //
  613. //
  614. // Function Calls:
  615. // Function Location
  616. //
  617. // TestDebugOut Windows API
  618. //
  619. // Comments:
  620. //
  621. //
  622. //********************************************************************
  623. STDMETHODIMP COleObject::GetMoniker ( DWORD dwAssign, DWORD dwWhichMoniker,
  624. LPMONIKER FAR* ppmk)
  625. {
  626. TestDebugOut("In COleObject::GetMoniker\r\n");
  627. // need to NULL the out parameter
  628. *ppmk = NULL;
  629. return m_lpObj->GetOleClientSite()->GetMoniker (OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, ppmk);
  630. };
  631. //**********************************************************************
  632. //
  633. // COleObject::InitFromData
  634. //
  635. // Purpose:
  636. //
  637. // Initialize the object from the passed pDataObject.
  638. //
  639. // Parameters:
  640. //
  641. // LPDATAOBJECT pDataObject - Pointer to data transfer object
  642. // to be used in the initialization
  643. //
  644. // BOOL fCreation - TRUE if the object is currently being
  645. // created.
  646. //
  647. // DWORD dwReserved - Reserved
  648. //
  649. // Return Value:
  650. //
  651. // S_FALSE
  652. //
  653. // Function Calls:
  654. // Function Location
  655. //
  656. // TestDebugOut Windows API
  657. //
  658. // Comments:
  659. //
  660. // We don't support this functionality, so we will always return
  661. // error.
  662. //
  663. //********************************************************************
  664. STDMETHODIMP COleObject::InitFromData ( LPDATAOBJECT pDataObject,
  665. BOOL fCreation,
  666. DWORD dwReserved)
  667. {
  668. TestDebugOut("In COleObject::InitFromData\r\n");
  669. return ResultFromScode( S_FALSE );
  670. };
  671. //**********************************************************************
  672. //
  673. // COleObject::GetClipboardData
  674. //
  675. // Purpose:
  676. //
  677. // Returns an IDataObject that is the same as doing an OleSetClipboard
  678. //
  679. // Parameters:
  680. //
  681. // DWORD dwReserved - Reserved
  682. //
  683. // LPDATAOBJECT FAR* ppDataObject - Out ptr for the Data Object.
  684. //
  685. // Return Value:
  686. //
  687. // OLE_E_NOTSUPPORTED
  688. //
  689. // Function Calls:
  690. // Function Location
  691. //
  692. // TestDebugOut Windows API
  693. //
  694. // Comments:
  695. //
  696. // Support of this method is optional.
  697. //
  698. //********************************************************************
  699. STDMETHODIMP COleObject::GetClipboardData ( DWORD dwReserved,
  700. LPDATAOBJECT FAR* ppDataObject)
  701. {
  702. TestDebugOut("In COleObject::GetClipboardData\r\n");
  703. // NULL the out ptr
  704. *ppDataObject = NULL;
  705. return ResultFromScode( E_NOTIMPL );
  706. };
  707. //**********************************************************************
  708. //
  709. // COleObject::IsUpToDate
  710. //
  711. // Purpose:
  712. //
  713. // Determines if an object is up to date
  714. //
  715. // Parameters:
  716. //
  717. // None
  718. //
  719. // Return Value:
  720. //
  721. // S_OK
  722. //
  723. // Function Calls:
  724. // Function Location
  725. //
  726. // TestDebugOut Windows API
  727. //
  728. // Comments:
  729. //
  730. // Our embedded object is always up to date. This function is
  731. // particularly useful in linking situations.
  732. //
  733. //********************************************************************
  734. STDMETHODIMP COleObject::IsUpToDate()
  735. {
  736. TestDebugOut("In COleObject::IsUpToDate\r\n");
  737. return ResultFromScode( S_OK );
  738. };
  739. //**********************************************************************
  740. //
  741. // COleObject::GetUserClassID
  742. //
  743. // Purpose:
  744. //
  745. // Returns the applications CLSID
  746. //
  747. // Parameters:
  748. //
  749. // CLSID FAR* pClsid - Out ptr to return the CLSID
  750. //
  751. // Return Value:
  752. //
  753. // S_OK
  754. //
  755. // Function Calls:
  756. // Function Location
  757. //
  758. // TestDebugOut Windows API
  759. // CPersistStorage::GetClassID IPS.CPP
  760. //
  761. // Comments:
  762. //
  763. // This function is just delegated to IPS::GetClassID.
  764. //
  765. //********************************************************************
  766. STDMETHODIMP COleObject::GetUserClassID ( CLSID FAR* pClsid)
  767. {
  768. TestDebugOut("In COleObject::GetUserClassID\r\n");
  769. m_lpObj->m_PersistStorage.GetClassID(pClsid);
  770. return ResultFromScode( S_OK );
  771. };
  772. //**********************************************************************
  773. //
  774. // COleObject::GetUserType
  775. //
  776. // Purpose:
  777. //
  778. // Used to get a user presentable id for this object
  779. //
  780. // Parameters:
  781. //
  782. // DWORD dwFormOfType - The ID requested
  783. //
  784. // LPSTR FAR* pszUserType - Out ptr to return the string
  785. //
  786. // Return Value:
  787. //
  788. // OLE_S_USEREG - Use the reg db to get these entries.
  789. //
  790. // Function Calls:
  791. // Function Location
  792. //
  793. // TestDebugOut Windows API
  794. //
  795. // Comments:
  796. //
  797. //
  798. //********************************************************************
  799. STDMETHODIMP COleObject::GetUserType ( DWORD dwFormOfType, LPSTR FAR* pszUserType)
  800. {
  801. TestDebugOut("In COleObject::GetUserType\r\n");
  802. return ResultFromScode( OLE_S_USEREG );
  803. };
  804. //**********************************************************************
  805. //
  806. // COleObject::SetExtent
  807. //
  808. // Purpose:
  809. //
  810. // Called to set the extent of the object.
  811. //
  812. // Parameters:
  813. //
  814. // DWORD dwDrawAspect - Aspect to have its size set
  815. //
  816. // LPSIZEL lpsizel - New size of the object.
  817. //
  818. // Return Value:
  819. //
  820. // E_NOTIMPL - This function is not curently implemented.
  821. //
  822. // Function Calls:
  823. // Function Location
  824. //
  825. // TestDebugOut Windows API
  826. //
  827. // Comments:
  828. //
  829. //
  830. //********************************************************************
  831. STDMETHODIMP COleObject::SetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel)
  832. {
  833. TestDebugOut("In COleObject::SetExtent\r\n");
  834. return ResultFromScode( E_NOTIMPL);
  835. };
  836. //**********************************************************************
  837. //
  838. // COleObject::EnumAdvise
  839. //
  840. // Purpose:
  841. //
  842. // Returns an enumerate which enumerates the outstanding advises
  843. // associated with this OLE object.
  844. //
  845. // Parameters:
  846. //
  847. // LPENUMSTATDATA FAR* ppenumAdvise - Out ptr in which to return
  848. // the enumerator.
  849. //
  850. // Return Value:
  851. //
  852. // Passed on from IOleAdviseHolder::EnumAdvise.
  853. //
  854. // Function Calls:
  855. // Function Location
  856. //
  857. // TestDebugOut Windows API
  858. // IOleAdviseHolder::EnumAdvise OLE
  859. //
  860. // Comments:
  861. //
  862. //
  863. //********************************************************************
  864. STDMETHODIMP COleObject::EnumAdvise ( LPENUMSTATDATA FAR* ppenumAdvise)
  865. {
  866. TestDebugOut("In COleObject::EnumAdvise\r\n");
  867. // need to NULL the out parameter
  868. *ppenumAdvise = NULL;
  869. // pass on to the OLE Advise holder.
  870. return m_lpObj->m_lpOleAdviseHolder->EnumAdvise(ppenumAdvise);
  871. };
  872. //**********************************************************************
  873. //
  874. // COleObject::GetMiscStatus
  875. //
  876. // Purpose:
  877. //
  878. // Return status information about the object
  879. //
  880. // Parameters:
  881. //
  882. // DWORD dwAspect - Aspect interested in.
  883. //
  884. // DWORD FAR* pdwStatus - Out ptr in which to return the bits.
  885. //
  886. // Return Value:
  887. //
  888. // CO_E_READREGDB - Tell the library to use the reg DB.
  889. //
  890. // Function Calls:
  891. // Function Location
  892. //
  893. // TestDebugOut Windows API
  894. //
  895. // Comments:
  896. //
  897. //
  898. //********************************************************************
  899. STDMETHODIMP COleObject::GetMiscStatus ( DWORD dwAspect, DWORD FAR* pdwStatus)
  900. {
  901. TestDebugOut("In COleObject::GetMiscStatus\r\n");
  902. // need to NULL the out parameter
  903. *pdwStatus = NULL;
  904. return ResultFromScode( OLE_S_USEREG );
  905. };
  906. //**********************************************************************
  907. //
  908. // COleObject::SetColorScheme
  909. //
  910. // Purpose:
  911. //
  912. // Used to set the palette for the object to use.
  913. //
  914. // Parameters:
  915. //
  916. // LPLOGPALETTE lpLogpal - Pointer to the LOGPALETTE to be used.
  917. //
  918. // Return Value:
  919. //
  920. // S_OK
  921. //
  922. // Function Calls:
  923. // Function Location
  924. //
  925. // TestDebugOut Windows API
  926. //
  927. // Comments:
  928. //
  929. // This server ignores this method.
  930. //
  931. //********************************************************************
  932. STDMETHODIMP COleObject::SetColorScheme ( LPLOGPALETTE lpLogpal)
  933. {
  934. TestDebugOut("In COleObject::SetColorScheme\r\n");
  935. return ResultFromScode( S_OK );
  936. };
  937. //**********************************************************************
  938. //
  939. // COleObject::OpenEdit
  940. //
  941. // Purpose:
  942. //
  943. // Used to Open the object into a seperate window.
  944. //
  945. // Parameters:
  946. //
  947. // LPOLECLIENTSITE pActiveSite - Pointer to the Active clientsite.
  948. //
  949. // Return Value:
  950. //
  951. // None.
  952. //
  953. // Function Calls:
  954. // Function Location
  955. //
  956. // IOleClientSite::OnShowWindow Container
  957. // ShowWindow Windows API
  958. // UpdateWindow Windows API
  959. // TestDebugOut Windows API
  960. // CSimpSvrDoc::GethAppWnd DOC.H
  961. // CSimpSvrDoc::GethHatchWnd DOC.H
  962. //
  963. // Comments:
  964. //
  965. //
  966. //********************************************************************
  967. void COleObject::OpenEdit(LPOLECLIENTSITE pActiveSite)
  968. {
  969. if (m_lpObj->GetOleClientSite())
  970. m_lpObj->GetOleClientSite()->ShowObject();
  971. m_fOpen = TRUE;
  972. // tell the site we are opening so the object can be hatched out.
  973. if (m_lpObj->GetOleClientSite())
  974. m_lpObj->GetOleClientSite()->OnShowWindow(TRUE);
  975. m_lpObj->m_lpDoc->ShowDocWnd();
  976. m_lpObj->m_lpDoc->HideHatchWnd();
  977. // Show app window.
  978. m_lpObj->m_lpDoc->GetApp()->ShowAppWnd();
  979. SetFocus(m_lpObj->m_lpDoc->GethAppWnd());
  980. }