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.

853 lines
19 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: DSCookie.cpp
  7. //
  8. // Contents: TBD
  9. //
  10. // History: 02-Oct-96 WayneSc Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include "stdafx.h"
  14. #include "resource.h"
  15. #include "uinode.h"
  16. #include "ContextMenu.h"
  17. #include "dsfilter.h"
  18. #include "xmlutil.h"
  19. #include <notify.h>
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25. ////////////////////////////////////////////////////////////////////
  26. // CUIFolderInfo
  27. const UINT CUIFolderInfo::nSerialNomberNotTouched = 0x7fffffff;
  28. CUIFolderInfo::CUIFolderInfo(CUINode* pUINode)
  29. {
  30. ASSERT(pUINode != NULL);
  31. m_pUINode = pUINode;
  32. m_hScopeItem = NULL;
  33. m_bExpandedOnce = FALSE;
  34. m_cObjectsContained = 0;
  35. m_SerialNumber = SERIALNUM_NOT_TOUCHED;
  36. m_pColumnSet = NULL;
  37. m_bTooMuchData = FALSE;
  38. m_nApproximateTotalContained = 0;
  39. m_bSortOnNextSelect = FALSE;
  40. m_bOwnColumnMemory = false;
  41. }
  42. CUIFolderInfo::CUIFolderInfo(const CUIFolderInfo&)
  43. {
  44. //
  45. // The node is probably still being created so don't copy it
  46. //
  47. m_pUINode = NULL;
  48. //
  49. // Don't copy the scope item
  50. //
  51. m_hScopeItem = 0;
  52. //
  53. // Don't mark as expanded
  54. //
  55. m_bExpandedOnce = FALSE;
  56. //
  57. // Shouldn't contain any object either
  58. //
  59. m_cObjectsContained = 0;
  60. m_SerialNumber = SERIALNUM_NOT_TOUCHED;
  61. m_pColumnSet = NULL;
  62. m_bOwnColumnMemory = false;
  63. m_bTooMuchData = FALSE;
  64. m_nApproximateTotalContained = 0;
  65. m_bSortOnNextSelect = FALSE;
  66. }
  67. CDSColumnSet* CUIFolderInfo::GetColumnSet(PCWSTR pszClass, CDSComponentData* pCD)
  68. {
  69. if (m_pColumnSet == NULL)
  70. {
  71. ASSERT(pCD != NULL);
  72. if (_wcsicmp(m_pUINode->GetName(), L"ForeignSecurityPrincipals") == 0)
  73. {
  74. m_pColumnSet = pCD->FindColumnSet(L"ForeignSecurityPrincipals");
  75. }
  76. else
  77. {
  78. m_pColumnSet = pCD->FindColumnSet(pszClass);
  79. }
  80. ASSERT(m_pColumnSet != NULL);
  81. }
  82. return m_pColumnSet;
  83. }
  84. void CUIFolderInfo::UpdateSerialNumber(CDSComponentData * pCD)
  85. {
  86. m_SerialNumber = pCD->GetSerialNumber();
  87. // TRACE(_T("cookie (%s)serial number updated: %d.\n"),
  88. // m_strName, m_SerialNumber);
  89. CUINode* pParentNode = GetParentNode();
  90. if (pParentNode != NULL)
  91. pParentNode->GetFolderInfo()->UpdateSerialNumber(pCD);
  92. }
  93. void CUIFolderInfo::AddToCount(UINT increment)
  94. {
  95. m_cObjectsContained += increment;
  96. // TRACE(_T("cookie (%s) count increased to: %d.\n"),
  97. // m_strName, m_cObjectsContained);
  98. CUINode* pParentNode = GetParentNode();
  99. if (pParentNode != NULL)
  100. pParentNode->GetFolderInfo()->AddToCount(increment);
  101. }
  102. void CUIFolderInfo::SubtractFromCount(UINT decrement)
  103. {
  104. if (m_cObjectsContained == 0)
  105. return;
  106. m_cObjectsContained -= decrement;
  107. // TRACE(_T("cookie (%s) count decreased to: %d.\n"),
  108. // m_strName, m_cObjectsContained);
  109. CUINode* pParentNode = GetParentNode();
  110. if (pParentNode != NULL)
  111. pParentNode->GetFolderInfo()->SubtractFromCount(decrement);
  112. }
  113. CUINode* CUIFolderInfo::GetParentNode()
  114. {
  115. ASSERT(m_pUINode != NULL);
  116. return m_pUINode->GetParent();
  117. }
  118. void CUIFolderInfo::DeleteAllLeafNodes(void)
  119. {
  120. SubtractFromCount ((UINT)m_LeafNodes.GetCount());
  121. while (!m_LeafNodes.IsEmpty())
  122. delete m_LeafNodes.RemoveTail();
  123. }
  124. void CUIFolderInfo::DeleteAllContainerNodes(void)
  125. {
  126. SubtractFromCount ((UINT)m_ContainerNodes.GetCount());
  127. while (!m_ContainerNodes.IsEmpty())
  128. delete m_ContainerNodes.RemoveTail();
  129. }
  130. HRESULT CUIFolderInfo::AddNode(CUINode* pUINode)
  131. {
  132. if (pUINode==NULL)
  133. {
  134. ASSERT(FALSE);
  135. return E_INVALIDARG;
  136. }
  137. if (pUINode->IsContainer())
  138. m_ContainerNodes.AddTail(pUINode);
  139. else
  140. m_LeafNodes.AddTail(pUINode);
  141. AddToCount(1);
  142. pUINode->SetParent(m_pUINode);
  143. return S_OK;
  144. }
  145. HRESULT CUIFolderInfo::AddListofNodes(CUINodeList* pNodeList)
  146. {
  147. HRESULT hr = S_OK;
  148. if (pNodeList == NULL)
  149. {
  150. ASSERT(FALSE);
  151. return E_INVALIDARG;
  152. }
  153. POSITION pos = pNodeList->GetHeadPosition();
  154. while (pos != NULL)
  155. {
  156. CUINode* pUINode = pNodeList->GetNext(pos);
  157. if (pUINode != NULL)
  158. {
  159. AddNode(pUINode);
  160. }
  161. else
  162. {
  163. hr = E_POINTER;
  164. }
  165. }
  166. return hr;
  167. }
  168. HRESULT CUIFolderInfo::DeleteNode(CUINode* pUINode)
  169. {
  170. if (pUINode==NULL)
  171. {
  172. ASSERT(FALSE);
  173. return E_INVALIDARG;
  174. }
  175. HRESULT hr = RemoveNode(pUINode);
  176. if (SUCCEEDED(hr))
  177. {
  178. delete pUINode;
  179. }
  180. return hr;
  181. }
  182. HRESULT CUIFolderInfo::RemoveNode(CUINode* pUINode)
  183. {
  184. if (pUINode==NULL)
  185. {
  186. ASSERT(FALSE);
  187. return E_INVALIDARG;
  188. }
  189. HRESULT hr=E_FAIL;
  190. POSITION pos;
  191. CUINodeList* pList=NULL;
  192. if (pUINode->IsContainer())
  193. {
  194. pList=&m_ContainerNodes;
  195. }
  196. else
  197. {
  198. pList=&m_LeafNodes;
  199. }
  200. pos = pList->Find(pUINode);
  201. if (pos != NULL)
  202. {
  203. pList->RemoveAt(pos);
  204. hr = S_OK;
  205. }
  206. SubtractFromCount(1);
  207. return hr;
  208. }
  209. void CUIFolderInfo::SetTooMuchData(BOOL bSet, UINT nApproximateTotal)
  210. {
  211. m_bTooMuchData = bSet;
  212. if (!bSet)
  213. {
  214. m_nApproximateTotalContained = 0;
  215. }
  216. else
  217. {
  218. m_nApproximateTotalContained = nApproximateTotal;
  219. }
  220. }
  221. ////////////////////////////////////////////////////////////////////
  222. // CUINode
  223. CUINode::CUINode(NODETYPE newNodeType, CUINode* pParentNode)
  224. {
  225. m_pParentNode = pParentNode;
  226. m_pNodeData = NULL;
  227. m_pFolderInfo = NULL;
  228. m_nSheetLockCount = 0;
  229. m_extension_op = 0;
  230. m_pMenuVerbs = NULL;
  231. m_nodeType = newNodeType;
  232. }
  233. CUINode::CUINode(const CUINode& copyNode)
  234. {
  235. m_pParentNode = copyNode.m_pParentNode;
  236. if (copyNode.m_pNodeData != NULL)
  237. {
  238. m_pNodeData = new CNodeData(*(copyNode.m_pNodeData));
  239. }
  240. else
  241. {
  242. m_pNodeData = NULL;
  243. }
  244. if (copyNode.m_pFolderInfo != NULL)
  245. {
  246. m_pFolderInfo = new CUIFolderInfo(*(copyNode.m_pFolderInfo));
  247. m_pFolderInfo->SetNode(this);
  248. }
  249. else
  250. {
  251. m_pFolderInfo = NULL;
  252. }
  253. m_nSheetLockCount = copyNode.m_nSheetLockCount;
  254. m_extension_op = copyNode.m_extension_op;
  255. m_pMenuVerbs = NULL;
  256. m_nodeType = copyNode.m_nodeType;
  257. }
  258. CUINode::~CUINode()
  259. {
  260. ASSERT(m_nSheetLockCount == 0);
  261. if (m_pNodeData != NULL)
  262. {
  263. delete m_pNodeData;
  264. }
  265. if (m_pFolderInfo != NULL)
  266. {
  267. delete m_pFolderInfo;
  268. }
  269. if (m_pMenuVerbs != NULL)
  270. {
  271. delete m_pMenuVerbs;
  272. }
  273. TRACE(_T("~CUINode: deleting %lx\n"), this);
  274. }
  275. BOOL CUINode::IsRelative(CUINode* pUINode)
  276. {
  277. BOOL bRet = FALSE;
  278. if (pUINode == this)
  279. {
  280. bRet = TRUE;
  281. }
  282. else
  283. {
  284. if (!IsSnapinRoot())
  285. {
  286. bRet = GetParent()->IsRelative(pUINode);
  287. }
  288. }
  289. return bRet;
  290. }
  291. void CUINode::IncrementSheetLockCount()
  292. {
  293. ++m_nSheetLockCount;
  294. if (m_pParentNode != NULL)
  295. m_pParentNode->IncrementSheetLockCount();
  296. }
  297. void CUINode::DecrementSheetLockCount()
  298. {
  299. ASSERT(m_nSheetLockCount > 0);
  300. --m_nSheetLockCount;
  301. if (m_pParentNode != NULL)
  302. m_pParentNode->DecrementSheetLockCount();
  303. }
  304. BOOL CUINode::IsDeleteAllowed(CDSComponentData*, BOOL* pbHide)
  305. {
  306. *pbHide = TRUE;
  307. return FALSE;
  308. }
  309. BOOL CUINode::IsRenameAllowed(CDSComponentData*, BOOL* pbHide)
  310. {
  311. *pbHide = TRUE;
  312. return FALSE;
  313. }
  314. BOOL CUINode::IsRefreshAllowed(CDSComponentData*, BOOL* pbHide)
  315. {
  316. *pbHide = TRUE;
  317. return FALSE;
  318. }
  319. BOOL CUINode::ArePropertiesAllowed(CDSComponentData*, BOOL* pbHide)
  320. {
  321. *pbHide = TRUE;
  322. return FALSE;
  323. }
  324. BOOL CUINode::IsCutAllowed(CDSComponentData*, BOOL* pbHide)
  325. {
  326. *pbHide = TRUE;
  327. return FALSE;
  328. }
  329. BOOL CUINode::IsCopyAllowed(CDSComponentData*, BOOL* pbHide)
  330. {
  331. *pbHide = TRUE;
  332. return FALSE;
  333. }
  334. BOOL CUINode::IsPasteAllowed(CDSComponentData*, BOOL* pbHide)
  335. {
  336. *pbHide = TRUE;
  337. return FALSE;
  338. }
  339. BOOL CUINode::IsPrintAllowed(CDSComponentData*, BOOL* pbHide)
  340. {
  341. *pbHide = TRUE;
  342. return FALSE;
  343. }
  344. CDSColumnSet* CUINode::GetColumnSet(CDSComponentData* pComponentData)
  345. {
  346. CDSColumnSet* pColumnSet = NULL;
  347. if (IsContainer())
  348. {
  349. pColumnSet = m_pFolderInfo->GetColumnSet(DEFAULT_COLUMN_SET, pComponentData);
  350. }
  351. return pColumnSet;
  352. }
  353. CContextMenuVerbs* CUINode::GetContextMenuVerbsObject(CDSComponentData* pComponentData)
  354. {
  355. TRACE(L"Entering CUINode::GetContextMenuVerbsObject\n");
  356. if (m_pMenuVerbs == NULL)
  357. {
  358. if (pComponentData->QuerySnapinType() == SNAPINTYPE_SITE)
  359. {
  360. TRACE(L"Creating new CSARContextMenuVerbs object\n");
  361. m_pMenuVerbs = new CSARContextMenuVerbs(pComponentData);
  362. }
  363. else
  364. {
  365. TRACE(L"Creating new CDSAdminContextMenuVerbs object\n");
  366. m_pMenuVerbs = new CDSAdminContextMenuVerbs(pComponentData);
  367. }
  368. }
  369. return m_pMenuVerbs;
  370. }
  371. HRESULT CUINode::Delete(CDSComponentData* pComponentData)
  372. {
  373. HRESULT hr = S_OK;
  374. if (IsContainer())
  375. {
  376. hr = pComponentData->RemoveContainerFromUI(this);
  377. delete this;
  378. }
  379. else
  380. {
  381. CUINode* pParentNode = GetParent();
  382. ASSERT(pParentNode->IsContainer());
  383. pParentNode->GetFolderInfo()->RemoveNode(this);
  384. //
  385. // The CDSEvent::_DeleteSingleSel() handles removing the node from the UI
  386. //
  387. }
  388. return hr;
  389. }
  390. HRESULT CUINode::DeleteMultiselect(CDSComponentData* pComponentData, CInternalFormatCracker* pObjCracker)
  391. {
  392. HRESULT hr = S_OK;
  393. //
  394. // Multiselection should always delegate to the container
  395. //
  396. ASSERT(IsContainer());
  397. if (IsContainer())
  398. {
  399. for (UINT nIdx = 0; nIdx < pObjCracker->GetCookieCount(); nIdx++)
  400. {
  401. CUINode* pUINode = pObjCracker->GetCookie(nIdx);
  402. if (pUINode != NULL)
  403. {
  404. if (pUINode->IsContainer())
  405. {
  406. hr = pComponentData->RemoveContainerFromUI(pUINode);
  407. delete pUINode;
  408. }
  409. else
  410. {
  411. GetFolderInfo()->RemoveNode(pUINode);
  412. }
  413. }
  414. }
  415. }
  416. else
  417. {
  418. hr = S_FALSE;
  419. }
  420. return hr;
  421. }
  422. HRESULT CUINode::Rename(LPCWSTR lpszNewName, CDSComponentData* pComponentData)
  423. {
  424. HRESULT hr = S_OK;
  425. SetName(lpszNewName);
  426. hr = pComponentData->UpdateItem(this);
  427. return hr;
  428. }
  429. ////////////////////////////////////////////////////////////////////
  430. // CUINodeTableBase
  431. #define NUMBER_OF_COOKIE_TABLE_ENTRIES 4 // default count, expandable at run time
  432. CUINodeTableBase::CUINodeTableBase()
  433. {
  434. m_nEntries = NUMBER_OF_COOKIE_TABLE_ENTRIES;
  435. m_pCookieArr =(CUINode**)malloc(m_nEntries*sizeof(CUINode*));
  436. if (m_pCookieArr != NULL)
  437. {
  438. ZeroMemory(m_pCookieArr, m_nEntries*sizeof(CUINode*));
  439. }
  440. }
  441. CUINodeTableBase::~CUINodeTableBase()
  442. {
  443. free(m_pCookieArr);
  444. }
  445. void CUINodeTableBase::Add(CUINode* pNode)
  446. {
  447. ASSERT(!IsPresent(pNode));
  448. for (UINT k=0; k<m_nEntries; k++)
  449. {
  450. if (m_pCookieArr[k] == NULL)
  451. {
  452. m_pCookieArr[k] = pNode;
  453. return;
  454. }
  455. }
  456. // not space left, need to allocate
  457. int nAlloc = m_nEntries*2;
  458. CUINode** temp = (CUINode**)realloc(m_pCookieArr, sizeof(CUINode*)*nAlloc);
  459. if (temp)
  460. {
  461. m_pCookieArr = temp;
  462. ::ZeroMemory(&m_pCookieArr[m_nEntries], sizeof(CDSCookie*)*m_nEntries);
  463. m_pCookieArr[m_nEntries] = pNode;
  464. m_nEntries = nAlloc;
  465. }
  466. }
  467. BOOL CUINodeTableBase::Remove(CUINode* pNode)
  468. {
  469. for (UINT k=0; k<m_nEntries; k++)
  470. {
  471. if (m_pCookieArr[k] == pNode)
  472. {
  473. m_pCookieArr[k] = NULL;
  474. return TRUE; // found
  475. }
  476. }
  477. return FALSE; // not found
  478. }
  479. BOOL CUINodeTableBase::IsPresent(CUINode* pNode)
  480. {
  481. for (UINT k=0; k<m_nEntries; k++)
  482. {
  483. if (m_pCookieArr[k] == pNode)
  484. return TRUE;
  485. }
  486. return FALSE;
  487. }
  488. void CUINodeTableBase::Reset()
  489. {
  490. for (UINT k=0; k<m_nEntries; k++)
  491. {
  492. m_pCookieArr[k] = NULL;
  493. }
  494. }
  495. UINT CUINodeTableBase::GetCount()
  496. {
  497. UINT nCount = 0;
  498. for (UINT k=0; k<m_nEntries; k++)
  499. {
  500. if (m_pCookieArr[k] != NULL)
  501. nCount++;
  502. }
  503. return nCount;
  504. }
  505. ////////////////////////////////////////////////////////////////////
  506. // CUINodeQueryTable
  507. void CUINodeQueryTable::RemoveDescendants(CUINode* pNode)
  508. {
  509. // cannot do this while the cookie has a pending operation
  510. ASSERT(!IsPresent(pNode));
  511. // remove all the cookies that have the given cookie as parent
  512. // or ancestor,
  513. for (UINT k=0; k<m_nEntries; k++)
  514. {
  515. if (m_pCookieArr[k] != NULL)
  516. {
  517. CUINode* pAncestorNode = m_pCookieArr[k]->GetParent();
  518. while (pAncestorNode != NULL)
  519. {
  520. if (pAncestorNode == pNode)
  521. {
  522. m_pCookieArr[k] = NULL;
  523. }
  524. pAncestorNode = pAncestorNode->GetParent();
  525. }
  526. }
  527. }
  528. }
  529. BOOL CUINodeQueryTable::IsLocked(CUINode* pNode)
  530. {
  531. for (UINT k=0; k<m_nEntries; k++)
  532. {
  533. if (m_pCookieArr[k] != NULL)
  534. {
  535. // found the cookie itself?
  536. if (pNode == m_pCookieArr[k])
  537. return TRUE;
  538. // look if the cookie is an ancestor of the current cookie
  539. CUINode* pAncestorNode = m_pCookieArr[k]->GetParent();
  540. while (pAncestorNode != NULL)
  541. {
  542. if (pAncestorNode == pNode)
  543. return TRUE;
  544. pAncestorNode = pAncestorNode->GetParent();
  545. }
  546. }
  547. }
  548. return FALSE;
  549. }
  550. ////////////////////////////////////////////////////////////////////
  551. // CUINodeSheetTable
  552. void CUINodeSheetTable::BringToForeground(CUINode* pNode, CDSComponentData* pCD, BOOL bActivate)
  553. {
  554. ASSERT(pCD != NULL);
  555. ASSERT(pNode != NULL);
  556. //
  557. // look for the cookie itself and for all the cookies that have the
  558. // given cookie as parent or ancestor
  559. //
  560. for (UINT k=0; k<m_nEntries; k++)
  561. {
  562. if (m_pCookieArr[k] != NULL)
  563. {
  564. CUINode* pAncestorNode = m_pCookieArr[k];
  565. while (pAncestorNode != NULL)
  566. {
  567. if (pAncestorNode == pNode)
  568. {
  569. CString szADSIPath;
  570. if (IS_CLASS(pNode, DS_UI_NODE))
  571. {
  572. CDSCookie* pCookie = GetDSCookieFromUINode(pNode);
  573. if (pCookie != NULL)
  574. {
  575. pCD->GetBasePathsInfo()->ComposeADsIPath(szADSIPath, pCookie->GetPath());
  576. //
  577. // the first one will be also activated
  578. //
  579. TRACE(L"BringSheetToForeground(%s, %d)\n", (LPCWSTR)szADSIPath, bActivate);
  580. VERIFY(BringSheetToForeground((LPWSTR)(LPCWSTR)szADSIPath, bActivate));
  581. if (bActivate)
  582. {
  583. bActivate = FALSE;
  584. }
  585. }
  586. }
  587. }
  588. pAncestorNode = pAncestorNode->GetParent();
  589. }
  590. } // if
  591. } // for
  592. }
  593. /////////////////////////////////////////////////////////////////////////////
  594. // CGenericUINode
  595. CGenericUINode::CGenericUINode(
  596. NODETYPE newNodeType,
  597. CUINode* pParentNode) : CUINode(newNodeType, pParentNode)
  598. {
  599. m_nImage = 0;
  600. }
  601. CGenericUINode::CGenericUINode(const CGenericUINode& copyNode) : CUINode(copyNode)
  602. {
  603. m_nImage = copyNode.m_nImage;
  604. m_strName = copyNode.m_strName;
  605. m_strDesc = copyNode.m_strDesc;
  606. }
  607. LPCWSTR CGenericUINode::g_szNameXMLTag = L"NAME";
  608. LPCWSTR CGenericUINode::g_szDecriptionXMLTag = L"DESCRIPTION";
  609. HRESULT CGenericUINode::XMLSaveBase(IXMLDOMDocument* pXMLDoc,
  610. IXMLDOMNode* pXMLDOMNode)
  611. {
  612. HRESULT hr = XML_AppendTextDataNode(pXMLDoc, pXMLDOMNode, CGenericUINode::g_szNameXMLTag, GetName());
  613. RETURN_IF_FAILED(hr);
  614. hr = XML_AppendTextDataNode(pXMLDoc, pXMLDOMNode, CGenericUINode::g_szDecriptionXMLTag, GetDesc());
  615. return hr;
  616. }
  617. //////////////////////////////////////////////////////////////////////////////
  618. // CRootNode
  619. BOOL CRootNode::IsRefreshAllowed(CDSComponentData*, BOOL* pbHide)
  620. {
  621. *pbHide = FALSE;
  622. return TRUE;
  623. }
  624. CContextMenuVerbs* CRootNode::GetContextMenuVerbsObject(CDSComponentData* pComponentData)
  625. {
  626. TRACE(L"Entering CRootNode::GetContextMenuVerbsObject\n");
  627. if (m_pMenuVerbs == NULL)
  628. {
  629. TRACE(L"Create new CSnapinRootMenuVerbs object\n");
  630. m_pMenuVerbs = new CSnapinRootMenuVerbs(pComponentData);
  631. }
  632. return m_pMenuVerbs;
  633. }
  634. HRESULT CRootNode::OnCommand(long lCommandID, CDSComponentData* pComponentData)
  635. {
  636. HRESULT hr = S_OK;
  637. switch (lCommandID)
  638. {
  639. case IDM_GEN_TASK_SELECT_DOMAIN:
  640. case IDM_GEN_TASK_SELECT_FOREST:
  641. if (pComponentData->CanRefreshAll())
  642. {
  643. pComponentData->GetDomain();
  644. }
  645. break;
  646. case IDM_GEN_TASK_SELECT_DC:
  647. if (pComponentData->CanRefreshAll())
  648. {
  649. pComponentData->GetDC();
  650. }
  651. break;
  652. case IDM_VIEW_SERVICES_NODE:
  653. {
  654. if (pComponentData->CanRefreshAll())
  655. {
  656. ASSERT( SNAPINTYPE_SITE == pComponentData->QuerySnapinType() );
  657. pComponentData->GetQueryFilter()->ToggleViewServicesNode();
  658. pComponentData->SetDirty();
  659. if (pComponentData->GetRootNode()->GetFolderInfo()->IsExpanded())
  660. {
  661. pComponentData->Refresh(pComponentData->GetRootNode(), FALSE /*bFlushCache*/ );
  662. }
  663. }
  664. }
  665. break;
  666. case IDM_GEN_TASK_EDIT_FSMO:
  667. {
  668. pComponentData->EditFSMO();
  669. }
  670. break;
  671. case IDM_GEN_TASK_RAISE_VERSION:
  672. pComponentData->RaiseVersion();
  673. break;
  674. case IDM_VIEW_ADVANCED:
  675. {
  676. if (pComponentData->CanRefreshAll())
  677. {
  678. ASSERT( SNAPINTYPE_SITE != pComponentData->QuerySnapinType() );
  679. pComponentData->GetQueryFilter()->ToggleAdvancedView();
  680. pComponentData->SetDirty();
  681. if (pComponentData->GetRootNode()->GetFolderInfo()->IsExpanded())
  682. {
  683. pComponentData->Refresh(pComponentData->GetRootNode(), TRUE /*bFlushCache*/ );
  684. }
  685. }
  686. }
  687. break;
  688. case IDM_VIEW_COMPUTER_HACK:
  689. if (pComponentData->CanRefreshAll())
  690. {
  691. pComponentData->Lock();
  692. pComponentData->GetQueryFilter()->ToggleExpandComputers();
  693. pComponentData->Unlock();
  694. BOOL fDoRefresh = pComponentData->GetClassCache()->ToggleExpandSpecialClasses(pComponentData->GetQueryFilter()->ExpandComputers());
  695. pComponentData->SetDirty();
  696. if (fDoRefresh)
  697. {
  698. if (pComponentData->GetRootNode()->GetFolderInfo()->IsExpanded())
  699. {
  700. pComponentData->Refresh(pComponentData->GetRootNode(), TRUE /*bFlushCache*/ );
  701. }
  702. }
  703. }
  704. break;
  705. case IDM_VIEW_FILTER_OPTIONS:
  706. {
  707. if (pComponentData->CanRefreshAll())
  708. {
  709. if (pComponentData->GetQueryFilter()->EditFilteringOptions())
  710. {
  711. pComponentData->SetDirty();
  712. pComponentData->RefreshAll();
  713. }
  714. }
  715. }
  716. break;
  717. default:
  718. ASSERT(FALSE);
  719. break;
  720. }
  721. return hr;
  722. }
  723. CDSColumnSet* CRootNode::GetColumnSet(CDSComponentData* pComponentData)
  724. {
  725. CDSColumnSet* pColumnSet = NULL;
  726. if (IsContainer())
  727. {
  728. pColumnSet = GetFolderInfo()->GetColumnSet(SPECIAL_COLUMN_SET, pComponentData);
  729. }
  730. return pColumnSet;
  731. }