msxml3: Use xmlnode child object's IXMLDOMNode implementation as base interface.

The plan is to get rid of IXMLDOMNode interface in xmlnode object and use 
proper inheritance.
This commit is contained in:
Jacek Caban 2010-09-04 17:56:08 +02:00 committed by Alexandre Julliard
parent 8a82ae668a
commit 27b4f11c0b
10 changed files with 38 additions and 128 deletions

View File

@ -58,15 +58,12 @@ static HRESULT WINAPI domattr_QueryInterface(
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMAttribute ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;

View File

@ -59,15 +59,12 @@ static HRESULT WINAPI domcdata_QueryInterface(
if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) ||
IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
IsEqualGUID( riid, &IID_IXMLDOMElement ) )
{
@ -483,14 +480,13 @@ static HRESULT WINAPI domcdata_get_data(
IXMLDOMCDATASection *iface,
BSTR *p)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
HRESULT hr;
VARIANT vRet;
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet );
hr = IXMLDOMCDATASection_get_nodeValue( iface, &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);
@ -511,7 +507,7 @@ static HRESULT WINAPI domcdata_put_data(
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
return IXMLDOMCDATASection_put_nodeValue( iface, val );
}
static HRESULT WINAPI domcdata_get_length(

View File

@ -59,15 +59,12 @@ static HRESULT WINAPI domcomment_QueryInterface(
if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) ||
IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;
@ -486,7 +483,7 @@ static HRESULT WINAPI domcomment_get_data(
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet );
hr = IXMLDOMComment_get_nodeValue( iface, &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);

View File

@ -58,15 +58,12 @@ static HRESULT WINAPI domfrag_QueryInterface(
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentFragment ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;

View File

@ -425,7 +425,7 @@ static HRESULT WINAPI domdoc_IPersistStreamInit_Save(
TRACE("(%p)->(%p %d)\n", This, stream, clr_dirty);
hr = IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), &xmlString );
hr = IXMLDOMDocument3_get_xml( (IXMLDOMDocument3*)&This->lpVtbl, &xmlString );
if(hr == S_OK)
{
DWORD len = SysStringLen(xmlString) * sizeof(WCHAR);
@ -518,16 +518,13 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument3 *iface, REFIID rii
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
IsEqualGUID( riid, &IID_IXMLDOMDocument2 )||
IsEqualGUID( riid, &IID_IXMLDOMDocument3 ))
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if (IsEqualGUID(&IID_IPersistStream, riid) ||
IsEqualGUID(&IID_IPersistStreamInit, riid))
{
@ -1284,12 +1281,14 @@ static HRESULT WINAPI domdoc_createProcessingInstruction(
if (hr == S_OK)
{
VARIANT v_data;
xmlnode *node_obj;
/* this is to bypass check in ::put_data() that blocks "<?xml" PIs */
node_obj = get_node_obj(node);
V_VT(&v_data) = VT_BSTR;
V_BSTR(&v_data) = data;
hr = IXMLDOMNode_put_nodeValue( node, v_data );
hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(node_obj), v_data );
IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)pi);
IXMLDOMNode_Release(node);

View File

@ -65,15 +65,12 @@ static HRESULT WINAPI domelem_QueryInterface(
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = &This->lpVtbl;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;

View File

@ -58,15 +58,12 @@ static HRESULT WINAPI entityref_QueryInterface(
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMEntityReference ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;

View File

@ -115,55 +115,30 @@ static HRESULT WINAPI xmlnode_QueryInterface(
REFIID riid,
void** ppvObject )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if(This->iface)
return IXMLDOMNode_QueryInterface(This->iface, riid, ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown)) {
*ppvObject = iface;
}else if (IsEqualGUID( riid, &IID_IDispatch) ||
IsEqualGUID( riid, &IID_IXMLDOMNode)) {
*ppvObject = &This->lpVtbl;
}else if(node_query_interface(This, riid, ppvObject)) {
return *ppvObject ? S_OK : E_NOINTERFACE;
}else {
FIXME("interface %s not implemented\n", debugstr_guid(riid));
*ppvObject = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef( (IUnknown*)*ppvObject );
return S_OK;
ERR("Should not be called\n");
return E_NOINTERFACE;
}
static ULONG WINAPI xmlnode_AddRef(
IXMLDOMNode *iface )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
return IXMLDOMNode_AddRef(This->iface);
ERR("Should not be called\n");
return 2;
}
static ULONG WINAPI xmlnode_Release(
IXMLDOMNode *iface )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
return IXMLDOMNode_Release(This->iface);
ERR("Should not be called\n");
return 1;
}
static HRESULT WINAPI xmlnode_GetTypeInfoCount(
IXMLDOMNode *iface,
UINT* pctinfo )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_GetTypeInfo(
@ -172,14 +147,8 @@ static HRESULT WINAPI xmlnode_GetTypeInfo(
LCID lcid,
ITypeInfo** ppTInfo )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
HRESULT hr;
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
hr = get_typeinfo(IXMLDOMNode_tid, ppTInfo);
return hr;
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_GetIDsOfNames(
@ -190,25 +159,8 @@ static HRESULT WINAPI xmlnode_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
return E_INVALIDARG;
hr = get_typeinfo(IXMLDOMNode_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
ITypeInfo_Release(typeinfo);
}
return hr;
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_Invoke(
@ -222,22 +174,8 @@ static HRESULT WINAPI xmlnode_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr )
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IXMLDOMNode_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
return hr;
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_get_nodeName(
@ -556,7 +494,7 @@ static HRESULT WINAPI xmlnode_get_attributes(
*attributeMap = NULL;
return S_FALSE;
default:
*attributeMap = create_nodemap( iface );
*attributeMap = create_nodemap( This->iface );
return S_OK;
}
}
@ -764,7 +702,7 @@ static HRESULT WINAPI xmlnode_appendChild(
}
VariantInit(&var);
return IXMLDOMNode_insertBefore(iface, newChild, var, outNewChild);
return IXMLDOMNode_insertBefore(This->iface, newChild, var, outNewChild);
}
static HRESULT WINAPI xmlnode_hasChildNodes(
@ -1176,10 +1114,10 @@ static HRESULT WINAPI xmlnode_get_nodeTypedValue(
if(This->node->type == XML_ELEMENT_NODE ||
This->node->type == XML_TEXT_NODE ||
This->node->type == XML_ENTITY_REF_NODE)
hres = IXMLDOMNode_get_dataType(iface, &type);
hres = IXMLDOMNode_get_dataType(This->iface, &type);
if(hres != S_OK && This->node->type != XML_ELEMENT_NODE)
return IXMLDOMNode_get_nodeValue(iface, typedValue);
return IXMLDOMNode_get_nodeValue(This->iface, typedValue);
content = xmlNodeGetContent(This->node);
hres = VARIANT_from_xmlChar(content, typedValue,
@ -1566,7 +1504,7 @@ static HRESULT WINAPI xmlnode_selectSingleNode(
TRACE("(%p)->(%s %p)\n", This, debugstr_w(queryString), resultNode );
*resultNode = NULL;
r = IXMLDOMNode_selectNodes(iface, queryString, &list);
r = IXMLDOMNode_selectNodes(This->iface, queryString, &list);
if(r == S_OK)
{
r = IXMLDOMNodeList_nextNode(list, resultNode);

View File

@ -58,15 +58,12 @@ static HRESULT WINAPI dom_pi_QueryInterface(
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMProcessingInstruction ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;
@ -504,14 +501,13 @@ static HRESULT WINAPI dom_pi_get_data(
IXMLDOMProcessingInstruction *iface,
BSTR *p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
HRESULT hr = E_FAIL;
VARIANT vRet;
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet );
hr = IXMLDOMProcessingInstruction_get_nodeValue( iface, &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);
@ -548,7 +544,7 @@ static HRESULT WINAPI dom_pi_put_data(
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;
hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
hr = IXMLDOMProcessingInstruction_put_nodeValue( iface, val );
return hr;
}

View File

@ -60,15 +60,12 @@ static HRESULT WINAPI domtext_QueryInterface(
if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(&This->node);
}
else if(node_query_interface(&This->node, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;
@ -485,14 +482,13 @@ static HRESULT WINAPI domtext_get_data(
IXMLDOMText *iface,
BSTR *p)
{
domtext *This = impl_from_IXMLDOMText( iface );
HRESULT hr;
VARIANT vRet;
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet );
hr = IXMLDOMNode_get_nodeValue( iface, &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);