void CSimpleFilterDialog::SaveSelection(void)
{
	POSITION pos = m_ResultList.GetFirstSelectedItemPosition(); 

	
	//okopiruje vzorovy element selection
	MSXML2::IXMLDOMElementPtr selection_elem = m_active_element->ownerDocument->createElement("selection");
	MSXML2::IXMLDOMAttributePtr id_attr = m_active_element->ownerDocument->createAttribute("id");
	selection_elem->setAttributeNode(id_attr);
	id_attr.Release();
	
	//vymaze vsechny selection
	MSXML2::IXMLDOMNodeListPtr list = m_cloned_active_element->selectNodes("filter[@type='simple']/selection");
	MSXML2::IXMLDOMSelection * sel;
	list.QueryInterface(__uuidof(MSXML2::IXMLDOMSelection), &sel);
	sel->removeAll();
	sel->Release();

	MSXML2::IXMLDOMNodePtr filter = m_cloned_active_element->selectSingleNode("filter[@type='simple']");
	
	while (pos)
	{
		int nItem = m_ResultList.GetNextSelectedItem(pos);

		selection_elem->setAttribute("id", (LPCTSTR) m_ResultList.GetItemText(nItem, 0));
		filter->appendChild(selection_elem->cloneNode(VARIANT_FALSE));
	}

	selection_elem.Release();

}
예제 #2
0
Iterator<TimeEntry> * PlanEntryModelManager::IterateValues(BSTR xpath)
{
	MSXML2::IXMLDOMNodeList *pList = 0;
	HRESULT hr = m_pRoot->selectNodes(xpath, &pList);
	Iterator<TimeEntry> *pIter = 0;
	if(hr == S_OK && pList)
	{
		MSXML2::IXMLDOMSelection *pSelection = 0;
		hr = pList->QueryInterface(__uuidof(MSXML2::IXMLDOMSelection), reinterpret_cast<void **>(&pSelection));
		if(hr == S_OK && pSelection)
		{
			pIter = new PlanEntryIterator(pSelection);
			pSelection->Release();	
		}
		pList->Release();
	}
	return pIter;
}
예제 #3
0
Iterator<Annotation> * CTaskModel::ListAnnotations(bool)
{
	MSXML2::IXMLDOMNodeList *pList = 0;
	BSTR xpath = SysAllocString(_T("./annotation"));
	HRESULT hr = m_pNode->selectNodes(xpath, &pList);
	SysFreeString(xpath);
	Iterator<Annotation> *pIter = 0;
	if(hr == S_OK && pList)
	{
		MSXML2::IXMLDOMSelection *pSelection = 0;
		hr = pList->QueryInterface(__uuidof(MSXML2::IXMLDOMSelection), reinterpret_cast<void **>(&pSelection));
		if(hr == S_OK && pSelection)
		{
			pIter = new AnnotationIterator(pSelection);
			pSelection->Release();
		}
		pList->Release();
	}
	return pIter;
}