Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / embedding / browser / activex / src / common / IEHtmlElementCollection.h
blob999ea41ba26f1777bdce7e24902a817153be4700
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@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
38 #ifndef IEHTMLNODECOLLECTION_H
39 #define IEHTMLNODECOLLECTION_H
41 #include "nsIDOMHTMLCollection.h"
42 #include "nsIDOMNodeList.h"
44 #include "IEHtmlNode.h"
46 class CIEHtmlElement;
48 class CIEHtmlElementCollection :
49 public CNode,
50 public IDispatchImpl<IHTMLElementCollection, &IID_IHTMLElementCollection, &LIBID_MSHTML>
52 private:
53 // Hold a DOM node list
54 nsCOMPtr<nsIDOMNodeList> mDOMNodeList;
55 // Or hold a static collection
56 IDispatch **mNodeList;
57 PRUint32 mNodeListCount;
58 PRUint32 mNodeListCapacity;
60 public:
61 CIEHtmlElementCollection();
63 protected:
64 virtual ~CIEHtmlElementCollection();
65 virtual HRESULT FindOrCreateIEElement(nsIDOMNode* domNode, IHTMLElement** pIHtmlElement);
67 public:
68 // Adds a node to the collection
69 virtual HRESULT AddNode(IDispatch *pNode);
71 virtual HRESULT PopulateFromDOMHTMLCollection(nsIDOMHTMLCollection *pNodeList);
73 // Populates the collection with items from the DOM node
74 virtual HRESULT PopulateFromDOMNode(nsIDOMNode *pIDOMNode, BOOL bRecurseChildren);
76 // Helper method creates a collection from a parent node
77 static HRESULT CreateFromParentNode(CNode *pParentNode, BOOL bRecurseChildren, CIEHtmlElementCollection **pInstance);
79 // Helper method creates a collection from the specified HTML collection
80 static HRESULT CreateFromDOMHTMLCollection(CNode *pParentNode, nsIDOMHTMLCollection *pNodeList, CIEHtmlElementCollection **pInstance);
83 BEGIN_COM_MAP(CIEHtmlElementCollection)
84 COM_INTERFACE_ENTRY(IDispatch)
85 COM_INTERFACE_ENTRY(IHTMLElementCollection)
86 END_COM_MAP()
88 // IHTMLElementCollection methods
89 virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String);
90 virtual HRESULT STDMETHODCALLTYPE put_length(long v);
91 virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p);
92 virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p);
93 virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp);
94 virtual HRESULT STDMETHODCALLTYPE tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp);
97 typedef CComObject<CIEHtmlElementCollection> CIEHtmlElementCollectionInstance;
99 #endif