示例#1
0
int CLXUITabsElement::get_selectedIndex() const
{
	return m_selectedIndex;

#if 0
	long n = 0;
	for (int i = 0; i < m_childNodes->m_items.GetSize(); i++)
	{
		CComQIPtr<ILDOMElement> tab = m_childNodes->m_items[i];
		if (tab)
		{
			CComBSTR selected;
			tab->getAttribute(L"selected", &selected);
			if (!cmpbstr(selected, L"true"))
			{
				*pVal = n;
				return S_OK;
			}
			n++;
		}
	}
#endif
}
SVGElementDefElement* SVGExtensionDefsElement::GetElementDef(StringIn namespaceURI, StringIn name)
{
	ASSERT(0);
#if 0
	if (pVal == NULL) return E_POINTER;
	*pVal = NULL;

	CComBSTR namespaceAttr;
	getAttribute(L"namespace", &namespaceAttr);
	if (!cmpbstr(namespaceAttr, namespaceURI))
	{
		for (int i = 0; i < m_childNodes->m_items.GetSize(); i++)
		{
			CComQIPtr<ILSVGElementDefElement> elementDef = m_childNodes->m_items[i];
			if (elementDef)
			{
				CComBSTR nameAttr;
				elementDef->getAttribute(L"name", &nameAttr);

				if (!cmpbstr(nameAttr, name))
				{
					*pVal = elementDef;
					(*pVal)->AddRef();
					return S_OK;
				}
			}
		}
	}

#if 0
	{
		BSTR clsidstr;  getAttribute(L"classid", &clsidstr);
		if (!clsidstr) return;

	// TODO, allow white-space

		if (!wcsnicmp(clsidstr, L"clsid:", 6))
		{
			_bstr_t classid = _bstr_t(clsidstr + lstrlen("clsid:"));

			if (((BSTR)classid)[0] != L'{')	// }
			{
				classid = L"{" + classid + L"}";
			}

			CLSID	clsid;
			HRESULT hr = CLSIDFromString(classid, &clsid);

			m_factory.CoCreateInstance(clsid);
		}
	}
#endif

	CComBSTR href;
	getAttributeNS(L"http://www.w3.org/1999/xlink", L"href", &href);

	if (href.Length())
	{
		if (m_hrefDocument == NULL)	// Loading for first time
		{
			WCHAR url[4096];
			wcscpy(url, href);

			WCHAR* id = NULL;
			int i = href.Length()-1;
			while (i >= 0)
			{
				if (url[i] == L'#')
				{
					url[i] = 0;
					id = &url[i+1];
					break;
				}
				i--;
			}

			TCHAR result[2048];
			{
				CComBSTR documentUrl;
				m_ownerDocument->get_url(&documentUrl);

				DWORD resultLen = sizeof(result);
				InternetCombineUrl(_bstr_t(documentUrl), _bstr_t(url), result, &resultLen, 0);
			}

			m_hrefDocument.CoCreateInstance(CLSID_LDOMDocument);
			if (m_hrefDocument)
			{
				bool bsuccess;
				m_hrefDocument->load(_variant_t(result), &bsuccess);

				{
					CScriptSite* pScriptSite = CComQIPtr<CLDOMDocumentImplImpl>(m_hrefDocument)->m_pScriptSite;

					HRESULT hr;

					// Start running scripts
					hr = pScriptSite->m_activeScript->SetScriptState(SCRIPTSTATE_STARTED);
					ASSERT(SUCCEEDED(hr));

				// force the engine to connect any outbound interfaces to the 
				// host's objects
					hr = pScriptSite->m_activeScript->SetScriptState(SCRIPTSTATE_CONNECTED);
					ASSERT(SUCCEEDED(hr));
				}

				if (id)
				{
					CComPtr<ILDOMElement> element;
					m_hrefDocument->getElementById(id, &element);

					m_extensionDefsElement = CComQIPtr<ILSVGExtensionDefsElement>(element);
				}
			}
		}

		if (m_extensionDefsElement)
		{
			return static_cast<CLSVGExtensionDefsElement*>(m_extensionDefsElement.p)->GetElementDef(namespaceURI, name, pVal);
		}
	}
#endif
	return NULL;
}
示例#3
0
Node* Node::insertNode(Node* _newChild, Node* _pBefore)
{
	ChildNode* newChild = dynamic_cast<ChildNode*>(_newChild);
	ChildNode* pBefore = dynamic_cast<ChildNode*>(_pBefore);

	Node* pPrevParent = newChild->get_parentNode();
	if (pPrevParent)
	{
		pPrevParent->removeChild(newChild);
	}

	ChildNode* pAfter;

	if (pBefore)
		pAfter = pBefore->get_previousSibling();
	else
		pAfter = m_lastChild;

	newChild->set_nextSibling(pBefore);
	newChild->set_previousSibling(pAfter);

	if (pAfter == NULL)
		m_firstChild = newChild;
	else
		pAfter->set_nextSibling(newChild);

	if (pBefore == NULL)
		m_lastChild = newChild;
	else
		pBefore->set_previousSibling(newChild);

	if (pBefore)
	{
		for (int i = 0; i < m_childNodes->m_items.GetSize(); i++)
		{
			if (m_childNodes->m_items[i] == pBefore)
			{
				m_childNodes->m_items.InsertAt(i, newChild);
			//	m_childNodes->m_items.insert(&m_childNodes->m_items[i], newChild);
				break;
			}
		}
	}
	else
	{
		m_childNodes->m_items.Add(newChild);
	}

// Set new child node's parent to this element
	newChild->set_parentNode(this);

//	TRACE("TODO\n");
#if 0
// Update computed xmlspace for inserted child(ren)
	CComQIPtr<ILDOMElement> newElement((IUnknown*)newChild);
	if (newElement)
	{
		CComBSTR xmlspace;
		newElement->getAttribute(OLESTR("xml:space"), &xmlspace);
		if (xmlspace.Length()==0)	// inherit from parent
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = m_xmlspace;
		}
		else	// explicitly set
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = cmpbstr(xmlspace, OLESTR("preserve")) == 0;
		}
	// TODO, update recursively for newChild
	}
#endif
	// SMIL Animation (TODO, not very well thought trough)
#if 0
	{
		CLDOMDocument* pDocument = static_cast<CLDOMDocument*>(static_cast<CLDOMDocumentImpl<ILDOMDocument>*>(m_ownerDocument));

		if (pDocument)
		{
			CComQIPtr<ILDOMElement> newElement = newChild;

			if (newElement)
			{
			// SMIL Animation (connect animate/set etc. elements to the elements they target)
				pDocument->BuildAnimationListForAllElements(newElement, pDocument->m_documentElement);

			// Set baseVal/animVal from attributes and parse 'style' attributes
				pDocument->UpdateAnimationElements(newElement);
			}
		}
	}
#endif

//	TRACE("TODO\n");
#if 0
	// Timing stuff (TODO)
	{
		ElementTimeImplImpl* elementTimeImpl((IUnknown*)newChild);
		if (elementTimeImpl)
		{
			elementTimeImpl->CalculateTimeBeforeParent();

			CComPtr<ILElementTimeContainer> parentTimeContainer;
			elementTimeImpl->get_parentTimeContainer(&parentTimeContainer);
			CComQIPtr<CLElementTimeContainerImplImpl> parentTimeContainerImpl((IUnknown*)parentTimeContainer);
			if (parentTimeContainerImpl)
			{
				parentTimeContainerImpl->RecalculateTime();
			}

			elementTimeImpl->CalculateTimeAfterParent();
		}
	}

	CComQIPtr<ILAnimationElement, &IID_ILAnimationElement> animation = (IUnknown*)newChild;
	if (animation)
	{
		CComQIPtr<CLAnimationElementImplImpl> pAnimation((IUnknown*)animation);

		pAnimation->SetValuesFromAttributes();
	}
#endif

	{
#if 0	// TODO
		for (int i = 0; i < m_pNodes.GetSize(); i++)
		{
			ASSERT(0);
			m_pNodes[i]->OnInsertedChild(newChild);
		}
#endif

#if 0
		if (TRUE)	// TODO, probably remove this (use above loop only)
		{
			CComQIPtr<INotifySend, &IID_INotifySend> cp = newChild;
			if (cp)
			{
				CComQIPtr<INotifyGet, &IID_INotifyGet> get = (IUnknown*)thisNode;
				if (get)
				{
					DWORD cookie;
					cp->Advise(get, &cookie);
				}

				cp->FireOnChanged(NOTIFY_ADD, newChild, DISPID_UNKNOWN);
			}
		}
#endif
	}

//	CComPtr<ILDOMDocument> ownerDocument;
//	newChild->get_ownerDocument(&ownerDocument);
//	if (ownerDocument)
	{
////////////////////////////////
// create an event notification

		DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(m_ownerDocument);

		if (ownerDocumentEvent == NULL)
			ownerDocumentEvent = dynamic_cast<DocumentEvent*>(this);

		if (ownerDocumentEvent)
		{
			MutationEvent* event = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));

			EventTarget* eventTarget = dynamic_cast<EventTarget*>(newChild);

		//
			event->initMutationEvent(S("DOMNodeInserted"), true, false, this, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);

			bool doDefault = eventTarget->dispatchEvent(event);

			if (IsDocumentOrPartOfDocument(this))
			{
			// Send "DOMNodeInsertedIntoDocument" to the node and it's children
				NodeInsertedIntoDocument(newChild);
			}
		}

		{
			Node* p = this;
			while (p)
			{
				if (p->m_pNode)
				{
					p->m_pNode->m_bArrangeValid = false;
				}

				p = p->get_parentNode();
			}
		}

#if 0
	//
		event->initMutationEvent(OLESTR("DOMSubtreeModified"), VARIANT_TRUE, VARIANT_FALSE, thisNode, NULL, NULL, NULL, CHANGE_UNKNOWN);
		eventTarget->dispatchEvent(event, &doDefault);
#endif
	}

	return newChild;
}
示例#4
0
HRESULT CXMLKeyFrameValuesDlg::GetPathNodeValue(BSTR path, BSTR* pVal)
{
#if 0
	CComPtr<IESelectedAnimationElement> selectedElement;

	long ncount;
	selectedElement->GetSelectedKeyTimesCount(&ncount);

	CComBSTR value;

	for (int i = 0; i < ncount; i++)
	{
		long keyFrame;
		selectedElement->GetKeyTimeSelected(i, &keyFrame);

		ILSMILAnimationTarget* animationTarget;

		CComPtr<ILAnimateXXXElement> animateXXX;

		//CComPtr<ILSMILXMLAttr> attr;
		//animationTarget->animatableXMLAttrItemByName(L"", &attribute);

		CComPtr<ILSMILAttributeValue> attributeValue;
		animateXXX->GetValue(keyFrame, &attributeValue);

		CComBSTR value2;
		attributeValue->getStringValue(&value2);

		if (i == 0)
		{
			value = value2;
		}
		else if (wcscmp(value, value2))
		{
			value.Empty();
			break;
		}
	}
#endif

	long ncount;
	m_viewGroup->GetSelectedCount(&ncount);

	for (int i = 0; i < ncount; i++)
	{
		CComPtr<IESelectedElement> selectedElement;
		m_viewGroup->GetSelectedElementN(i, &selectedElement);

		CComPtr<IEElement> eElement;
		selectedElement->get_eElement(&eElement);

		CComPtr<ILDOMElement> domElement;
		eElement->get_domElement(&domElement);

		CComBSTR attributeName;
		domElement->getAttribute(L"attributeName", &attributeName);

		CComQIPtr<IESelectedAnimationElement> selectedAnimationElement = selectedElement;

		//if (wcscmp(attributeName, 
		if (selectedAnimationElement)//TRUE)	// TODO
		{
			//CComQIPtr<ILSMILAnimationTarget> animationTarget = animationTarget;

			CComQIPtr<ILAnimateXXX> animateXXX = domElement;

			long ncount;
			selectedAnimationElement->GetSelectedKeyTimesCount(&ncount);

			CComBSTR value;

			for (int i = 0; i < ncount; i++)
			{
				long keyFrame;
				selectedAnimationElement->GetKeyTimeSelected(i, &keyFrame);

				//CComPtr<ILSMILXMLAttr> attr;
				//animationTarget->animatableXMLAttrItemByName(L"", &attribute);

				CComPtr<ILSMILAttributeValue> attributeValue;
				animateXXX->GetValue(keyFrame, &attributeValue);

				CComBSTR value2;
				if (attributeValue)
					attributeValue->getStringValue(&value2);

				if (i == 0)
				{
					value = value2;
				}
				else if (cmpbstr(value, value2))
				{
					value.Empty();
					break;
				}
			}

			*pVal = value.Detach();
			return S_OK;
		}

/*
		CComBSTR value2;
		::GetPathNodeValue(domElement, path, &value2);

		if (i == 0)
		{
			value = value2;
		}
		else if (wcscmp(value, value2))
		{
			value.Empty();
			break;
		}
		*/
	}


	return S_OK;
}
示例#5
0
void CXMLControlsHandler::UpdateData(CXMLData* pData)
{
	if (m_reentrancy == 0)
	{
		m_reentrancy++;

	//	long ncount;
	//	m_viewGroup->GetSelectedCount(&ncount);

		CComBSTR value;
		GetPathNodeValue(pData->m_name, &value);

#if 0
		for (int i = 0; i < ncount; i++)
		{
			CComPtr<IESelectedElement> selectedElement;
			m_viewGroup->GetSelectedElementN(i, &selectedElement);

			CComPtr<IEElement> eElement;
			selectedElement->get_eElement(&eElement);

			CComPtr<ILDOMElement> domElement;
			eElement->get_domElement(&domElement);

			CComBSTR value2 = pData->GetDataValue(domElement);

			if (i == 0)
			{
				value = value2;
			}
			else if (wcscmp(value, value2))
			{
				value.Empty();
				break;
			}
		}
#endif

		pData->SetValue(value);

		m_reentrancy--;
	}

#if 0
	if (m_reentrancy == 0)
	{
		m_reentrancy++;

		long ncount;
		m_viewGroup->GetSelectedCount(&ncount);

		CComBSTR value;

		for (int i = 0; i < ncount; i++)
		{
			CComPtr<IESelectedElement> selectedElement;
			m_viewGroup->GetSelectedElementN(i, &selectedElement);

			CComPtr<IEElement> eElement;
			selectedElement->get_eElement(&eElement);

			CComPtr<ILDOMElement> domElement;
			eElement->get_domElement(&domElement);

			//CComBSTR value2 = pData->GetDataValue(domElement);
			CComBSTR value2;
			::GetPathNodeValue(domElement, pData->m_name, &value2);

			if (i == 0)
			{
				value = value2;
			}
			else if (cmpbstr(value, value2))
			{
				value.Empty();
				break;
			}
		}

		pData->SetValue(value);

		m_reentrancy--;
	}
#endif
}