diff options
Diffstat (limited to 'lib/kformula/kformulacompatibility.cc')
-rw-r--r-- | lib/kformula/kformulacompatibility.cc | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/lib/kformula/kformulacompatibility.cc b/lib/kformula/kformulacompatibility.cc index 70f77ed9..434bd28b 100644 --- a/lib/kformula/kformulacompatibility.cc +++ b/lib/kformula/kformulacompatibility.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <kdebug.h> #include "kformuladefs.h" @@ -45,7 +45,7 @@ const BoxType OF_SUB = '_' + UNUSED_OFFSET; const BoxType OF_LSUP = '6' + UNUSED_OFFSET; const BoxType OF_LSUB = '%' + UNUSED_OFFSET; //const BoxType PAREN = '('; -//const BoxType EQUAL = '='; +//const BoxType ETQUAL = '='; //const BoxType MORE = '>'; //const BoxType LESS = '<'; //const BoxType ABS = '|'; @@ -71,19 +71,19 @@ Compatibility::Compatibility() } -QDomDocument Compatibility::buildDOM(QString text) +TQDomDocument Compatibility::buildDOM(TQString text) { - QDomDocument doc("KFORMULA"); + TQDomDocument doc("KFORMULA"); pos = 0; formulaString = text; - QDomElement formula = readSequence(doc); + TQDomElement formula = readSequence(doc); formula.setTagName("FORMULA"); doc.appendChild(formula); return doc; } -void Compatibility::appendNextSequence(const QDomDocument& doc, QDomElement element) +void Compatibility::appendNextSequence(const TQDomDocument& doc, TQDomElement element) { if (hasNext() && nextToken() == '{') { element.appendChild(readSequence(doc)); @@ -95,16 +95,16 @@ void Compatibility::appendNextSequence(const QDomDocument& doc, QDomElement elem } -QDomElement Compatibility::getLastSequence(const QDomDocument& doc, QDomElement sequence) +TQDomElement Compatibility::getLastSequence(const TQDomDocument& doc, TQDomElement sequence) { if (sequence.lastChild().nodeName() == "SEQUENCE") { - QDomNode child = sequence.removeChild(sequence.lastChild()); + TQDomNode child = sequence.removeChild(sequence.lastChild()); return child.toElement(); } else { - QDomElement newSeq = doc.createElement("SEQUENCE"); + TQDomElement newSeq = doc.createElement("SEQUENCE"); if (!sequence.lastChild().isNull()) { - QDomNode child = sequence.removeChild(sequence.lastChild()); + TQDomNode child = sequence.removeChild(sequence.lastChild()); newSeq.appendChild(child); } return newSeq; @@ -112,15 +112,15 @@ QDomElement Compatibility::getLastSequence(const QDomDocument& doc, QDomElement } -QDomElement Compatibility::findIndexNode(const QDomDocument& doc, QDomElement sequence) +TQDomElement Compatibility::findIndexNode(const TQDomDocument& doc, TQDomElement sequence) { - QDomElement element; + TQDomElement element; if (sequence.lastChild().nodeName() == "INDEX") { element = sequence.lastChild().toElement(); } else { element = doc.createElement("INDEX"); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); con.appendChild(getLastSequence(doc, sequence)); sequence.appendChild(element); @@ -129,14 +129,14 @@ QDomElement Compatibility::findIndexNode(const QDomDocument& doc, QDomElement se } -void Compatibility::appendToSequence(QDomElement sequence, QDomElement element, int leftIndexSeen) +void Compatibility::appendToSequence(TQDomElement sequence, TQDomElement element, int leftIndexSeen) { if (leftIndexSeen > 0) { if (sequence.lastChild().nodeName() == "INDEX") { - QDomElement index = sequence.lastChild().toElement(); + TQDomElement index = sequence.lastChild().toElement(); if ((index.firstChild().nodeName() == "CONTENT") && (index.firstChild().firstChild().nodeName() == "SEQUENCE")) { - QDomElement seq = index.firstChild().firstChild().toElement(); + TQDomElement seq = index.firstChild().firstChild().toElement(); if (element.nodeName() == "SEQUENCE") { index.firstChild().replaceChild(element, seq); } @@ -151,9 +151,9 @@ void Compatibility::appendToSequence(QDomElement sequence, QDomElement element, } -QDomElement Compatibility::readMatrix(const QDomDocument& doc) +TQDomElement Compatibility::readMatrix(const TQDomDocument& doc) { - QDomElement element = doc.createElement("MATRIX"); + TQDomElement element = doc.createElement("MATRIX"); uint cols = nextToken(); nextToken(); @@ -163,11 +163,11 @@ QDomElement Compatibility::readMatrix(const QDomDocument& doc) element.setAttribute("COLUMNS", cols); if ((nextToken() == '}') && (nextToken() == OF_MATRIX) && (nextToken() == '{')) { - QValueList<QDomElement> matrix; + TQValueList<TQDomElement> matrix; for (uint c = 0; c < cols; c++) { for (uint r = 0; r < rows; r++) { if (hasNext() && (nextToken() == '{')) { - QDomElement tmp = readSequence(doc); + TQDomElement tmp = readSequence(doc); matrix.append(tmp); } if (hasNext() && (nextToken() != OF_SEPARATOR)) { @@ -195,7 +195,7 @@ QDomElement Compatibility::readMatrix(const QDomDocument& doc) } -QDomElement Compatibility::readSequence(const QDomDocument& doc) +TQDomElement Compatibility::readSequence(const TQDomDocument& doc) { // matrizes start with something that isn't a sequence if ((tokenLeft() > 6) && (lookAhead(1) == OF_SEPARATOR)) { @@ -203,7 +203,7 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) } int leftIndexSeen = 0; - QDomElement sequence = doc.createElement("SEQUENCE"); + TQDomElement sequence = doc.createElement("SEQUENCE"); while (hasNext()) { ushort ch = nextToken(); @@ -227,24 +227,24 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) sequence.removeChild(sequence.lastChild()); } - QDomElement element = doc.createElement("BRACKET"); + TQDomElement element = doc.createElement("BRACKET"); appendToSequence(sequence, element, leftIndexSeen); element.setAttribute("LEFT", ch); element.setAttribute("RIGHT", (ch=='(') ? ')' : ((ch=='[') ? ']' : '|')); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); appendNextSequence(doc, con); break; } case OF_DIVIDE: { - QDomElement element = doc.createElement("FRACTION"); + TQDomElement element = doc.createElement("FRACTION"); - QDomElement num = doc.createElement("NUMERATOR"); + TQDomElement num = doc.createElement("NUMERATOR"); element.appendChild(num); num.appendChild(getLastSequence(doc, sequence)); - QDomElement den = doc.createElement("DENOMINATOR"); + TQDomElement den = doc.createElement("DENOMINATOR"); element.appendChild(den); appendNextSequence(doc, den); @@ -252,12 +252,12 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } case OF_SQRT: { - QDomElement element = doc.createElement("ROOT"); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement element = doc.createElement("ROOT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); appendNextSequence(doc, con); - QDomElement ind = doc.createElement("INDEX"); + TQDomElement ind = doc.createElement("INDEX"); element.appendChild(ind); ind.appendChild(getLastSequence(doc, sequence)); @@ -265,31 +265,31 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } case OF_POWER: { - QDomElement element = findIndexNode(doc, sequence); - QDomElement upperRight = doc.createElement("UPPERRIGHT"); + TQDomElement element = findIndexNode(doc, sequence); + TQDomElement upperRight = doc.createElement("UPPERRIGHT"); element.appendChild(upperRight); appendNextSequence(doc, upperRight); break; } case OF_SUB: { - QDomElement element = findIndexNode(doc, sequence); - QDomElement lowerRight = doc.createElement("LOWERRIGHT"); + TQDomElement element = findIndexNode(doc, sequence); + TQDomElement lowerRight = doc.createElement("LOWERRIGHT"); element.appendChild(lowerRight); appendNextSequence(doc, lowerRight); break; } case OF_LSUP: { - QDomElement upperLeft = doc.createElement("UPPERLEFT"); + TQDomElement upperLeft = doc.createElement("UPPERLEFT"); upperLeft.appendChild(getLastSequence(doc, sequence)); - QDomElement element; + TQDomElement element; if (sequence.lastChild().nodeName() == "INDEX") { element = sequence.lastChild().toElement(); } else { element = doc.createElement("INDEX"); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); - QDomElement seq = doc.createElement("SEQUENCE"); + TQDomElement seq = doc.createElement("SEQUENCE"); con.appendChild(seq); appendToSequence(sequence, element, leftIndexSeen); } @@ -298,17 +298,17 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } case OF_LSUB: { - QDomElement lowerLeft = doc.createElement("LOWERLEFT"); + TQDomElement lowerLeft = doc.createElement("LOWERLEFT"); lowerLeft.appendChild(getLastSequence(doc, sequence)); - QDomElement element; + TQDomElement element; if (sequence.lastChild().nodeName() == "INDEX") { element = sequence.lastChild().toElement(); } else { element = doc.createElement("INDEX"); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); - QDomElement seq = doc.createElement("SEQUENCE"); + TQDomElement seq = doc.createElement("SEQUENCE"); con.appendChild(seq); appendToSequence(sequence, element, leftIndexSeen); } @@ -318,14 +318,14 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) } case OF_ABOVE: { if (sequence.lastChild().nodeName() == "SEQUENCE") { - QDomElement seq = sequence.lastChild().toElement(); + TQDomElement seq = sequence.lastChild().toElement(); if ((seq.childNodes().count() == 1) && ((seq.lastChild().nodeName() == "SYMBOL") || (seq.lastChild().nodeName() == "INDEX"))) { sequence.removeChild(seq); - QDomElement element = seq.lastChild().toElement(); - QDomElement upper = (element.nodeName() == "SYMBOL") ? + TQDomElement element = seq.lastChild().toElement(); + TQDomElement upper = (element.nodeName() == "SYMBOL") ? doc.createElement("UPPER") : doc.createElement("UPPERMIDDLE"); element.appendChild(upper); @@ -334,22 +334,22 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } } - QDomElement element = findIndexNode(doc, sequence); - QDomElement upper = doc.createElement("UPPERMIDDLE"); + TQDomElement element = findIndexNode(doc, sequence); + TQDomElement upper = doc.createElement("UPPERMIDDLE"); element.appendChild(upper); appendNextSequence(doc, upper); break; } case OF_BELOW: { if (sequence.lastChild().nodeName() == "SEQUENCE") { - QDomElement seq = sequence.lastChild().toElement(); + TQDomElement seq = sequence.lastChild().toElement(); if ((seq.childNodes().count() == 1) && ((seq.lastChild().nodeName() == "SYMBOL") || (seq.lastChild().nodeName() == "INDEX"))) { sequence.removeChild(seq); - QDomElement element = seq.lastChild().toElement(); - QDomElement lower = (element.nodeName() == "SYMBOL") ? + TQDomElement element = seq.lastChild().toElement(); + TQDomElement lower = (element.nodeName() == "SYMBOL") ? doc.createElement("LOWER") : doc.createElement("LOWERMIDDLE"); element.appendChild(lower); @@ -358,8 +358,8 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } } - QDomElement element = findIndexNode(doc, sequence); - QDomElement lower = doc.createElement("LOWERMIDDLE"); + TQDomElement element = findIndexNode(doc, sequence); + TQDomElement lower = doc.createElement("LOWERMIDDLE"); element.appendChild(lower); appendNextSequence(doc, lower); break; @@ -370,12 +370,12 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) case INTEGRAL: case SUM: case PRODUCT: { - QDomElement element = doc.createElement("SYMBOL"); + TQDomElement element = doc.createElement("SYMBOL"); element.setAttribute("TYPE", (ch==INTEGRAL) ? Integral : ((ch==SUM) ? Sum : Product)); - QDomElement con = doc.createElement("CONTENT"); + TQDomElement con = doc.createElement("CONTENT"); element.appendChild(con); con.appendChild(readSequence(doc)); pushback(); @@ -383,15 +383,15 @@ QDomElement Compatibility::readSequence(const QDomDocument& doc) break; } case ARROW: { - QDomElement element = doc.createElement("TEXT"); - element.setAttribute("CHAR", QString(QChar(static_cast<char>(174)))); + TQDomElement element = doc.createElement("TEXT"); + element.setAttribute("CHAR", TQString(TQChar(static_cast<char>(174)))); element.setAttribute("SYMBOL", "1"); appendToSequence(sequence, element, leftIndexSeen); break; } default: { - QDomElement element = doc.createElement("TEXT"); - element.setAttribute("CHAR", QString(formulaString[pos-1])); + TQDomElement element = doc.createElement("TEXT"); + element.setAttribute("CHAR", TQString(formulaString[pos-1])); appendToSequence(sequence, element, leftIndexSeen); } } |