Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / embedding / browser / activex / src / common / IEHtmlNode.h
blob827be1b884125a4963622b30ecec32b0d38c8ae0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Adam Lock <adamlock@eircom.net>
24 * Alexandre Trémon <atremon@elansoftware.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
39 #ifndef IEHTMLNODE_H
40 #define IEHTMLNODE_H
43 #include "nsCOMPtr.h"
44 #include "nsIDOMNode.h"
46 // NOTE: Nasty hack in case arcane SDK doesn't define IHTMLDOMNode
47 #ifndef __IHTMLDOMNode_INTERFACE_DEFINED__
48 #define __IHTMLDOMNode_INTERFACE_DEFINED__
49 MIDL_INTERFACE("3050f5da-98b5-11cf-bb82-00aa00bdce0b")
50 IHTMLDOMNode : public IDispatch
52 public:
53 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeType(
54 /* [out][retval] */ long *p) = 0;
56 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentNode(
57 /* [out][retval] */ IHTMLDOMNode **p) = 0;
59 virtual /* [id] */ HRESULT STDMETHODCALLTYPE hasChildNodes(
60 /* [out][retval] */ VARIANT_BOOL *fChildren) = 0;
62 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_childNodes(
63 /* [out][retval] */ IDispatch **p) = 0;
65 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
66 /* [out][retval] */ IDispatch **p) = 0;
68 virtual /* [id] */ HRESULT STDMETHODCALLTYPE insertBefore(
69 /* [in] */ IHTMLDOMNode *newChild,
70 /* [in][optional] */ VARIANT refChild,
71 /* [out][retval] */ IHTMLDOMNode **node) = 0;
73 virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild(
74 /* [in] */ IHTMLDOMNode *oldChild,
75 /* [out][retval] */ IHTMLDOMNode **node) = 0;
77 virtual /* [id] */ HRESULT STDMETHODCALLTYPE replaceChild(
78 /* [in] */ IHTMLDOMNode *newChild,
79 /* [in] */ IHTMLDOMNode *oldChild,
80 /* [out][retval] */ IHTMLDOMNode **node) = 0;
82 virtual /* [id] */ HRESULT STDMETHODCALLTYPE cloneNode(
83 /* [in] */ VARIANT_BOOL fDeep,
84 /* [out][retval] */ IHTMLDOMNode **clonedNode) = 0;
86 virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeNode(
87 /* [in][defaultvalue] */ VARIANT_BOOL fDeep,
88 /* [out][retval] */ IHTMLDOMNode **removed) = 0;
90 virtual /* [id] */ HRESULT STDMETHODCALLTYPE swapNode(
91 /* [in] */ IHTMLDOMNode *otherNode,
92 /* [out][retval] */ IHTMLDOMNode **swappedNode) = 0;
94 virtual /* [id] */ HRESULT STDMETHODCALLTYPE replaceNode(
95 /* [in] */ IHTMLDOMNode *replacement,
96 /* [out][retval] */ IHTMLDOMNode **replaced) = 0;
98 virtual /* [id] */ HRESULT STDMETHODCALLTYPE appendChild(
99 /* [in] */ IHTMLDOMNode *newChild,
100 /* [out][retval] */ IHTMLDOMNode **node) = 0;
102 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeName(
103 /* [out][retval] */ BSTR *p) = 0;
105 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_nodeValue(
106 /* [in] */ VARIANT v) = 0;
108 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeValue(
109 /* [out][retval] */ VARIANT *p) = 0;
111 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_firstChild(
112 /* [out][retval] */ IHTMLDOMNode **p) = 0;
114 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_lastChild(
115 /* [out][retval] */ IHTMLDOMNode **p) = 0;
117 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_previousSibling(
118 /* [out][retval] */ IHTMLDOMNode **p) = 0;
120 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nextSibling(
121 /* [out][retval] */ IHTMLDOMNode **p) = 0;
124 #endif
126 class CNode :
127 public CComObjectRootEx<CComMultiThreadModel>
129 protected:
130 CNode();
131 virtual ~CNode();
133 public:
134 CNode *mParent;
135 nsCOMPtr<nsIDOMNode> mDOMNode;
137 static HRESULT FindFromDOMNode(nsIDOMNode *pIDOMNode, CNode **pNode);
138 virtual HRESULT SetParent(CNode *pParent);
139 virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode);
142 class CIEHtmlDomNode :
143 public CNode,
144 public IDispatchImpl<IHTMLDOMNode, &__uuidof(IHTMLDOMNode), &LIBID_MSHTML>
146 public:
147 DECLARE_AGGREGATABLE(CIEHtmlDomNode)
148 CIEHtmlDomNode();
150 static HRESULT FindFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode);
151 static HRESULT FindOrCreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode);
152 static HRESULT CreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode);
153 virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode);
155 DECLARE_GET_CONTROLLING_UNKNOWN()
156 protected:
157 virtual ~CIEHtmlDomNode();
159 public:
161 BEGIN_COM_MAP(CIEHtmlDomNode)
162 COM_INTERFACE_ENTRY(IDispatch)
163 COM_INTERFACE_ENTRY(IHTMLDOMNode)
164 //COM_INTERFACE_ENTRY_FUNC(IID_IHTMLElement, 0, QueryInterfaceOnNode)
165 END_COM_MAP()
167 static HRESULT WINAPI QueryInterfaceOnNode(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
169 //IID_IHTMLDOMNode
170 virtual HRESULT STDMETHODCALLTYPE get_nodeType(long __RPC_FAR *p);
171 virtual HRESULT STDMETHODCALLTYPE get_parentNode(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p);
172 virtual HRESULT STDMETHODCALLTYPE hasChildNodes(VARIANT_BOOL __RPC_FAR *fChildren);
173 virtual HRESULT STDMETHODCALLTYPE get_childNodes(IDispatch __RPC_FAR *__RPC_FAR *p);
174 virtual HRESULT STDMETHODCALLTYPE get_attributes(IDispatch __RPC_FAR *__RPC_FAR *p);
175 virtual HRESULT STDMETHODCALLTYPE insertBefore(IHTMLDOMNode __RPC_FAR *newChild, VARIANT refChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node);
176 virtual HRESULT STDMETHODCALLTYPE removeChild(IHTMLDOMNode __RPC_FAR *oldChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node);
177 virtual HRESULT STDMETHODCALLTYPE replaceChild(IHTMLDOMNode __RPC_FAR *newChild, IHTMLDOMNode __RPC_FAR *oldChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node);
178 virtual HRESULT STDMETHODCALLTYPE cloneNode(VARIANT_BOOL fDeep, IHTMLDOMNode __RPC_FAR *__RPC_FAR *clonedNode);
179 virtual HRESULT STDMETHODCALLTYPE removeNode(VARIANT_BOOL fDeep, IHTMLDOMNode __RPC_FAR *__RPC_FAR *removed);
180 virtual HRESULT STDMETHODCALLTYPE swapNode(IHTMLDOMNode __RPC_FAR *otherNode, IHTMLDOMNode __RPC_FAR *__RPC_FAR *swappedNode);
181 virtual HRESULT STDMETHODCALLTYPE replaceNode(IHTMLDOMNode __RPC_FAR *replacement, IHTMLDOMNode __RPC_FAR *__RPC_FAR *replaced);
182 virtual HRESULT STDMETHODCALLTYPE appendChild(IHTMLDOMNode __RPC_FAR *newChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node);
183 virtual HRESULT STDMETHODCALLTYPE get_nodeName(BSTR __RPC_FAR *p);
184 virtual HRESULT STDMETHODCALLTYPE put_nodeValue(VARIANT p);
185 virtual HRESULT STDMETHODCALLTYPE get_nodeValue(VARIANT __RPC_FAR *p);
186 virtual HRESULT STDMETHODCALLTYPE get_firstChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p);
187 virtual HRESULT STDMETHODCALLTYPE get_lastChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p);
188 virtual HRESULT STDMETHODCALLTYPE get_previousSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p);
189 virtual HRESULT STDMETHODCALLTYPE get_nextSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p);
192 typedef CComObject<CIEHtmlDomNode> CIEHtmlDomNodeInstance;
194 #endif