kformulacompatibility.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KFORMULACOMPATIBILITY_H
21#define KFORMULACOMPATIBILITY_H
22
23#include <tqdom.h>
24#include <tqstring.h>
25
26KFORMULA_NAMESPACE_BEGIN
27
33public:
34
36
40 TQDomDocument buildDOM(TQString text);
41
42private:
43
44 TQDomElement readSequence(const TQDomDocument& doc);
45 TQDomElement readMatrix(const TQDomDocument& doc);
46
47 void appendToSequence(TQDomElement sequence, TQDomElement element, int leftIndexSeen);
48
49 void appendNextSequence(const TQDomDocument& doc, TQDomElement element);
50 TQDomElement getLastSequence(const TQDomDocument& doc, TQDomElement sequence);
51
52 TQDomElement findIndexNode(const TQDomDocument& doc, TQDomElement sequence);
53
54 ushort nextToken() { return formulaString[pos++].unicode(); }
55 ushort lookAhead(uint i) const { return formulaString[pos+i].unicode(); }
56 void pushback() { pos--; }
57
58 bool hasNext() const { return pos < formulaString.length(); }
59 uint tokenLeft() const { return formulaString.length()-pos; }
60
64 TQString formulaString;
65
69 uint pos;
70};
71
72KFORMULA_NAMESPACE_END
73
74#endif // KFORMULACOMPATIBILITY_H
Converter from the other kformula lib string to a loadable dom.
TQDomDocument buildDOM(TQString text)
Builds a kformula DOM from a old formula string.