summaryrefslogtreecommitdiffstats
path: root/src/klomanager.h
blob: 1d6364f1086d64ac679b7d63881113cb7d5c145e (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 ([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 KLOMANAGER_H
#define KLOMANAGER_H

#include <tqdom.h>
#include <tqfont.h>

#include "datablocks/kreborder.h"

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

	static TQStringList classes();

protected:
	void processDocument( const TQDomDocument & );

	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 ){};

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

	bool getBoolAttribute( const TQDomElement &obj, const TQString &attr, bool defaultValue = true ) const;
	TQColor getColorAttribute( const TQDomElement &obj, const TQString &attr, const TQColor &defaultValue = TQt::white ) const;
	TQString getTextAttribute( const TQDomElement &obj, const TQString &attr, const TQString &defaultValue = TQString::null ) const;
	int getIntAttribute( const TQDomElement &obj, const TQString &attr, int defaultValue = 0 ) const;
	KreBorder getBorderAttribute( const TQDomElement &obj, const TQString &attr, const KreBorder &defaultValue = KreBorder() ) const;
	TQFont getFontAttribute( const TQDomElement &obj, const TQString &attr, const TQFont &defaultValue = TQFont() ) const;

	TQString alignmentAsCSS( int );
	TQString borderAsCSS( const KreBorder & );
	TQString bgColorAsCSS( const TQColor & );
	TQString fontAsCSS( const TQFont & );
	TQString textColorAsCSS( const TQColor & );
	TQString visibilityAsCSS( bool );

private:
	TQDomElement getLayoutAttribute( const TQDomElement &obj, const TQString &attr ) const;
};

#endif //KLOMANAGER_H