Commit 7b30c79c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msxml3: Moved IDispatchEx implementation from domdoc to xmlnode.

parent 881bea26
......@@ -556,7 +556,7 @@ IUnknown* create_attribute( xmlNodePtr attribute )
This->lpVtbl = &domattr_vtbl;
This->ref = 1;
node = create_basic_node( attribute, (IUnknown*)&This->lpVtbl );
node = create_basic_node( attribute, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -779,7 +779,7 @@ IUnknown* create_cdata( xmlNodePtr text )
This->lpVtbl = &domcdata_vtbl;
This->ref = 1;
node = create_basic_node( text, (IUnknown*)&This->lpVtbl );
node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -777,7 +777,7 @@ IUnknown* create_comment( xmlNodePtr comment )
This->lpVtbl = &domcomment_vtbl;
This->ref = 1;
node = create_basic_node( comment, (IUnknown*)&This->lpVtbl );
node = create_basic_node( comment, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -529,7 +529,7 @@ IUnknown* create_doc_fragment( xmlNodePtr fragment )
This->lpVtbl = &domfrag_vtbl;
This->ref = 1;
node = create_basic_node( fragment, (IUnknown*)&This->lpVtbl );
node = create_basic_node( fragment, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -77,9 +77,6 @@ typedef struct _domdoc
/* IObjectSafety */
DWORD safeopt;
/* IDispatchEx */
DispatchEx dispex;
} domdoc;
/*
......@@ -466,7 +463,7 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID rii
{
*ppvObject = &This->lpvtblISupportErrorInfo;
}
else if(dispex_query_interface(&This->dispex, riid, ppvObject))
else if(dispex_query_interface(&This->node->dispex, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;
}
......@@ -2218,15 +2215,13 @@ HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **docu
doc->safeopt = 0;
doc->bsc = NULL;
doc->node = create_basic_node( (xmlNodePtr)xmldoc, (IUnknown*)&doc->lpVtbl );
doc->node = create_basic_node( (xmlNodePtr)xmldoc, (IUnknown*)&doc->lpVtbl, &domdoc_dispex );
if(!doc->node)
{
HeapFree(GetProcessHeap(), 0, doc);
return E_FAIL;
}
init_dispex(&doc->dispex, (IUnknown*)&doc->lpVtbl, &domdoc_dispex);
*document = (IXMLDOMDocument2*)&doc->lpVtbl;
TRACE("returning iface %p\n", *document);
......
......@@ -762,7 +762,7 @@ IUnknown* create_element( xmlNodePtr element )
This->lpVtbl = &domelem_vtbl;
This->ref = 1;
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl );
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl, NULL );
if(!This->node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -528,7 +528,7 @@ IUnknown* create_doc_entity_ref( xmlNodePtr entity )
This->lpVtbl = &entityref_vtbl;
This->ref = 1;
node = create_basic_node( entity, (IUnknown*)&This->lpVtbl );
node = create_basic_node( entity, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -68,9 +68,80 @@ extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *
extern xmlDocPtr parse_xml(char *ptr, int len);
/* typelibs */
typedef enum tid_t {
IXMLDOMAttribute_tid,
IXMLDOMCDATASection_tid,
IXMLDOMComment_tid,
IXMLDOMDocument_tid,
IXMLDOMDocument2_tid,
IXMLDOMDocumentFragment_tid,
IXMLDOMElement_tid,
IXMLDOMEntityReference_tid,
IXMLDOMImplementation_tid,
IXMLDOMNamedNodeMap_tid,
IXMLDOMNode_tid,
IXMLDOMNodeList_tid,
IXMLDOMParseError_tid,
IXMLDOMProcessingInstruction_tid,
IXMLDOMSchemaCollection_tid,
IXMLDOMText_tid,
IXMLElement_tid,
IXMLDocument_tid,
IXMLHTTPRequest_tid,
IVBSAXAttributes_tid,
IVBSAXContentHandler_tid,
IVBSAXDeclHandler_tid,
IVBSAXDTDHandler_tid,
IVBSAXEntityResolver_tid,
IVBSAXErrorHandler_tid,
IVBSAXLexicalHandler_tid,
IVBSAXLocator_tid,
IVBSAXXMLFilter_tid,
IVBSAXXMLReader_tid,
IMXAttributes_tid,
IMXReaderControl_tid,
IMXWriter_tid,
LAST_tid
} tid_t;
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
extern void release_typelib(void);
typedef struct dispex_data_t dispex_data_t;
typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
#define MSXML_DISPID_CUSTOM_MIN 0x60000000
#define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
typedef struct {
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
} dispex_static_data_vtbl_t;
typedef struct {
const dispex_static_data_vtbl_t *vtbl;
const tid_t disp_tid;
dispex_data_t *data;
const tid_t* const iface_tids;
} dispex_static_data_t;
typedef struct {
const IDispatchExVtbl *lpIDispatchExVtbl;
IUnknown *outer;
dispex_static_data_t *data;
dispex_dynamic_data_t *dynamic_data;
} DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
/* IXMLDOMNode Internal Structure */
typedef struct _xmlnode
{
DispatchEx dispex;
const struct IXMLDOMNodeVtbl *lpVtbl;
const struct IUnknownVtbl *lpInternalUnkVtbl;
IUnknown *pUnkOuter;
......@@ -88,7 +159,7 @@ static inline IXMLDOMNode *IXMLDOMNode_from_impl(xmlnode *This)
return (IXMLDOMNode*)&This->lpVtbl;
}
extern xmlnode *create_basic_node(xmlNodePtr,IUnknown*);
extern xmlnode *create_basic_node(xmlNodePtr,IUnknown*,dispex_static_data_t*);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
......@@ -140,76 +211,6 @@ typedef struct bsc_t bsc_t;
HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
void detach_bsc(bsc_t*);
/* typelibs */
typedef enum tid_t {
IXMLDOMAttribute_tid,
IXMLDOMCDATASection_tid,
IXMLDOMComment_tid,
IXMLDOMDocument_tid,
IXMLDOMDocument2_tid,
IXMLDOMDocumentFragment_tid,
IXMLDOMElement_tid,
IXMLDOMEntityReference_tid,
IXMLDOMImplementation_tid,
IXMLDOMNamedNodeMap_tid,
IXMLDOMNode_tid,
IXMLDOMNodeList_tid,
IXMLDOMParseError_tid,
IXMLDOMProcessingInstruction_tid,
IXMLDOMSchemaCollection_tid,
IXMLDOMText_tid,
IXMLElement_tid,
IXMLDocument_tid,
IXMLHTTPRequest_tid,
IVBSAXAttributes_tid,
IVBSAXContentHandler_tid,
IVBSAXDeclHandler_tid,
IVBSAXDTDHandler_tid,
IVBSAXEntityResolver_tid,
IVBSAXErrorHandler_tid,
IVBSAXLexicalHandler_tid,
IVBSAXLocator_tid,
IVBSAXXMLFilter_tid,
IVBSAXXMLReader_tid,
IMXAttributes_tid,
IMXReaderControl_tid,
IMXWriter_tid,
LAST_tid
} tid_t;
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
extern void release_typelib(void);
typedef struct dispex_data_t dispex_data_t;
typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
#define MSXML_DISPID_CUSTOM_MIN 0x60000000
#define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
typedef struct {
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
} dispex_static_data_vtbl_t;
typedef struct {
const dispex_static_data_vtbl_t *vtbl;
const tid_t disp_tid;
dispex_data_t *data;
const tid_t* const iface_tids;
} dispex_static_data_t;
typedef struct {
const IDispatchExVtbl *lpIDispatchExVtbl;
IUnknown *outer;
dispex_static_data_t *data;
dispex_dynamic_data_t *dynamic_data;
} DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
/* memory allocation functions */
static inline void *heap_alloc(size_t len)
......
......@@ -1542,7 +1542,7 @@ static const struct IUnknownVtbl internal_unk_vtbl =
Internal_Release
};
xmlnode *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter )
xmlnode *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter, dispex_static_data_t *dispex_data )
{
xmlnode *This;
......@@ -1561,6 +1561,9 @@ xmlnode *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter )
else
This->pUnkOuter = (IUnknown *)&This->lpInternalUnkVtbl;
if(dispex_data)
init_dispex(&This->dispex, This->pUnkOuter, dispex_data);
This->ref = 1;
This->node = node;
......@@ -1599,7 +1602,7 @@ IXMLDOMNode *create_node( xmlNodePtr node )
break;
default:
FIXME("only creating basic node for type %d\n", node->type);
pUnk = (IUnknown*)&create_basic_node( node, NULL )->lpInternalUnkVtbl;
pUnk = (IUnknown*)&create_basic_node( node, NULL, NULL )->lpInternalUnkVtbl;
}
hr = IUnknown_QueryInterface(pUnk, &IID_IXMLDOMNode, (LPVOID*)&ret);
......
......@@ -614,7 +614,7 @@ IUnknown* create_pi( xmlNodePtr pi )
This->lpVtbl = &dom_pi_vtbl;
This->ref = 1;
node = create_basic_node( pi, (IUnknown*)&This->lpVtbl );
node = create_basic_node( pi, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -781,7 +781,7 @@ IUnknown* create_text( xmlNodePtr text )
This->lpVtbl = &domtext_vtbl;
This->ref = 1;
node = create_basic_node( text, (IUnknown*)&This->lpVtbl );
node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
{
HeapFree(GetProcessHeap(), 0, This);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment