/***************************************************************************
 *   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 SVGSERIALIZER_H
#define SVGSERIALIZER_H

#include "visitor.h"
#include <qstring.h>

class Attribute;
class Stylable;
class Transformable;
class Gradient;
/**
 * Serializes attributes to their SVG names
 * @author Hans Oischinger
 */
class SVGSerializer : public Visitor
{
public:
  SVGSerializer();
  ~SVGSerializer();

  QString serializeAttribute( ElementNode& element, Attribute* attr );

  virtual bool visit( VectorElement& element );
  virtual bool visit( GroupElement& element );
  virtual bool visit( DefsElement& element );
  virtual bool visit( UseElement& element );
  virtual bool visit( StopElement& element );
  virtual bool visit( LinearGradient& element );
  virtual bool visit( RadialGradient& element );
  virtual bool visit( AnimateTransformElement& element );
  virtual bool visit( AnimateLengthElement& element );
  virtual bool visit( AnimateNumberElement& element );

protected:
  bool processStylable( Stylable& element );
  bool processTransformable( Transformable& element );
  bool processGradient( Gradient& element );
  bool processElementNode( ElementNode& element );
  bool processAnimateElement( AnimateElement& element );

private:
  Attribute* m_attr; // Attribute to serialize
  QString m_svgAttribute; // serialized name of the attribute
};

#endif
