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.

1646 lines
43 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. compont.cpp
  7. base classes for IComponent
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "compont.h"
  12. #include "compdata.h"
  13. #include "extract.h"
  14. #include "proppage.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. IMPLEMENT_ADDREF_RELEASE(TFSComponent)
  21. STDMETHODIMP TFSComponent::QueryInterface(REFIID riid, LPVOID *ppv)
  22. {
  23. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  24. // Is the pointer bad?
  25. if (ppv == NULL)
  26. return E_INVALIDARG;
  27. // Place NULL in *ppv in case of failure
  28. *ppv = NULL;
  29. // This is the non-delegating IUnknown implementation
  30. if (riid == IID_IUnknown)
  31. *ppv = (LPVOID) this;
  32. else if (riid == IID_IComponent)
  33. *ppv = (IComponent *) this;
  34. else if (riid == IID_IExtendPropertySheet)
  35. *ppv = (IExtendPropertySheet *) this;
  36. else if (riid == IID_IExtendPropertySheet2)
  37. *ppv = (IExtendPropertySheet2 *) this;
  38. else if (riid == IID_IExtendContextMenu)
  39. *ppv = (IExtendContextMenu *) this;
  40. else if (riid == IID_IExtendControlbar)
  41. *ppv = (IExtendControlbar *) this;
  42. else if (riid == IID_IResultDataCompare)
  43. *ppv = (IResultDataCompare *) this;
  44. else if ( riid == IID_IResultDataCompareEx)
  45. *ppv = ( IResultDataCompareEx * ) this;
  46. else if (riid == IID_IResultOwnerData)
  47. *ppv = (IResultOwnerData *) this;
  48. else if (riid == IID_IExtendTaskPad)
  49. *ppv = (IExtendTaskPad *) this;
  50. else if (riid == IID_ITFSComponent)
  51. *ppv = (ITFSComponent *) this;
  52. // If we're going to return an interface, AddRef it first
  53. if (*ppv)
  54. {
  55. ((LPUNKNOWN) *ppv)->AddRef();
  56. return hrOK;
  57. }
  58. else
  59. return E_NOINTERFACE;
  60. }
  61. /*---------------------------------------------------------------------------
  62. TFSComponent's IComponent implementation
  63. ---------------------------------------------------------------------------*/
  64. /*!--------------------------------------------------------------------------
  65. TFSComponent::Initialize
  66. Implementation of IComponent::Initialize
  67. MMC calls this to initalize the IComponent interface
  68. Author:
  69. ---------------------------------------------------------------------------*/
  70. STDMETHODIMP
  71. TFSComponent::Initialize
  72. (
  73. LPCONSOLE lpConsole
  74. )
  75. {
  76. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  77. Assert(lpConsole != NULL);
  78. HRESULT hr = hrOK;
  79. COM_PROTECT_TRY
  80. {
  81. // Save the IConsole pointer
  82. //m_spConsole.Set(lpConsole);
  83. hr = lpConsole->QueryInterface(IID_IConsole2,
  84. reinterpret_cast<void**>(&m_spConsole));
  85. Assert(hr == S_OK);
  86. // QI for a IHeaderCtrl
  87. m_spConsole->QueryInterface(IID_IHeaderCtrl,
  88. reinterpret_cast<void**>(&m_spHeaderCtrl));
  89. // Give the console the header control interface pointer
  90. if (SUCCEEDED(hr))
  91. m_spConsole->SetHeader(m_spHeaderCtrl);
  92. m_spConsole->QueryInterface(IID_IResultData,
  93. reinterpret_cast<void**>(&m_spResultData));
  94. hr = m_spConsole->QueryResultImageList(&m_spImageList);
  95. Assert(hr == S_OK);
  96. hr = m_spConsole->QueryConsoleVerb(&m_spConsoleVerb);
  97. Assert(hr == S_OK);
  98. }
  99. COM_PROTECT_CATCH
  100. return S_OK;
  101. }
  102. /*!--------------------------------------------------------------------------
  103. TFSComponent::Notify
  104. Implementation of IComponent::Notify
  105. All event notification for the IComponent interface happens here
  106. Author:
  107. ---------------------------------------------------------------------------*/
  108. STDMETHODIMP
  109. TFSComponent::Notify
  110. (
  111. LPDATAOBJECT lpDataObject,
  112. MMC_NOTIFY_TYPE event,
  113. LPARAM arg,
  114. LPARAM param
  115. )
  116. {
  117. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  118. HRESULT hr = S_OK;
  119. LONG_PTR cookie;
  120. SPITFSNode spNode;
  121. SPITFSResultHandler spResultHandler;
  122. SPIDataObject spDataObject;
  123. COM_PROTECT_TRY
  124. {
  125. // Handle MMC special dataobjects.
  126. // lDataObject == NULL is what we get for property change
  127. // notifications, so we have to let those pass through
  128. if (lpDataObject && IS_SPECIAL_DATAOBJECT(lpDataObject))
  129. {
  130. // get a data object for the selected node.
  131. GetSelectedNode(&spNode);
  132. if (!spNode)
  133. {
  134. CORg(E_FAIL);
  135. }
  136. //kmurthy: for bug 477315: following did not seem to work
  137. // CORg(QueryDataObject((MMC_COOKIE) spNode->GetData(TFS_DATA_COOKIE), CCT_RESULT, &spDataObject));
  138. // so changed to this.
  139. CORg(m_spComponentData->QueryDataObject((MMC_COOKIE) spNode->GetData(TFS_DATA_COOKIE), CCT_RESULT, &spDataObject));
  140. spNode.Release();
  141. lpDataObject = spDataObject;
  142. }
  143. if (event == MMCN_PROPERTY_CHANGE)
  144. {
  145. Trace0("CComponent::Notify got MMCN_PROPERTY_CHANGE\n");
  146. hr = OnNotifyPropertyChange(lpDataObject, event, arg, param);
  147. if (hr != E_NOTIMPL)
  148. {
  149. return hr;
  150. }
  151. CPropertyPageHolderBase * pHolder =
  152. reinterpret_cast<CPropertyPageHolderBase *>(param);
  153. spNode = pHolder->GetNode();
  154. cookie = spNode->GetData(TFS_DATA_COOKIE);
  155. CORg( spNode->GetResultHandler(&spResultHandler) );
  156. if (spResultHandler)
  157. CORg( spResultHandler->Notify(this, cookie, lpDataObject, event, arg, param) );
  158. }
  159. else if (event == MMCN_VIEW_CHANGE)
  160. {
  161. hr = OnUpdateView(lpDataObject, arg, param);
  162. }
  163. else if (event == MMCN_DESELECT_ALL)
  164. {
  165. hr = OnDeselectAll(lpDataObject, arg, param);
  166. }
  167. else if (event == MMCN_ADD_IMAGES)
  168. {
  169. SPINTERNAL spInternal;
  170. spInternal = ::ExtractInternalFormat(lpDataObject);
  171. if (spInternal &&
  172. spInternal->m_cookie == MMC_MULTI_SELECT_COOKIE)
  173. {
  174. GetSelectedNode(&spNode);
  175. }
  176. else
  177. {
  178. spInternal.Free();
  179. CORg(ExtractNodeFromDataObject(m_spNodeMgr,
  180. m_spTFSComponentData->GetCoClassID(),
  181. lpDataObject,
  182. FALSE,
  183. &spNode,
  184. NULL,
  185. &spInternal));
  186. }
  187. hr = InitializeBitmaps(spNode->GetData(TFS_DATA_COOKIE));
  188. }
  189. else if (event == MMCN_COLUMN_CLICK)
  190. {
  191. hr = OnColumnClick(lpDataObject, arg, param);
  192. }
  193. else if (event == MMCN_SNAPINHELP)
  194. {
  195. hr = OnSnapinHelp(lpDataObject, arg, param);
  196. }
  197. else
  198. {
  199. DATA_OBJECT_TYPES type = CCT_RESULT;
  200. SPINTERNAL spInternal;
  201. spInternal = ::ExtractInternalFormat(lpDataObject);
  202. if (spInternal &&
  203. spInternal->m_cookie == MMC_MULTI_SELECT_COOKIE)
  204. {
  205. GetSelectedNode(&spNode);
  206. }
  207. else
  208. {
  209. spInternal.Free();
  210. CORg(ExtractNodeFromDataObject(m_spNodeMgr,
  211. m_spTFSComponentData->GetCoClassID(),
  212. lpDataObject,
  213. FALSE,
  214. &spNode,
  215. NULL,
  216. &spInternal));
  217. }
  218. //$ Review (kennt) : if pInternal is NULL, what does this
  219. // mean for the result pane items?
  220. if (spInternal)
  221. type = spInternal->m_type;
  222. cookie = spNode->GetData(TFS_DATA_COOKIE);
  223. CORg( spNode->GetResultHandler(&spResultHandler) );
  224. if (spResultHandler)
  225. CORg( spResultHandler->Notify(this, cookie, lpDataObject, event, arg, param) );
  226. }
  227. COM_PROTECT_ERROR_LABEL;
  228. }
  229. COM_PROTECT_CATCH
  230. return hr;
  231. }
  232. /*!--------------------------------------------------------------------------
  233. TFSComponent::Destroy
  234. Implementation of IComponent::Destroy
  235. Author:
  236. ---------------------------------------------------------------------------*/
  237. STDMETHODIMP
  238. TFSComponent::Destroy
  239. (
  240. MMC_COOKIE cookie
  241. )
  242. {
  243. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  244. HRESULT hr = hrOK;
  245. COM_PROTECT_TRY
  246. {
  247. //$ Review (kennt):
  248. // Does this mean destroy the particular instance of that
  249. // cookie or the entire thing?
  250. // Release the interfaces that we QI'ed
  251. if (m_spConsole)
  252. m_spConsole->SetHeader(NULL);
  253. m_spHeaderCtrl.Release();
  254. m_spResultData.Release();
  255. m_spImageList.Release();
  256. m_spConsoleVerb.Release();
  257. m_spConsole.Release();
  258. m_spControlbar.Release();
  259. m_spToolbar.Release();
  260. }
  261. COM_PROTECT_CATCH
  262. return S_OK;
  263. }
  264. /*!--------------------------------------------------------------------------
  265. TFSComponent::GetResultViewType
  266. Implementation of IComponent::GetResultViewType
  267. This determines what kind result view we use. Use the default.
  268. Author:
  269. ---------------------------------------------------------------------------*/
  270. STDMETHODIMP
  271. TFSComponent::GetResultViewType
  272. (
  273. MMC_COOKIE cookie,
  274. LPOLESTR * ppViewType,
  275. long * pViewOptions
  276. )
  277. {
  278. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  279. SPITFSNode spNode;
  280. SPITFSResultHandler spResultHandler;
  281. HRESULT hr = hrOK;
  282. COM_PROTECT_TRY
  283. {
  284. CORg (m_spNodeMgr->FindNode(cookie, &spNode));
  285. if (spNode == NULL)
  286. goto Error; // no selection for out IComponentData
  287. CORg( spNode->GetResultHandler(&spResultHandler) );
  288. if (spResultHandler)
  289. {
  290. CORg( spResultHandler->OnGetResultViewType(this, spNode->GetData(TFS_DATA_COOKIE), ppViewType, pViewOptions) );
  291. }
  292. else
  293. hr = S_FALSE;
  294. COM_PROTECT_ERROR_LABEL;
  295. }
  296. COM_PROTECT_CATCH
  297. return hr;
  298. }
  299. /*!--------------------------------------------------------------------------
  300. TFSComponent::QueryDataObject
  301. Implementation of IComponent::QueryDataObject
  302. Author:
  303. ---------------------------------------------------------------------------*/
  304. STDMETHODIMP
  305. TFSComponent::QueryDataObject
  306. (
  307. MMC_COOKIE cookie,
  308. DATA_OBJECT_TYPES type,
  309. LPDATAOBJECT* ppDataObject
  310. )
  311. {
  312. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  313. // Delegate it to the IComponentData
  314. Assert(m_spComponentData != NULL);
  315. return m_spComponentData->QueryDataObject(cookie, type, ppDataObject);
  316. }
  317. /*!--------------------------------------------------------------------------
  318. TFSComponent::CompareObjects
  319. Implementation of IComponent::CompareObjects
  320. MMC calls this to compare two objects
  321. Author:
  322. ---------------------------------------------------------------------------*/
  323. STDMETHODIMP
  324. TFSComponent::CompareObjects
  325. (
  326. LPDATAOBJECT lpDataObjectA,
  327. LPDATAOBJECT lpDataObjectB
  328. )
  329. {
  330. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  331. if (lpDataObjectA == NULL || lpDataObjectB == NULL)
  332. return E_POINTER;
  333. // Make sure both data object are mine
  334. SPINTERNAL spA;
  335. SPINTERNAL spB;
  336. HRESULT hr = S_FALSE;
  337. COM_PROTECT_TRY
  338. {
  339. spA = ExtractInternalFormat(lpDataObjectA);
  340. spB = ExtractInternalFormat(lpDataObjectB);
  341. if (spA != NULL && spB != NULL)
  342. hr = (spA->m_cookie == spB->m_cookie) ? S_OK : S_FALSE;
  343. }
  344. COM_PROTECT_CATCH
  345. return hr;
  346. }
  347. /*!--------------------------------------------------------------------------
  348. TFSComponent::GetDisplayInfo
  349. Implementation of IComponent::GetDisplayInfo
  350. Author:
  351. ---------------------------------------------------------------------------*/
  352. STDMETHODIMP
  353. TFSComponent::GetDisplayInfo
  354. (
  355. LPRESULTDATAITEM pResult
  356. )
  357. {
  358. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  359. SPITFSNode spNode;
  360. SPITFSResultHandler spResultHandler;
  361. HRESULT hr = hrOK;
  362. LPOLESTR pViewType;
  363. long lViewOptions = 0;
  364. Assert(pResult != NULL);
  365. COM_PROTECT_TRY
  366. {
  367. if (pResult)
  368. {
  369. MMC_COOKIE cookie = pResult->lParam;
  370. if (pResult->bScopeItem == TRUE)
  371. {
  372. m_spNodeMgr->FindNode(cookie, &spNode);
  373. if (pResult->mask & RDI_STR)
  374. {
  375. pResult->str = const_cast<LPWSTR>(spNode->GetString(pResult->nCol));
  376. }
  377. if (pResult->mask & RDI_IMAGE)
  378. {
  379. pResult->nImage = (UINT)spNode->GetData(TFS_DATA_IMAGEINDEX);
  380. }
  381. }
  382. else
  383. {
  384. if (pResult->itemID == 0 &&
  385. pResult->lParam == 0)
  386. {
  387. // virtual listbox call. The selected node should own
  388. // this so call into it's result handler.
  389. CORg(GetSelectedNode(&spNode));
  390. CORg(spNode->GetResultHandler(&spResultHandler));
  391. if (pResult->mask & RDI_STR)
  392. {
  393. pResult->str = const_cast<LPWSTR>(spResultHandler->GetVirtualString(pResult->nIndex, pResult->nCol));
  394. }
  395. if (pResult->mask & RDI_IMAGE)
  396. {
  397. pResult->nImage = spResultHandler->GetVirtualImage(pResult->nIndex);
  398. }
  399. }
  400. else
  401. // If it's not a scope item, we have to assume that the
  402. // lParam is the cookie, the reasoning behind making this a
  403. // cookie instead is that we can't assume that we have a node
  404. // behind every result pane item.
  405. if (pResult->mask & RDI_STR)
  406. {
  407. // more $!#@!$#@ special code to support the virtual listbox
  408. if (pResult->mask & RDI_PARAM)
  409. {
  410. CORg(GetSelectedNode(&spNode));
  411. CORg(spNode->GetResultHandler(&spResultHandler));
  412. CORg(spResultHandler->OnGetResultViewType(this, cookie, &pViewType, &lViewOptions));
  413. if (lViewOptions & MMC_VIEW_OPTIONS_OWNERDATALIST)
  414. pResult->str = const_cast<LPWSTR>(spResultHandler->GetVirtualString((int)pResult->lParam, pResult->nCol));
  415. else
  416. {
  417. spResultHandler.Set(NULL);
  418. spNode.Set(NULL);
  419. CORg(m_spNodeMgr->FindNode(cookie, &spNode));
  420. CORg(spNode->GetResultHandler(&spResultHandler));
  421. pResult->str = const_cast<LPWSTR>(spResultHandler->GetString(this, cookie, pResult->nCol));
  422. }
  423. }
  424. else
  425. {
  426. CORg(m_spNodeMgr->FindNode(cookie, &spNode));
  427. CORg(spNode->GetResultHandler(&spResultHandler));
  428. pResult->str = const_cast<LPWSTR>(spResultHandler->GetString(this, cookie, pResult->nCol));
  429. //ASSERT(pResult->str != NULL);
  430. }
  431. }
  432. }
  433. }
  434. COM_PROTECT_ERROR_LABEL;
  435. }
  436. COM_PROTECT_CATCH
  437. return hr;
  438. }
  439. /*!--------------------------------------------------------------------------
  440. TFSComponent::OnUpdateView
  441. -
  442. Author:
  443. ---------------------------------------------------------------------------*/
  444. HRESULT
  445. TFSComponent::OnUpdateView
  446. (
  447. LPDATAOBJECT lpDataObject,
  448. LPARAM data, // arg
  449. LPARAM hint // param
  450. )
  451. {
  452. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  453. SPITFSNode spNode;
  454. SPITFSResultHandler spResultHandler;
  455. HRESULT hr = hrOK;
  456. COM_PROTECT_TRY
  457. {
  458. GetSelectedNode(&spNode);
  459. if (spNode == NULL)
  460. {
  461. ITFSNode * pNode = NULL;
  462. // no selected node, check and see if there is something in the
  463. // data object we can use.
  464. if (lpDataObject)
  465. {
  466. SPINTERNAL spInternal = ExtractInternalFormat(lpDataObject);
  467. if (spInternal)
  468. {
  469. pNode = reinterpret_cast<ITFSNode *>(spInternal->m_cookie);
  470. }
  471. }
  472. if (pNode)
  473. {
  474. spNode.Set(pNode);
  475. }
  476. else
  477. {
  478. goto Error; // no selection for our IComponentData
  479. }
  480. }
  481. CORg( spNode->GetResultHandler(&spResultHandler) );
  482. CORg( spResultHandler->UpdateView(this, lpDataObject, data, hint) );
  483. COM_PROTECT_ERROR_LABEL;
  484. }
  485. COM_PROTECT_CATCH
  486. return hr;
  487. }
  488. /*!--------------------------------------------------------------------------
  489. TFSComponent::OnDeselectAll
  490. Handler for the MMCN_DESELECT_ALL notify message
  491. Author: EricDav
  492. ---------------------------------------------------------------------------*/
  493. HRESULT
  494. TFSComponent::OnDeselectAll
  495. (
  496. LPDATAOBJECT lpDataObject,
  497. LPARAM data, // arg
  498. LPARAM hint // param
  499. )
  500. {
  501. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  502. HRESULT hr = hrOK;
  503. COM_PROTECT_TRY
  504. {
  505. }
  506. COM_PROTECT_CATCH
  507. return hr;
  508. }
  509. /*!--------------------------------------------------------------------------
  510. TFSComponent::OnColumnClick
  511. -
  512. Author:
  513. ---------------------------------------------------------------------------*/
  514. HRESULT
  515. TFSComponent::OnColumnClick
  516. (
  517. LPDATAOBJECT lpDataObject,
  518. LPARAM arg, // arg
  519. LPARAM param // param
  520. )
  521. {
  522. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  523. SPITFSNode spNode;
  524. SPITFSResultHandler spResultHandler;
  525. HRESULT hr = hrOK;
  526. COM_PROTECT_TRY
  527. {
  528. GetSelectedNode(&spNode);
  529. if (spNode == NULL)
  530. goto Error; // no selection for out IComponentData
  531. CORg( spNode->GetResultHandler(&spResultHandler) );
  532. CORg( spResultHandler->Notify(this,
  533. spNode->GetData(TFS_DATA_COOKIE),
  534. lpDataObject,
  535. MMCN_COLUMN_CLICK,
  536. arg,
  537. param) );
  538. COM_PROTECT_ERROR_LABEL;
  539. }
  540. COM_PROTECT_CATCH
  541. return hr;
  542. }
  543. /*!--------------------------------------------------------------------------
  544. TFSComponent::OnSnapinHelp
  545. MMC calls us with this when the user select About <snapin>
  546. from MMC's main window Help menu.
  547. Author: EricDav
  548. ---------------------------------------------------------------------------*/
  549. HRESULT
  550. TFSComponent::OnSnapinHelp
  551. (
  552. LPDATAOBJECT lpDataObject,
  553. LPARAM arg, // arg
  554. LPARAM param // param
  555. )
  556. {
  557. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  558. HRESULT hr = hrOK;
  559. COM_PROTECT_TRY
  560. {
  561. }
  562. COM_PROTECT_CATCH
  563. return hr;
  564. }
  565. /*---------------------------------------------------------------------------
  566. IExtendControlbar implementation
  567. ---------------------------------------------------------------------------*/
  568. /*!--------------------------------------------------------------------------
  569. TFSComponent::SetControlbar
  570. MMC hands us the interface to the control bars here
  571. Author:
  572. ---------------------------------------------------------------------------*/
  573. STDMETHODIMP
  574. TFSComponent::SetControlbar
  575. (
  576. LPCONTROLBAR pControlbar
  577. )
  578. {
  579. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  580. SPITFSNode spNode;
  581. SPITFSResultHandler spResultHandler;
  582. HRESULT hr=hrOK;
  583. COM_PROTECT_TRY
  584. {
  585. if (pControlbar != NULL)
  586. {
  587. // Hold on to the controlbar interface.
  588. m_spControlbar.Set(pControlbar);
  589. hr = S_FALSE;
  590. //
  591. // Tell the derived class to put up it's toolbars
  592. //
  593. // Get the result handler for the root node
  594. m_spNodeMgr->GetRootNode(&spNode);
  595. spNode->GetResultHandler(&spResultHandler);
  596. spResultHandler->OnCreateControlbars(this, pControlbar);
  597. }
  598. else
  599. {
  600. m_spControlbar.Release();
  601. }
  602. }
  603. COM_PROTECT_CATCH
  604. return hr;
  605. }
  606. /*!--------------------------------------------------------------------------
  607. TFSComponent::ControlbarNotify
  608. Implementation of IExtendControlbar::ControlbarNotify
  609. Author: KennT
  610. ---------------------------------------------------------------------------*/
  611. STDMETHODIMP TFSComponent::ControlbarNotify(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
  612. {
  613. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  614. SPITFSNode spNode;
  615. SPITFSResultHandler spResultHandler;
  616. HRESULT hr = hrOK;
  617. COM_PROTECT_TRY
  618. {
  619. CORg( m_spNodeMgr->GetRootNode(&spNode) );
  620. CORg( spNode->GetResultHandler(&spResultHandler) );
  621. CORg( spResultHandler->ControlbarNotify(this, event, arg, param) );
  622. COM_PROTECT_ERROR_LABEL;
  623. }
  624. COM_PROTECT_CATCH
  625. return hr;
  626. }
  627. /*---------------------------------------------------------------------------
  628. TFSComponent's implementation specific members
  629. ---------------------------------------------------------------------------*/
  630. DEBUG_DECLARE_INSTANCE_COUNTER(TFSComponent);
  631. /*!--------------------------------------------------------------------------
  632. TFSComponent::TFSComponent()
  633. -
  634. Author:
  635. ---------------------------------------------------------------------------*/
  636. TFSComponent::TFSComponent()
  637. : m_cRef(1)
  638. {
  639. DEBUG_INCREMENT_INSTANCE_COUNTER(TFSComponent);
  640. }
  641. void TFSComponent::Construct(ITFSNodeMgr *pNodeMgr,
  642. IComponentData *pComponentData,
  643. ITFSComponentData *pTFSCompData)
  644. {
  645. HRESULT hr;
  646. COM_PROTECT_TRY
  647. {
  648. m_spNodeMgr.Set(pNodeMgr);
  649. m_spTFSComponentData.Set(pTFSCompData);
  650. m_spComponentData.Set(pComponentData);
  651. m_spConsole = NULL;
  652. m_spHeaderCtrl = NULL;
  653. m_spResultData = NULL;
  654. m_spImageList = NULL;
  655. m_spControlbar = NULL;
  656. m_spConsoleVerb = NULL;
  657. }
  658. COM_PROTECT_CATCH
  659. }
  660. /*!--------------------------------------------------------------------------
  661. TFSComponent::~TFSComponent()
  662. -
  663. Author: EricDav
  664. ---------------------------------------------------------------------------*/
  665. TFSComponent::~TFSComponent()
  666. {
  667. DEBUG_DECREMENT_INSTANCE_COUNTER(TFSComponent);
  668. m_spControlbar.Release();
  669. // Make sure the interfaces have been released
  670. Assert(m_spConsole == NULL);
  671. Assert(m_spHeaderCtrl == NULL);
  672. Construct(NULL, NULL, NULL);
  673. }
  674. /*---------------------------------------------------------------------------
  675. IResultDataCompare Implementation
  676. ---------------------------------------------------------------------------*/
  677. /*!--------------------------------------------------------------------------
  678. TFSComponent::Compare
  679. MMC calls this to compare to nodes in the result pane
  680. Author:
  681. ---------------------------------------------------------------------------*/
  682. STDMETHODIMP
  683. TFSComponent::Compare
  684. (
  685. LPARAM lUserParam,
  686. MMC_COOKIE cookieA,
  687. MMC_COOKIE cookieB,
  688. int* pnResult
  689. )
  690. {
  691. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  692. int nCol = *pnResult;
  693. HRESULT hr = hrOK;
  694. SPITFSNode spNode1, spNode2;
  695. COM_PROTECT_TRY
  696. {
  697. m_spNodeMgr->FindNode(cookieA, &spNode1);
  698. m_spNodeMgr->FindNode(cookieB, &spNode2);
  699. SPITFSResultHandler spResultHandler;
  700. // If the nodes are different then each result item
  701. // has it's own node/handler. Call the parent node's
  702. // result handler to compare these two items
  703. if (spNode1 != spNode2)
  704. {
  705. SPITFSNode spParentNode1, spParentNode2;
  706. spNode1->GetParent(&spParentNode1);
  707. spNode2->GetParent(&spParentNode2);
  708. Assert(spParentNode1 == spParentNode2);
  709. spParentNode1->GetResultHandler(&spResultHandler);
  710. }
  711. else
  712. {
  713. // If the nodes are the same, then we are in the case
  714. // of a node holding multiple result items, have the
  715. // node compare the two
  716. spNode1->GetResultHandler(&spResultHandler);
  717. }
  718. *pnResult = spResultHandler->CompareItems(this, cookieA, cookieB, nCol);
  719. }
  720. COM_PROTECT_CATCH
  721. return hr;
  722. }
  723. STDMETHODIMP
  724. TFSComponent::Compare
  725. (
  726. RDCOMPARE *prdc,
  727. int* pnResult
  728. )
  729. {
  730. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  731. HRESULT hr = hrOK;
  732. MMC_COOKIE cookieA, cookieB;
  733. SPITFSNode spNode1, spNode2;
  734. COM_PROTECT_TRY
  735. {
  736. cookieA = prdc->prdch1->cookie;
  737. cookieB = prdc->prdch2->cookie;
  738. m_spNodeMgr->FindNode(cookieA, &spNode1);
  739. m_spNodeMgr->FindNode(cookieB, &spNode2);
  740. SPITFSResultHandler spResultHandler;
  741. // If the nodes are different then each result item
  742. // has it's own node/handler. Call the parent node's
  743. // result handler to compare these two items
  744. if (spNode1 != spNode2)
  745. {
  746. SPITFSNode spParentNode1, spParentNode2;
  747. spNode1->GetParent(&spParentNode1);
  748. spNode2->GetParent(&spParentNode2);
  749. Assert(spParentNode1 == spParentNode2);
  750. spParentNode1->GetResultHandler(&spResultHandler);
  751. }
  752. else {
  753. // If the nodes are the same, then we are in the case
  754. // of a node holding multiple result items, have the
  755. // node compare the two
  756. spNode1->GetResultHandler(&spResultHandler);
  757. }
  758. *pnResult = spResultHandler->CompareItems( this, prdc );
  759. }
  760. COM_PROTECT_CATCH
  761. return hrOK;
  762. } // TFSComponent::Compare()
  763. /*---------------------------------------------------------------------------
  764. IResultOwnerData Implementation
  765. ---------------------------------------------------------------------------*/
  766. /*!--------------------------------------------------------------------------
  767. TFSComponent::FindItem
  768. The Virutal listbox calls this when it needs to find an item.
  769. Forward the call to the selected node's result handler.
  770. Author: EricDav
  771. ---------------------------------------------------------------------------*/
  772. STDMETHODIMP
  773. TFSComponent::FindItem
  774. (
  775. LPRESULTFINDINFO pFindInfo,
  776. int * pnFoundIndex
  777. )
  778. {
  779. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  780. HRESULT hr = hrOK;
  781. SPITFSNode spNode;
  782. COM_PROTECT_TRY
  783. {
  784. SPITFSResultHandler spResultHandler;
  785. CORg(GetSelectedNode(&spNode));
  786. CORg(spNode->GetResultHandler(&spResultHandler));
  787. hr = spResultHandler->FindItem(pFindInfo, pnFoundIndex);
  788. COM_PROTECT_ERROR_LABEL;
  789. }
  790. COM_PROTECT_CATCH
  791. return hr;
  792. }
  793. /*!--------------------------------------------------------------------------
  794. TFSComponent::CacheHint
  795. The virtual listbox calls this with hint information that we can
  796. pre-load. The hint is not a guaruntee that the items will be used
  797. or that items outside this range will be used.
  798. Forward the call to the selected node's result handler.
  799. Author: EricDav
  800. ---------------------------------------------------------------------------*/
  801. STDMETHODIMP
  802. TFSComponent::CacheHint
  803. (
  804. int nStartIndex,
  805. int nEndIndex
  806. )
  807. {
  808. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  809. HRESULT hr = hrOK;
  810. SPITFSNode spNode;
  811. COM_PROTECT_TRY
  812. {
  813. SPITFSResultHandler spResultHandler;
  814. CORg(GetSelectedNode(&spNode));
  815. if (spNode)
  816. {
  817. CORg(spNode->GetResultHandler(&spResultHandler));
  818. hr = spResultHandler->CacheHint(nStartIndex, nEndIndex);
  819. }
  820. COM_PROTECT_ERROR_LABEL;
  821. }
  822. COM_PROTECT_CATCH
  823. return hr;
  824. }
  825. /*!--------------------------------------------------------------------------
  826. TFSComponent::SortItems
  827. The Virutal listbox calls this when the data needs to be sorted
  828. Forward the call to the selected node's result handler.
  829. Author: EricDav
  830. ---------------------------------------------------------------------------*/
  831. STDMETHODIMP
  832. TFSComponent::SortItems
  833. (
  834. int nColumn,
  835. DWORD dwSortOptions,
  836. LPARAM lUserParam
  837. )
  838. {
  839. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  840. HRESULT hr = hrOK;
  841. SPITFSNode spNode;
  842. COM_PROTECT_TRY
  843. {
  844. SPITFSResultHandler spResultHandler;
  845. CORg(GetSelectedNode(&spNode));
  846. CORg(spNode->GetResultHandler(&spResultHandler));
  847. hr = spResultHandler->SortItems(nColumn, dwSortOptions, lUserParam);
  848. COM_PROTECT_ERROR_LABEL;
  849. }
  850. COM_PROTECT_CATCH
  851. return hr;
  852. }
  853. /*---------------------------------------------------------------------------
  854. IExtendPropertySheet Implementation
  855. ---------------------------------------------------------------------------*/
  856. /*!--------------------------------------------------------------------------
  857. TFSComponent::CreatePropertyPages
  858. Implementation of IExtendPropertySheet::CreatePropertyPages
  859. Called for a node to put up property pages
  860. Author:
  861. ---------------------------------------------------------------------------*/
  862. STDMETHODIMP
  863. TFSComponent::CreatePropertyPages
  864. (
  865. LPPROPERTYSHEETCALLBACK lpProvider,
  866. LONG_PTR handle,
  867. LPDATAOBJECT pDataObject
  868. )
  869. {
  870. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  871. SPITFSNode spNode;
  872. SPITFSResultHandler spResultHandler;
  873. HRESULT hr = hrOK;
  874. SPINTERNAL spInternal;
  875. COM_PROTECT_TRY
  876. {
  877. spInternal = ExtractInternalFormat(pDataObject);
  878. // this was an object created by the modal wizard, do nothing
  879. if (spInternal && spInternal->m_type == CCT_UNINITIALIZED)
  880. {
  881. return hr;
  882. }
  883. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  884. m_spTFSComponentData->GetCoClassID(),
  885. pDataObject, FALSE,
  886. &spNode, NULL, NULL) );
  887. //
  888. // Create the property page for a particular node
  889. //
  890. CORg( spNode->GetResultHandler(&spResultHandler) );
  891. CORg( spResultHandler->CreatePropertyPages(this,
  892. spNode->GetData(TFS_DATA_COOKIE),
  893. lpProvider,
  894. pDataObject,
  895. handle));
  896. COM_PROTECT_ERROR_LABEL;
  897. }
  898. COM_PROTECT_CATCH;
  899. return hr;
  900. }
  901. /*!--------------------------------------------------------------------------
  902. TFSComponent::QueryPagesFor
  903. Implementation of IExtendPropertySheet::QueryPagesFor
  904. MMC calls this to see if a node has property pages
  905. Author:
  906. ---------------------------------------------------------------------------*/
  907. STDMETHODIMP
  908. TFSComponent::QueryPagesFor
  909. (
  910. LPDATAOBJECT pDataObject
  911. )
  912. {
  913. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  914. SPITFSNode spNode;
  915. SPITFSResultHandler spResultHandler;
  916. HRESULT hr = hrOK;
  917. SPINTERNAL spInternal;
  918. COM_PROTECT_TRY
  919. {
  920. spInternal = ExtractInternalFormat(pDataObject);
  921. // this was an object created by the modal wizard, do nothing
  922. if (spInternal && spInternal->m_type == CCT_UNINITIALIZED)
  923. {
  924. return hr;
  925. }
  926. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  927. m_spTFSComponentData->GetCoClassID(),
  928. pDataObject, FALSE,
  929. &spNode, NULL, NULL) );
  930. CORg( spNode->GetResultHandler(&spResultHandler) );
  931. if (spResultHandler)
  932. CORg( spResultHandler->HasPropertyPages(this,
  933. spNode->GetData(TFS_DATA_COOKIE),
  934. pDataObject) );
  935. COM_PROTECT_ERROR_LABEL;
  936. }
  937. COM_PROTECT_CATCH;
  938. return hr;
  939. }
  940. /*!--------------------------------------------------------------------------
  941. TFSComponent::GetWatermarks
  942. Implementation of IExtendPropertySheet::Watermarks
  943. MMC calls this for wizard 97 info
  944. Author:
  945. ---------------------------------------------------------------------------*/
  946. STDMETHODIMP
  947. TFSComponent::GetWatermarks
  948. (
  949. LPDATAOBJECT pDataObject,
  950. HBITMAP * lphWatermark,
  951. HBITMAP * lphHeader,
  952. HPALETTE * lphPalette,
  953. BOOL * bStretch
  954. )
  955. {
  956. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  957. HRESULT hr = hrOK;
  958. COM_PROTECT_TRY
  959. {
  960. // set some defaults
  961. lphWatermark = NULL;
  962. lphHeader = NULL;
  963. lphPalette = NULL;
  964. *bStretch = FALSE;
  965. }
  966. COM_PROTECT_CATCH;
  967. return hr;
  968. }
  969. /*---------------------------------------------------------------------------
  970. IExtendTaskPad Implementation
  971. ---------------------------------------------------------------------------*/
  972. /*!--------------------------------------------------------------------------
  973. TFSComponent::TaskNotify
  974. IExtendTaskPad::TaskNotify implementation
  975. Author:
  976. ---------------------------------------------------------------------------*/
  977. STDMETHODIMP
  978. TFSComponent::TaskNotify
  979. (
  980. LPDATAOBJECT pDataObject,
  981. VARIANT * arg,
  982. VARIANT * param
  983. )
  984. {
  985. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  986. SPITFSNode spNode;
  987. SPITFSResultHandler spResultHandler;
  988. HRESULT hr = hrOK;
  989. SPINTERNAL spInternal;
  990. COM_PROTECT_TRY
  991. {
  992. spInternal = ExtractInternalFormat(pDataObject);
  993. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  994. m_spTFSComponentData->GetCoClassID(),
  995. pDataObject, FALSE,
  996. &spNode, NULL, NULL) );
  997. //
  998. // Forward the call so that the handler can do something
  999. //
  1000. CORg( spNode->GetResultHandler(&spResultHandler) );
  1001. CORg( spResultHandler->TaskPadNotify(this,
  1002. spNode->GetData(TFS_DATA_COOKIE),
  1003. pDataObject,
  1004. arg,
  1005. param));
  1006. COM_PROTECT_ERROR_LABEL;
  1007. }
  1008. COM_PROTECT_CATCH;
  1009. return hr;
  1010. }
  1011. /*!--------------------------------------------------------------------------
  1012. TFSComponent::EnumTasks
  1013. IExtendTaskPad::EnumTasks implementation
  1014. Author:
  1015. ---------------------------------------------------------------------------*/
  1016. STDMETHODIMP
  1017. TFSComponent::EnumTasks
  1018. (
  1019. LPDATAOBJECT pDataObject,
  1020. LPOLESTR pszTaskGroup,
  1021. IEnumTASK ** ppEnumTask
  1022. )
  1023. {
  1024. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1025. SPITFSNode spNode;
  1026. SPITFSResultHandler spResultHandler;
  1027. HRESULT hr = hrOK;
  1028. SPINTERNAL spInternal;
  1029. COM_PROTECT_TRY
  1030. {
  1031. spInternal = ExtractInternalFormat(pDataObject);
  1032. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  1033. m_spTFSComponentData->GetCoClassID(),
  1034. pDataObject, FALSE,
  1035. &spNode, NULL, NULL) );
  1036. //
  1037. // Forward the call so that the handler can do something
  1038. //
  1039. CORg( spNode->GetResultHandler(&spResultHandler) );
  1040. CORg( spResultHandler->EnumTasks(this,
  1041. spNode->GetData(TFS_DATA_COOKIE),
  1042. pDataObject,
  1043. pszTaskGroup,
  1044. ppEnumTask));
  1045. COM_PROTECT_ERROR_LABEL;
  1046. }
  1047. COM_PROTECT_CATCH;
  1048. return hr;
  1049. }
  1050. /*!--------------------------------------------------------------------------
  1051. TFSComponent::GetTitle
  1052. IExtendTaskPad::GetTitle implementation
  1053. Author:
  1054. ---------------------------------------------------------------------------*/
  1055. STDMETHODIMP
  1056. TFSComponent::GetTitle
  1057. (
  1058. LPOLESTR szGroup,
  1059. LPOLESTR * ppszBitmapResource
  1060. )
  1061. {
  1062. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1063. SPITFSNode spNode;
  1064. SPITFSResultHandler spResultHandler;
  1065. HRESULT hr = hrOK;
  1066. COM_PROTECT_TRY
  1067. {
  1068. GetSelectedNode(&spNode);
  1069. if (spNode == NULL)
  1070. goto Error; // no selection for out IComponentData
  1071. //
  1072. // Forward the call so that the handler can do something
  1073. //
  1074. CORg( spNode->GetResultHandler(&spResultHandler) );
  1075. CORg( spResultHandler->TaskPadGetTitle(this,
  1076. spNode->GetData(TFS_DATA_COOKIE),
  1077. szGroup,
  1078. ppszBitmapResource));
  1079. COM_PROTECT_ERROR_LABEL;
  1080. }
  1081. COM_PROTECT_CATCH;
  1082. return hr;
  1083. }
  1084. /*!--------------------------------------------------------------------------
  1085. TFSComponent::GetBackground
  1086. IExtendTaskPad::GetBackground implementation
  1087. Author: EricDav
  1088. ---------------------------------------------------------------------------*/
  1089. STDMETHODIMP
  1090. TFSComponent::GetBackground
  1091. (
  1092. LPOLESTR szGroup,
  1093. MMC_TASK_DISPLAY_OBJECT * pTDO
  1094. )
  1095. {
  1096. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1097. SPITFSNode spNode;
  1098. SPITFSResultHandler spResultHandler;
  1099. HRESULT hr = hrOK;
  1100. COM_PROTECT_TRY
  1101. {
  1102. GetSelectedNode(&spNode);
  1103. if (spNode == NULL)
  1104. goto Error; // no selection for out IComponentData
  1105. //
  1106. // Forward the call so that the handler can do something
  1107. //
  1108. CORg( spNode->GetResultHandler(&spResultHandler) );
  1109. CORg( spResultHandler->TaskPadGetBackground(this,
  1110. spNode->GetData(TFS_DATA_COOKIE),
  1111. szGroup,
  1112. pTDO));
  1113. COM_PROTECT_ERROR_LABEL;
  1114. }
  1115. COM_PROTECT_CATCH;
  1116. return hr;
  1117. }
  1118. /*!--------------------------------------------------------------------------
  1119. TFSComponent::GetDescriptiveText
  1120. IExtendTaskPad::GetDescriptiveText implementation
  1121. Author: EricDav
  1122. ---------------------------------------------------------------------------*/
  1123. STDMETHODIMP
  1124. TFSComponent::GetDescriptiveText
  1125. (
  1126. LPOLESTR szGroup,
  1127. LPOLESTR * pszDescriptiveText
  1128. )
  1129. {
  1130. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1131. SPITFSNode spNode;
  1132. SPITFSResultHandler spResultHandler;
  1133. HRESULT hr = hrOK;
  1134. COM_PROTECT_TRY
  1135. {
  1136. GetSelectedNode(&spNode);
  1137. if (spNode == NULL)
  1138. goto Error; // no selection for out IComponentData
  1139. //
  1140. // Forward the call so that the handler can do something
  1141. //
  1142. CORg( spNode->GetResultHandler(&spResultHandler) );
  1143. CORg( spResultHandler->TaskPadGetDescriptiveText(this,
  1144. spNode->GetData(TFS_DATA_COOKIE),
  1145. szGroup,
  1146. pszDescriptiveText));
  1147. COM_PROTECT_ERROR_LABEL;
  1148. }
  1149. COM_PROTECT_CATCH;
  1150. return hr;
  1151. }
  1152. /*---------------------------------------------------------------------------
  1153. TFSComponent::GetListPadInfo
  1154. IExtendTaskPad::GetListPadInfo implementation
  1155. Author: KennT
  1156. ---------------------------------------------------------------------------*/
  1157. STDMETHODIMP
  1158. TFSComponent::GetListPadInfo
  1159. (
  1160. LPOLESTR pszGroup,
  1161. MMC_LISTPAD_INFO *pListPadInfo
  1162. )
  1163. {
  1164. return E_NOTIMPL;
  1165. }
  1166. /*---------------------------------------------------------------------------
  1167. IExtendContextMenu Implementation
  1168. ---------------------------------------------------------------------------*/
  1169. /*!--------------------------------------------------------------------------
  1170. TFSComponent::AddMenuItems
  1171. MMC calls this to add menu items when a context menu is being put up
  1172. Author:
  1173. ---------------------------------------------------------------------------*/
  1174. STDMETHODIMP
  1175. TFSComponent::AddMenuItems
  1176. (
  1177. LPDATAOBJECT pDataObject,
  1178. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  1179. long * pInsertionAllowed
  1180. )
  1181. {
  1182. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1183. SPITFSNode spNode;
  1184. SPITFSResultHandler spResultHandler;
  1185. HRESULT hr = hrOK;
  1186. Assert(m_spTFSComponentData);
  1187. COM_PROTECT_TRY
  1188. {
  1189. ASSERT(pDataObject != NULL);
  1190. if ( (IS_SPECIAL_DATAOBJECT(pDataObject)) ||
  1191. (pDataObject && IsMMCMultiSelectDataObject(pDataObject)) )
  1192. {
  1193. // get the selected node
  1194. CORg(GetSelectedNode(&spNode));
  1195. }
  1196. else
  1197. {
  1198. // normal case, extract the node from the DO
  1199. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  1200. m_spTFSComponentData->GetCoClassID(),
  1201. pDataObject, FALSE,
  1202. &spNode, NULL, NULL) );
  1203. }
  1204. CORg( spNode->GetResultHandler(&spResultHandler) );
  1205. if (spResultHandler)
  1206. CORg( spResultHandler->AddMenuItems(this,
  1207. spNode->GetData(TFS_DATA_COOKIE),
  1208. pDataObject,
  1209. pContextMenuCallback,
  1210. pInsertionAllowed) );
  1211. COM_PROTECT_ERROR_LABEL;
  1212. }
  1213. COM_PROTECT_CATCH
  1214. return hr;
  1215. }
  1216. /*!--------------------------------------------------------------------------
  1217. TFSComponent::Command
  1218. Command handler for context menus
  1219. Author:
  1220. ---------------------------------------------------------------------------*/
  1221. STDMETHODIMP
  1222. TFSComponent::Command
  1223. (
  1224. long nCommandID,
  1225. LPDATAOBJECT pDataObject
  1226. )
  1227. {
  1228. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  1229. SPITFSNode spNode;
  1230. SPITFSResultHandler spResultHandler;
  1231. HRESULT hr = hrOK;
  1232. COM_PROTECT_TRY
  1233. {
  1234. if ( (IS_SPECIAL_DATAOBJECT(pDataObject)) ||
  1235. (pDataObject && IsMMCMultiSelectDataObject(pDataObject)) )
  1236. {
  1237. // get the selected node
  1238. CORg(GetSelectedNode(&spNode));
  1239. }
  1240. else
  1241. {
  1242. // otherwise use the DO
  1243. CORg( ExtractNodeFromDataObject(m_spNodeMgr,
  1244. m_spTFSComponentData->GetCoClassID(),
  1245. pDataObject, FALSE,
  1246. &spNode, NULL, NULL) );
  1247. }
  1248. CORg( spNode->GetResultHandler(&spResultHandler) );
  1249. if (spResultHandler)
  1250. CORg( spResultHandler->Command(this,
  1251. spNode->GetData(TFS_DATA_COOKIE),
  1252. nCommandID,
  1253. pDataObject) );
  1254. COM_PROTECT_ERROR_LABEL;
  1255. }
  1256. COM_PROTECT_CATCH
  1257. return hr;
  1258. }
  1259. /*!--------------------------------------------------------------------------
  1260. ITFSComponent implementation specific members
  1261. Author: EricDav
  1262. ---------------------------------------------------------------------------*/
  1263. STDMETHODIMP
  1264. TFSComponent::GetSelectedNode(ITFSNode **ppNode)
  1265. {
  1266. Assert(ppNode);
  1267. SetI((LPUNKNOWN *) ppNode, m_spSelectedNode);
  1268. return hrOK;
  1269. }
  1270. STDMETHODIMP
  1271. TFSComponent::SetSelectedNode(ITFSNode *pNode)
  1272. {
  1273. m_spSelectedNode.Set(pNode);
  1274. return hrOK;
  1275. }
  1276. STDMETHODIMP
  1277. TFSComponent::GetConsole(IConsole2 **ppConsole)
  1278. {
  1279. Assert(ppConsole);
  1280. SetI((LPUNKNOWN *) ppConsole, m_spConsole);
  1281. return hrOK;
  1282. }
  1283. STDMETHODIMP
  1284. TFSComponent::GetHeaderCtrl(IHeaderCtrl **ppHeaderCtrl)
  1285. {
  1286. Assert(ppHeaderCtrl);
  1287. SetI((LPUNKNOWN *) ppHeaderCtrl, m_spHeaderCtrl);
  1288. return hrOK;
  1289. }
  1290. STDMETHODIMP
  1291. TFSComponent::GetResultData(IResultData **ppResultData)
  1292. {
  1293. Assert(ppResultData);
  1294. SetI((LPUNKNOWN *) ppResultData, m_spResultData);
  1295. return hrOK;
  1296. }
  1297. STDMETHODIMP
  1298. TFSComponent::GetImageList(IImageList **ppImageList)
  1299. {
  1300. Assert(ppImageList);
  1301. SetI((LPUNKNOWN *) ppImageList, m_spImageList);
  1302. return hrOK;
  1303. }
  1304. STDMETHODIMP
  1305. TFSComponent::GetConsoleVerb(IConsoleVerb **ppConsoleVerb)
  1306. {
  1307. Assert(ppConsoleVerb);
  1308. SetI((LPUNKNOWN *) ppConsoleVerb, m_spConsoleVerb);
  1309. return hrOK;
  1310. }
  1311. STDMETHODIMP
  1312. TFSComponent::GetControlbar(IControlbar **ppControlbar)
  1313. {
  1314. Assert(ppControlbar);
  1315. SetI((LPUNKNOWN *) ppControlbar, m_spControlbar);
  1316. return hrOK;
  1317. }
  1318. STDMETHODIMP
  1319. TFSComponent::GetComponentData(IComponentData **ppComponentData)
  1320. {
  1321. Assert(ppComponentData);
  1322. SetI((LPUNKNOWN *) ppComponentData, m_spComponentData);
  1323. return hrOK;
  1324. }
  1325. STDMETHODIMP
  1326. TFSComponent::SetUserData(LONG_PTR ulData)
  1327. {
  1328. m_ulUserData = ulData;
  1329. return hrOK;
  1330. }
  1331. STDMETHODIMP
  1332. TFSComponent::GetUserData(LONG_PTR *pulData)
  1333. {
  1334. Assert(pulData);
  1335. *pulData = m_ulUserData;
  1336. return hrOK;
  1337. }
  1338. STDMETHODIMP
  1339. TFSComponent::SetCurrentDataObject(LPDATAOBJECT pDataObject)
  1340. {
  1341. m_spCurrentDataObject.Set(pDataObject);
  1342. return hrOK;
  1343. }
  1344. STDMETHODIMP
  1345. TFSComponent::GetCurrentDataObject(LPDATAOBJECT * ppDataObject)
  1346. {
  1347. Assert(ppDataObject);
  1348. SetI((LPUNKNOWN *) ppDataObject, m_spCurrentDataObject);
  1349. return hrOK;
  1350. }
  1351. STDMETHODIMP
  1352. TFSComponent::SetToolbar(IToolbar * pToolbar)
  1353. {
  1354. m_spToolbar.Set(pToolbar);
  1355. return hrOK;
  1356. }
  1357. STDMETHODIMP
  1358. TFSComponent::GetToolbar(IToolbar ** ppToolbar)
  1359. {
  1360. Assert(ppToolbar);
  1361. SetI((LPUNKNOWN *) ppToolbar, m_spToolbar);
  1362. return hrOK;
  1363. }