msxml3: Moved IDispatchEx implementation from domdoc to xmlnode.
This commit is contained in:
parent
881bea26a4
commit
7b30c79cfd
|
@ -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,78 +68,6 @@ extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *
|
|||
|
||||
extern xmlDocPtr parse_xml(char *ptr, int len);
|
||||
|
||||
/* IXMLDOMNode Internal Structure */
|
||||
typedef struct _xmlnode
|
||||
{
|
||||
const struct IXMLDOMNodeVtbl *lpVtbl;
|
||||
const struct IUnknownVtbl *lpInternalUnkVtbl;
|
||||
IUnknown *pUnkOuter;
|
||||
LONG ref;
|
||||
xmlNodePtr node;
|
||||
} xmlnode;
|
||||
|
||||
static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
|
||||
{
|
||||
return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl));
|
||||
}
|
||||
|
||||
static inline IXMLDOMNode *IXMLDOMNode_from_impl(xmlnode *This)
|
||||
{
|
||||
return (IXMLDOMNode*)&This->lpVtbl;
|
||||
}
|
||||
|
||||
extern xmlnode *create_basic_node(xmlNodePtr,IUnknown*);
|
||||
|
||||
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
|
||||
|
||||
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
|
||||
{
|
||||
BSTR ret = NULL;
|
||||
|
||||
if(str) {
|
||||
DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
|
||||
ret = SysAllocStringLen(NULL, len-1);
|
||||
if(ret)
|
||||
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void* libxslt_handle;
|
||||
#ifdef SONAME_LIBXSLT
|
||||
# ifdef HAVE_LIBXSLT_PATTERN_H
|
||||
# include <libxslt/pattern.h>
|
||||
# endif
|
||||
# ifdef HAVE_LIBXSLT_TRANSFORM_H
|
||||
# include <libxslt/transform.h>
|
||||
# endif
|
||||
# include <libxslt/xsltutils.h>
|
||||
# include <libxslt/xsltInternals.h>
|
||||
|
||||
# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
|
||||
MAKE_FUNCPTR(xsltApplyStylesheet);
|
||||
MAKE_FUNCPTR(xsltCleanupGlobals);
|
||||
MAKE_FUNCPTR(xsltFreeStylesheet);
|
||||
MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
||||
# undef MAKE_FUNCPTR
|
||||
#endif
|
||||
|
||||
extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
|
||||
LONG line, LONG linepos, LONG filepos );
|
||||
extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj);
|
||||
|
||||
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,
|
||||
|
@ -210,6 +138,79 @@ typedef struct {
|
|||
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;
|
||||
LONG ref;
|
||||
xmlNodePtr node;
|
||||
} xmlnode;
|
||||
|
||||
static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
|
||||
{
|
||||
return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl));
|
||||
}
|
||||
|
||||
static inline IXMLDOMNode *IXMLDOMNode_from_impl(xmlnode *This)
|
||||
{
|
||||
return (IXMLDOMNode*)&This->lpVtbl;
|
||||
}
|
||||
|
||||
extern xmlnode *create_basic_node(xmlNodePtr,IUnknown*,dispex_static_data_t*);
|
||||
|
||||
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
|
||||
|
||||
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
|
||||
{
|
||||
BSTR ret = NULL;
|
||||
|
||||
if(str) {
|
||||
DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
|
||||
ret = SysAllocStringLen(NULL, len-1);
|
||||
if(ret)
|
||||
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void* libxslt_handle;
|
||||
#ifdef SONAME_LIBXSLT
|
||||
# ifdef HAVE_LIBXSLT_PATTERN_H
|
||||
# include <libxslt/pattern.h>
|
||||
# endif
|
||||
# ifdef HAVE_LIBXSLT_TRANSFORM_H
|
||||
# include <libxslt/transform.h>
|
||||
# endif
|
||||
# include <libxslt/xsltutils.h>
|
||||
# include <libxslt/xsltInternals.h>
|
||||
|
||||
# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
|
||||
MAKE_FUNCPTR(xsltApplyStylesheet);
|
||||
MAKE_FUNCPTR(xsltCleanupGlobals);
|
||||
MAKE_FUNCPTR(xsltFreeStylesheet);
|
||||
MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
||||
# undef MAKE_FUNCPTR
|
||||
#endif
|
||||
|
||||
extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
|
||||
LONG line, LONG linepos, LONG filepos );
|
||||
extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
|
||||
extern HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj);
|
||||
|
||||
typedef struct bsc_t bsc_t;
|
||||
|
||||
HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
|
||||
void detach_bsc(bsc_t*);
|
||||
|
||||
/* 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);
|
||||
|
|
Loading…
Reference in New Issue