Mozilla/mozilla/webshell/embed/ActiveX/IEHtmlElementCollection.h
locka%iol.ie bb2149d8a5 Added recursion to methods so that get_all operation on IHtmlDocument finally works the way its supposed to (sort of)
git-svn-id: svn://10.0.0.236/trunk@47120 18797224-902f-48f8-a5cc-f745e15eee43
1999-09-13 13:06:58 +00:00

80 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef IEHTMLNODECOLLECTION_H
#define IEHTMLNODECOLLECTION_H
#include "IEHtmlNode.h"
class CIEHtmlElement;
class CIEHtmlElementCollection : public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IHTMLElementCollection, &IID_IHTMLElementCollection, &LIBID_MSHTML>
{
public:
typedef std::vector< CIPtr(IDispatch) > ElementList;
private:
ElementList m_cNodeList;
public:
CIEHtmlElementCollection();
protected:
virtual ~CIEHtmlElementCollection();
// Pointer to parent node/document
IDispatch *m_pIDispParent;
public:
// Adds a node to the collection
virtual HRESULT AddNode(IDispatch *pNode);
// Sets the parent node of this collection
virtual HRESULT SetParentNode(IDispatch *pIDispParent);
// Populates the collection with items from the DOM node
virtual HRESULT PopulateFromDOMNode(nsIDOMNode *pIDOMNode, BOOL bRecurseChildren);
// Helper method creates a collection from a parent node
static HRESULT CreateFromParentNode(CIEHtmlNode *pParentNode, CIEHtmlElementCollection **pInstance, BOOL bRecurseChildren = FALSE);
ElementList &GetElements()
{
return m_cNodeList;
}
BEGIN_COM_MAP(CIEHtmlElementCollection)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLElementCollection)
COM_INTERFACE_ENTRY_IID(IID_IHTMLElementCollection, IHTMLElementCollection)
END_COM_MAP()
// IHTMLElementCollection methods
virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String);
virtual HRESULT STDMETHODCALLTYPE put_length(long v);
virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p);
virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p);
virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp);
virtual HRESULT STDMETHODCALLTYPE tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp);
};
typedef CComObject<CIEHtmlElementCollection> CIEHtmlElementCollectionInstance;
#endif