#ifndef HTML_MISCIMPL_H
#define HTML_MISCIMPL_H
#include "html_elementimpl.h"
#include "misc/shared.h"
namespace DOM {
class Node;
class DOMString;
class HTMLCollection;
class HTMLBaseFontElementImpl : public HTMLElementImpl
{
public:
HTMLBaseFontElementImpl(DocumentPtr *doc);
~HTMLBaseFontElementImpl();
virtual Id id() const;
};
class HTMLCollectionImpl : public khtml::Shared<HTMLCollectionImpl>
{
friend class DOM::HTMLCollection;
public:
enum Type {
DOC_IMAGES, DOC_APPLETS, DOC_FORMS, DOC_LINKS, DOC_ANCHORS, TABLE_ROWS, TABLE_TBODIES, TSECTION_ROWS, TR_CELLS, SELECT_OPTIONS,
MAP_AREAS,
DOC_ALL, NODE_CHILDREN };
HTMLCollectionImpl(NodeImpl *_base, int _tagId);
virtual ~HTMLCollectionImpl();
unsigned long length() const;
NodeImpl *item ( unsigned long index ) const;
virtual NodeImpl *firstItem() const;
virtual NodeImpl *nextItem() const;
NodeImpl *namedItem ( const DOMString &name, bool caseSensitive = true ) const;
NodeImpl *nextNamedItem( const DOMString &name ) const;
protected:
virtual unsigned long calcLength(NodeImpl *current) const;
virtual NodeImpl *getItem(NodeImpl *current, int index, int &pos) const;
virtual NodeImpl *getNamedItem(NodeImpl *current, int attr_id, const DOMString &name, bool caseSensitive = true) const;
virtual NodeImpl *nextNamedItemInternal( const DOMString &name ) const;
NodeImpl *base;
int type;
mutable NodeImpl *currentItem;
mutable bool idsDone;
};
class HTMLFormCollectionImpl : public HTMLCollectionImpl
{
public:
HTMLFormCollectionImpl(NodeImpl* _base)
: HTMLCollectionImpl(_base, 0)
{};
~HTMLFormCollectionImpl() { };
virtual NodeImpl *firstItem() const;
virtual NodeImpl *nextItem() const;
protected:
virtual unsigned long calcLength(NodeImpl* current) const;
virtual NodeImpl *getItem(NodeImpl *current, int index, int& pos) const;
virtual NodeImpl *getNamedItem(NodeImpl* current, int attr_id, const DOMString& name, bool caseSensitive) const;
virtual NodeImpl *nextNamedItemInternal( const DOMString &name ) const;
private:
NodeImpl* getNamedFormItem(int attr_id, const DOMString& name, int duplicateNumber, bool caseSensitive) const;
NodeImpl* getNamedImgItem(NodeImpl* current, int attr_id, const DOMString& name, int& duplicateNumber, bool caseSensitive) const;
mutable int currentPos;
};
};
#endif