summaryrefslogtreecommitdiffstats
path: root/krecipes/src/klomanager.h
blob: ed90771b55b95827c91c4212b2064d3c5bf1bade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
*   Copyright (C) 2006 by                                                 *
*   Jason Kivlighn (jkivlighn@gmail.com)                                  *
*                                                                         *
*   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 KLOMANAGER_H
#define KLOMANAGER_H

#include <qdom.h>
#include <qfont.h>

#include "datablocks/kreborder.h"

class KLOManager
{
public:
	KLOManager();
	virtual ~KLOManager();

	static QStringList classes();

protected:
	void processDocument( const QDomDocument & );

	virtual void loadBackgroundColor( const QString &/*obj*/, const QColor& ){};
	virtual void loadFont( const QString &/*obj*/, const QFont& ){};
	virtual void loadTextColor( const QString &/*obj*/, const QColor& ){};
	virtual void loadVisibility( const QString &/*obj*/, bool ){};
	virtual void loadAlignment( const QString &/*obj*/, int ){};
	virtual void loadBorder( const QString &/*obj*/, const KreBorder& ){};
	virtual void loadColumns( const QString &/*obj*/, int ){};

	virtual void beginObject( const QString &/*obj*/ ){};
	virtual void endObject(){};

	bool getBoolAttribute( const QDomElement &obj, const QString &attr, bool defaultValue = true ) const;
	QColor getColorAttribute( const QDomElement &obj, const QString &attr, const QColor &defaultValue = Qt::white ) const;
	QString getTextAttribute( const QDomElement &obj, const QString &attr, const QString &defaultValue = QString::null ) const;
	int getIntAttribute( const QDomElement &obj, const QString &attr, int defaultValue = 0 ) const;
	KreBorder getBorderAttribute( const QDomElement &obj, const QString &attr, const KreBorder &defaultValue = KreBorder() ) const;
	QFont getFontAttribute( const QDomElement &obj, const QString &attr, const QFont &defaultValue = QFont() ) const;

	QString alignmentAsCSS( int );
	QString borderAsCSS( const KreBorder & );
	QString bgColorAsCSS( const QColor & );
	QString fontAsCSS( const QFont & );
	QString textColorAsCSS( const QColor & );
	QString visibilityAsCSS( bool );

private:
	QDomElement getLayoutAttribute( const QDomElement &obj, const QString &attr ) const;
};

#endif //KLOMANAGER_H