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
96
97
98
99
100
101
|
/* This file is part of the KDE project
Copyright (C) 2001 Andrea Rizzi <[email protected]>
Ulrich Kuettler <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KFORMULAMATHMLREAD_H
#define KFORMULAMATHMLREAD_H
#include <tqobject.h>
#include <tqdom.h>
#include "kformulainputfilter.h"
#include "contextstyle.h"
KFORMULA_NAMESPACE_BEGIN
class MathML2KFormulaPrivate;
/**
* This class converts MathML to KFormula XML.
* Right now are only parts of the Presentation Markup implemented.
*/
class MathML2KFormula : public KFInputFilter
{
Q_OBJECT
TQ_OBJECT
friend class MathML2KFormulaPrivate;
public:
/**
* Build a MathML 2 KFormula converter.
* call startConversion() to convert and wait for
* a conversionFinished() signal, then call
* getKFormulaDom() to get the converted DOM
*/
MathML2KFormula( const TQDomDocument& mmldoc, const ContextStyle &contextStyle, bool oasisFormat = false );
/**
* Build a MathML 2 KFormula converter.
* A DOM Element is required instead of a full Document, useful for embedded MathML
*/
MathML2KFormula( const TQDomElement& mmelm, const ContextStyle &contextStyle, bool oasisFormat = false );
/*
* Get the just created DOM.
*/
virtual TQDomDocument getKFormulaDom();
public slots:
virtual void startConversion();
public:
/// Has an error happened while converting?
bool m_error;
private:
bool processElement( TQDomNode node, TQDomDocument& doc,
TQDomNode docnode );
TQDomElement orig_element;
TQDomDocument formuladoc;
bool oasisFormat;
const ContextStyle& context;
MathML2KFormulaPrivate* impl;
enum Type {
// Presentation Markup
UNKNOWN = 1,
TOKEN = 2, // Token Elements
LAYOUT = 3, // General Layout Schemata
SCRIPT = 4, // Script and Limit Schemata
TABLE = 5, // Tables and Matrices
EE = 6, // Enlivening Expressions
// Content Markup
CONTENT = 12
};
};
KFORMULA_NAMESPACE_END
#endif // KFORMULAMATHMLREAD_H
|