diff options
Diffstat (limited to 'src/exporters/htmlexporter.h')
-rw-r--r-- | src/exporters/htmlexporter.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/exporters/htmlexporter.h b/src/exporters/htmlexporter.h new file mode 100644 index 0000000..95cee4c --- /dev/null +++ b/src/exporters/htmlexporter.h @@ -0,0 +1,78 @@ +/*************************************************************************** +* Copyright (C) 2003-2006 by * +* Jason Kivlighn ([email protected] * +* * +* 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. * +***************************************************************************/ + +#ifndef HTMLEXPORTER_H +#define HTMLEXPORTER_H + +#include <tqdom.h> +#include <tqmap.h> + +#include "baseexporter.h" +#include "klomanager.h" + +class RecipeDB; +class KProgress; + +/** + * Exports a given recipe list as HTML + * @author Jason Kivlighn + */ +class HTMLExporter : public BaseExporter, protected KLOManager +{ +public: + HTMLExporter( const TQString&, const TQString& ); + virtual ~HTMLExporter(); + + virtual int supportedItems() const; + + static void removeHTMLFiles( const TQString &filename, int recipe_id ); + static void removeHTMLFiles( const TQString &filename, const TQValueList<int> &recipe_ids ); + + void setTemplate( const TQString &filename ); + void setStyle( const TQString &filename ); + +protected: + TQString createContent( const Recipe& recipe ); + virtual TQString createContent( const RecipeList & ); + virtual TQString createHeader( const RecipeList & ); + virtual TQString createFooter(); + + virtual int progressInterval() const { return 1; } + + virtual void loadBackgroundColor( const TQString &obj, const TQColor& ); + virtual void loadFont( const TQString &obj, const TQFont& ); + virtual void loadTextColor( const TQString &obj, const TQColor& ); + virtual void loadVisibility( const TQString &obj, bool ); + virtual void loadAlignment( const TQString &obj, int ); + virtual void loadBorder( const TQString &obj, const KreBorder& ); + virtual void loadColumns( const TQString & obj, int cols ); + + virtual void beginObject( const TQString &obj ); + virtual void endObject(); + + static TQString escape( const TQString & ); + + TQString m_templateContent; + +private: + void storePhoto( const Recipe &recipe ); + void populateTemplate( const Recipe &recipe, TQString &content ); + void replaceIfVisible( TQString &content, const TQString &name, const TQString &html ); + TQString HTMLIfVisible( const TQString &name, const TQString &html ); + + TQString m_layoutFilename; + TQString m_templateFilename; + TQString m_cachedCSS; + TQMap<TQString,bool> m_visibilityMap; + TQMap<TQString,int> m_columnsMap; + bool m_error; +}; + +#endif //HTMLEXPORTER_H |