/***************************************************************************
 *   Copyright (C) 2004 by Hans Oischinger                                 *
 *   hans.oischinger@kdemail.net                                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#ifndef DOCUMENTELEMENT_H
#define DOCUMENTELEMENT_H

#include "elementnode.h"

class QPoint;
class AnimatedLength;
class KCanvasItem;
/**
@author Hans Oischinger
*/
class DocumentElement : public ElementNode
{
  Q_OBJECT
public:
  DocumentElement( const QString & name = "" );
  ~DocumentElement();
  DocumentElement( const DocumentElement & );

  DocumentElement &operator=(const DocumentElement &);
  virtual ElementNode *clone();

  virtual Attribute* getAttrByName( const QString& name );
  Hit hits( const QPoint & );
  virtual QRect bbox( KCBBoxFlags flags = BBOX_DEFAULT ) const;
  virtual void accept( Visitor& visitor );

  KCanvasItem* context() const { return m_context; }
  void setContext( KCanvasItem* context ) { m_context = context; }

  ElementNode* findElementByRef( const QString& ref );

  // Attributes
  AnimatedLength &x() const { return *m_x; }
  AnimatedLength &y() const { return *m_y; }
  AnimatedLength &width() const { return *m_width; }
  AnimatedLength &height() const { return *m_height; }

private:
  AnimatedLength *m_x;
  AnimatedLength *m_y;
  AnimatedLength *m_width;
  AnimatedLength *m_height;
  KCanvasItem *m_context;
};

#endif
