-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMmlDocument.h
95 lines (69 loc) · 2.09 KB
/
MmlDocument.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef MMLDOCUMENT_H
#define MMLDOCUMENT_H
#include "Mml.h"
#include "MmlNode.h"
#include "MmlFont.h"
#include <QDomDocument>
#include <QMap>
#include <QColor>
#include <QSizeF>
#include <QString>
#include <QRect>
#include <QPainter>
class MmlNode;
class MmlDocument : public Mml
{
public:
MmlDocument();
~MmlDocument();
void clear();
bool setContent( const QString &text, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0 );
void paint( QPainter *painter, const QPointF &pos );
void dump() const;
QSizeF size() const;
void layout();
QString fontName( MmlFont::Font type ) const;
void setFontName( MmlFont::Font type, const QString &name );
double baseFontPointSize() const
{
return m_base_font_point_size;
}
void setBaseFontPointSize( double size )
{
m_base_font_point_size = size;
}
QColor foregroundColor() const
{
return m_foreground_color;
}
void setForegroundColor( const QColor &color )
{
m_foreground_color = color;
}
QColor backgroundColor() const
{
return m_background_color;
}
void setBackgroundColor( const QColor &color )
{
m_background_color = color;
}
private:
void _dump( const MmlNode *node, const QString &indent ) const;
bool insertChild( MmlNode *parent, MmlNode *new_node, QString *errorMsg );
void insertOperator( MmlNode *node, const QString &text );
MmlNode *domToMml( const QDomNode &dom_node, bool *ok, QString *errorMsg );
MmlNode *createNode( Mml::NodeType type, const MmlAttributeMap &mml_attr, const QString &mml_value, QString *errorMsg );
MmlNode *createImplicitMrowNode( const QDomNode &dom_node, bool *ok, QString *errorMsg );
MmlNode *m_root_node;
QString m_normal_font_name;
QString m_fraktur_font_name;
QString m_sans_serif_font_name;
QString m_script_font_name;
QString m_monospace_font_name;
QString m_doublestruck_font_name;
double m_base_font_point_size;
QColor m_foreground_color;
QColor m_background_color;
};
#endif // MMLDOCUMENT_H