summaryrefslogtreecommitdiffstats
path: root/lib/kformula/indexelement.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kformula/indexelement.cc')
-rw-r--r--lib/kformula/indexelement.cc168
1 files changed, 84 insertions, 84 deletions
diff --git a/lib/kformula/indexelement.cc b/lib/kformula/indexelement.cc
index 76c25d284..5e2ee3e58 100644
--- a/lib/kformula/indexelement.cc
+++ b/lib/kformula/indexelement.cc
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include <kdebug.h>
#include <klocale.h>
@@ -38,7 +38,7 @@ class IndexSequenceElement : public SequenceElement {
typedef SequenceElement inherited;
public:
- IndexSequenceElement( BasicElement* parent = 0 ) : SequenceElement( parent ) {}
+ IndexSequenceElement( BasicElement* tqparent = 0 ) : SequenceElement( tqparent ) {}
virtual IndexSequenceElement* clone() {
return new IndexSequenceElement( *this );
}
@@ -90,8 +90,8 @@ KCommand* IndexSequenceElement::buildCommand( Container* container, Request* req
}
-IndexElement::IndexElement(BasicElement* parent)
- : BasicElement(parent),
+IndexElement::IndexElement(BasicElement* tqparent)
+ : BasicElement(tqparent),
m_subScriptShiftType( NoSize ),
m_superScriptShiftType( NoSize ),
m_customAccentUnder( false ),
@@ -184,29 +184,29 @@ bool IndexElement::accept( ElementVisitor* visitor )
}
-QChar IndexElement::getCharacter() const
+TQChar IndexElement::getCharacter() const
{
if ( !content->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasUpperRight() && !upperRight->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasUpperMiddle() && !upperMiddle->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasUpperLeft() && !upperLeft->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasLowerRight() && !lowerRight->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasLowerMiddle() && !lowerMiddle->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
if ( hasLowerLeft() && !lowerLeft->isTextOnly() ) {
- return QChar::null;
+ return TQChar::null;
}
return ' ';
@@ -227,11 +227,11 @@ void IndexElement::entered( SequenceElement* child )
* Returns the element the point is in.
*/
BasicElement* IndexElement::goToPos( FormulaCursor* cursor, bool& handled,
- const LuPixelPoint& point, const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& point, const LuPixelPoint& tqparentOrigin )
{
- BasicElement* e = BasicElement::goToPos(cursor, handled, point, parentOrigin);
+ BasicElement* e = BasicElement::goToPos(cursor, handled, point, tqparentOrigin);
if (e != 0) {
- LuPixelPoint myPos(parentOrigin.x()+getX(), parentOrigin.y()+getY());
+ LuPixelPoint myPos(tqparentOrigin.x()+getX(), tqparentOrigin.y()+getY());
e = content->goToPos(cursor, handled, point, myPos);
if (e != 0) return e;
@@ -341,7 +341,7 @@ void IndexElement::setMiddleX(int xOffset, int middleWidth)
/**
* Calculates our width and height and
- * our children's parentPosition.
+ * our tqchildren's tqparentPosition.
*/
void IndexElement::calcSizes(const ContextStyle& context,
ContextStyle::TextStyle tstyle,
@@ -406,7 +406,7 @@ void IndexElement::calcSizes(const ContextStyle& context,
// get the contents size
content->calcSizes( context, tstyle, istyle, style );
- luPixel width = QMAX(content->getWidth(), QMAX(umWidth, lmWidth));
+ luPixel width = TQMAX(content->getWidth(), TQMAX(umWidth, lmWidth));
luPixel toMidline = content->axis( context, tstyle, factor );
luPixel fromMidline = content->getHeight() - toMidline;
@@ -436,7 +436,7 @@ void IndexElement::calcSizes(const ContextStyle& context,
if (hasLowerRight()) {
lowerRight->setX(width);
}
- width += QMAX(urWidth, lrWidth);
+ width += TQMAX(urWidth, lrWidth);
// calculate the y offsets
luPixel ulOffset = 0;
@@ -445,10 +445,10 @@ void IndexElement::calcSizes(const ContextStyle& context,
luPixel lrOffset = 0;
if (content->isTextOnly()) {
luPt mySize = context.getAdjustedSize( tstyle, factor );
- QFont font = context.getDefaultFont();
- font.setPointSizeFloat( context.layoutUnitPtToPt( mySize ) );
+ TQFont font = context.getDefaultFont();
+ font.setPointSizeFloat( context.tqlayoutUnitPtToPt( mySize ) );
- QFontMetrics fm(font);
+ TQFontMetrics fm(font);
LuPixelRect bound = fm.boundingRect('x');
luPixel exBaseline = context.ptToLayoutUnitPt( -bound.top() );
@@ -463,12 +463,12 @@ void IndexElement::calcSizes(const ContextStyle& context,
else {
// the upper half
- ulOffset = QMAX(ulMidline, ulHeight-toMidline);
- urOffset = QMAX(urMidline, urHeight-toMidline);
+ ulOffset = TQMAX(ulMidline, ulHeight-toMidline);
+ urOffset = TQMAX(urMidline, urHeight-toMidline);
// the lower half
- llOffset = QMAX(content->getHeight()-llMidline, toMidline);
- lrOffset = QMAX(content->getHeight()-lrMidline, toMidline);
+ llOffset = TQMAX(content->getHeight()-llMidline, toMidline);
+ lrOffset = TQMAX(content->getHeight()-lrMidline, toMidline);
}
// Add more offset if defined in attributes
@@ -500,7 +500,7 @@ void IndexElement::calcSizes(const ContextStyle& context,
break;
}
- luPixel height = QMAX(umHeight, QMAX(ulOffset, urOffset));
+ luPixel height = TQMAX(umHeight, TQMAX(ulOffset, urOffset));
// the upper half
content->setY(height);
@@ -526,7 +526,7 @@ void IndexElement::calcSizes(const ContextStyle& context,
lowerRight->setY( height + lrOffset );
}
- fromMidline += QMAX(QMAX(llHeight+llOffset, lrHeight+lrOffset) - content->getHeight(), lmHeight);
+ fromMidline += TQMAX(TQMAX(llHeight+llOffset, lrHeight+lrOffset) - content->getHeight(), lmHeight);
// set the result
setWidth(width);
@@ -542,18 +542,18 @@ void IndexElement::calcSizes(const ContextStyle& context,
}
/**
- * Draws the whole element including its children.
- * The `parentOrigin' is the point this element's parent starts.
- * We can use our parentPosition to get our own origin then.
+ * Draws the whole element including its tqchildren.
+ * The `tqparentOrigin' is the point this element's tqparent starts.
+ * We can use our tqparentPosition to get our own origin then.
*/
-void IndexElement::draw( QPainter& painter, const LuPixelRect& r,
+void IndexElement::draw( TQPainter& painter, const LuPixelRect& r,
const ContextStyle& context,
ContextStyle::TextStyle tstyle,
ContextStyle::IndexStyle istyle,
StyleAttributes& style,
- const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& tqparentOrigin )
{
- LuPixelPoint myPos( parentOrigin.x()+getX(), parentOrigin.y()+getY() );
+ LuPixelPoint myPos( tqparentOrigin.x()+getX(), tqparentOrigin.y()+getY() );
//if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) )
// return;
@@ -582,8 +582,8 @@ void IndexElement::draw( QPainter& painter, const LuPixelRect& r,
}
// Debug
- //painter.setBrush(Qt::NoBrush);
- //painter.setPen(Qt::red);
+ //painter.setBrush(TQt::NoBrush);
+ //painter.setPen(TQt::red);
//painter.drawRect(myPos.x(), myPos.y(), getWidth(), getHeight());
//painter.drawLine(myPos.x(), myPos.y()+getMidline(),
// myPos.x()+getWidth(), myPos.y()+getMidline());
@@ -645,7 +645,7 @@ int IndexElement::getFromPos(BasicElement* from)
else if (from == upperLeft) {
return upperLeftPos;
}
- return parentPos;
+ return tqparentPos;
}
/**
@@ -680,7 +680,7 @@ void IndexElement::moveLeft(FormulaCursor* cursor, BasicElement* from)
}
}
switch (fromPos) {
- case parentPos:
+ case tqparentPos:
if (hasLowerRight() && linear) {
lowerRight->moveLeft(cursor, this);
break;
@@ -751,7 +751,7 @@ void IndexElement::moveRight(FormulaCursor* cursor, BasicElement* from)
}
}
switch (fromPos) {
- case parentPos:
+ case tqparentPos:
if (hasUpperLeft() && linear) {
upperLeft->moveRight(cursor, this);
break;
@@ -885,12 +885,12 @@ void IndexElement::moveDown(FormulaCursor* cursor, BasicElement* from)
}
-// children
+// tqchildren
// main child
//
-// If an element has children one has to become the main one.
+// If an element has tqchildren one has to become the main one.
// void IndexElement::setMainChild(SequenceElement* child)
// {
@@ -902,7 +902,7 @@ void IndexElement::moveDown(FormulaCursor* cursor, BasicElement* from)
/**
- * Inserts all new children at the cursor position. Places the
+ * Inserts all new tqchildren at the cursor position. Places the
* cursor according to the direction.
*
* You only can insert one index at a time. So the list must contain
@@ -912,7 +912,7 @@ void IndexElement::moveDown(FormulaCursor* cursor, BasicElement* from)
* The list will be emptied but stays the property of the caller.
*/
void IndexElement::insert(FormulaCursor* cursor,
- QPtrList<BasicElement>& newChildren,
+ TQPtrList<BasicElement>& newChildren,
Direction direction)
{
SequenceElement* index = static_cast<SequenceElement*>(newChildren.take(0));
@@ -954,8 +954,8 @@ void IndexElement::insert(FormulaCursor* cursor,
/**
- * Removes all selected children and returns them. Places the
- * cursor to where the children have been.
+ * Removes all selected tqchildren and returns them. Places the
+ * cursor to where the tqchildren have been.
*
* The cursor has to be inside one of our indexes which is supposed
* to be empty. The index will be removed and the cursor will
@@ -965,7 +965,7 @@ void IndexElement::insert(FormulaCursor* cursor,
* The ownership of the list is passed to the caller.
*/
void IndexElement::remove(FormulaCursor* cursor,
- QPtrList<BasicElement>& removedChildren,
+ TQPtrList<BasicElement>& removedChildren,
Direction direction)
{
int pos = cursor->getPos();
@@ -983,9 +983,9 @@ void IndexElement::remove(FormulaCursor* cursor,
setToLowerLeft(cursor);
break;
case contentPos: {
- BasicElement* parent = getParent();
- parent->selectChild(cursor, this);
- parent->remove(cursor, removedChildren, direction);
+ BasicElement* tqparent = getParent();
+ tqparent->selectChild(cursor, this);
+ tqparent->remove(cursor, removedChildren, direction);
break;
}
case upperMiddlePos:
@@ -1032,7 +1032,7 @@ void IndexElement::normalize(FormulaCursor* cursor, Direction direction)
/**
* Returns wether the element has no more useful
- * children (except its main child) and should therefore
+ * tqchildren (except its main child) and should therefore
* be replaced by its main child's content.
*/
bool IndexElement::isSenseless()
@@ -1227,43 +1227,43 @@ void IndexElement::moveToLowerRight(FormulaCursor* cursor, Direction direction)
/**
* Appends our attributes to the dom element.
*/
-void IndexElement::writeDom(QDomElement element)
+void IndexElement::writeDom(TQDomElement element)
{
BasicElement::writeDom(element);
- QDomDocument doc = element.ownerDocument();
+ TQDomDocument doc = element.ownerDocument();
- QDomElement cont = doc.createElement("CONTENT");
+ TQDomElement cont = doc.createElement("CONTENT");
cont.appendChild(content->getElementDom(doc));
element.appendChild(cont);
if (hasUpperLeft()) {
- QDomElement ind = doc.createElement("UPPERLEFT");
+ TQDomElement ind = doc.createElement("UPPERLEFT");
ind.appendChild(upperLeft->getElementDom(doc));
element.appendChild(ind);
}
if (hasUpperMiddle()) {
- QDomElement ind = doc.createElement("UPPERMIDDLE");
+ TQDomElement ind = doc.createElement("UPPERMIDDLE");
ind.appendChild(upperMiddle->getElementDom(doc));
element.appendChild(ind);
}
if (hasUpperRight()) {
- QDomElement ind = doc.createElement("UPPERRIGHT");
+ TQDomElement ind = doc.createElement("UPPERRIGHT");
ind.appendChild(upperRight->getElementDom(doc));
element.appendChild(ind);
}
if (hasLowerLeft()) {
- QDomElement ind = doc.createElement("LOWERLEFT");
+ TQDomElement ind = doc.createElement("LOWERLEFT");
ind.appendChild(lowerLeft->getElementDom(doc));
element.appendChild(ind);
}
if (hasLowerMiddle()) {
- QDomElement ind = doc.createElement("LOWERMIDDLE");
+ TQDomElement ind = doc.createElement("LOWERMIDDLE");
ind.appendChild(lowerMiddle->getElementDom(doc));
element.appendChild(ind);
}
if (hasLowerRight()) {
- QDomElement ind = doc.createElement("LOWERRIGHT");
+ TQDomElement ind = doc.createElement("LOWERRIGHT");
ind.appendChild(lowerRight->getElementDom(doc));
element.appendChild(ind);
}
@@ -1273,7 +1273,7 @@ void IndexElement::writeDom(QDomElement element)
* Reads our attributes from the element.
* Returns false if it failed.
*/
-bool IndexElement::readAttributesFromDom(QDomElement element)
+bool IndexElement::readAttributesFromDom(TQDomElement element)
{
if (!BasicElement::readAttributesFromDom(element)) {
return false;
@@ -1286,7 +1286,7 @@ bool IndexElement::readAttributesFromDom(QDomElement element)
* that needs to be read.
* Returns false if it failed.
*/
-bool IndexElement::readContentFromDom(QDomNode& node)
+bool IndexElement::readContentFromDom(TQDomNode& node)
{
if (!BasicElement::readContentFromDom(node)) {
return false;
@@ -1345,28 +1345,28 @@ bool IndexElement::readContentFromDom(QDomNode& node)
lowerLeftRead || lowerMiddleRead || lowerRightRead;
}
-bool IndexElement::readAttributesFromMathMLDom( const QDomElement& element )
+bool IndexElement::readAttributesFromMathMLDom( const TQDomElement& element )
{
if ( !BasicElement::readAttributesFromMathMLDom( element ) ) {
return false;
}
- QString tag = element.tagName().stripWhiteSpace().lower();
+ TQString tag = element.tagName().stripWhiteSpace().lower();
if ( tag == "msub" || tag == "msubsup" ) {
- QString subscriptshiftStr = element.attribute( "subscriptshift" ).stripWhiteSpace().lower();
+ TQString subscriptshiftStr = element.attribute( "subscriptshift" ).stripWhiteSpace().lower();
if ( ! subscriptshiftStr.isNull() ) {
m_subScriptShift = getSize( subscriptshiftStr, &m_subScriptShiftType );
}
}
if ( tag == "msup" || tag == "msubsup" ) {
- QString superscriptshiftStr = element.attribute( "superscriptshift" ).stripWhiteSpace().lower();
+ TQString superscriptshiftStr = element.attribute( "superscriptshift" ).stripWhiteSpace().lower();
if ( ! superscriptshiftStr.isNull() ) {
m_superScriptShift = getSize( superscriptshiftStr, &m_superScriptShiftType );
}
}
if ( tag == "munder" || tag == "munderover" ) {
- QString accentunderStr = element.attribute( "accentunder" ).stripWhiteSpace().lower();
+ TQString accentunderStr = element.attribute( "accentunder" ).stripWhiteSpace().lower();
if ( ! accentunderStr.isNull() ) {
if ( accentunderStr == "true" ) {
m_customAccentUnder = true;
@@ -1383,7 +1383,7 @@ bool IndexElement::readAttributesFromMathMLDom( const QDomElement& element )
}
}
if ( tag == "mover" || tag == "munderover" ) {
- QString accentStr = element.attribute( "accent" ).stripWhiteSpace().lower();
+ TQString accentStr = element.attribute( "accent" ).stripWhiteSpace().lower();
if ( ! accentStr.isNull() ) {
if ( accentStr == "true" ) {
m_customAccent = true;
@@ -1408,7 +1408,7 @@ bool IndexElement::readAttributesFromMathMLDom( const QDomElement& element )
* (e. g. for fence operators).
* Returns the number of nodes processed or -1 if it failed.
*/
-int IndexElement::readContentFromMathMLDom( QDomNode& node )
+int IndexElement::readContentFromMathMLDom( TQDomNode& node )
{
if ( BasicElement::readContentFromMathMLDom( node ) == -1 ) {
return -1;
@@ -1426,7 +1426,7 @@ int IndexElement::readContentFromMathMLDom( QDomNode& node )
node = node.nextSibling();
}
- QString indexType = node.parentNode().toElement().tagName().lower();
+ TQString indexType = node.tqparentNode().toElement().tagName().lower();
if ( indexType == "msub" ) {
lowerRight = new SequenceElement( this );
int lowerRightNumber = lowerRight->buildMathMLChild( node );
@@ -1580,9 +1580,9 @@ ElementIndexPtr IndexElement::getIndex( int position )
-QString IndexElement::toLatex()
+TQString IndexElement::toLatex()
{
- QString index;
+ TQString index;
if ( hasUpperMiddle() ) {
index += "\\overset{" + upperMiddle->toLatex() + "}{";
@@ -1622,9 +1622,9 @@ QString IndexElement::toLatex()
return index;
}
-QString IndexElement::formulaString()
+TQString IndexElement::formulaString()
{
- QString index = "(" + content->formulaString() + ")";
+ TQString index = "(" + content->formulaString() + ")";
if ( hasLowerRight() ) {
index += "_(" + lowerRight->formulaString() + ")";
}
@@ -1634,7 +1634,7 @@ QString IndexElement::formulaString()
return index;
}
-QString IndexElement::getElementName() const
+TQString IndexElement::getElementName() const
{
if ( hasUpperMiddle() && hasLowerMiddle() )
return "munderover";
@@ -1653,19 +1653,19 @@ QString IndexElement::getElementName() const
return "msubsup";
}
-void IndexElement::writeMathMLAttributes( QDomElement& element ) const
+void IndexElement::writeMathMLAttributes( TQDomElement& element ) const
{
- QString tag = getElementName();
+ TQString tag = getElementName();
if ( tag == "msub" || tag == "msubsup" ) {
switch ( m_subScriptShiftType ) {
case AbsoluteSize:
- element.setAttribute( "subscriptshift", QString( "%1pt" ).arg( m_subScriptShift ) );
+ element.setAttribute( "subscriptshift", TQString( "%1pt" ).tqarg( m_subScriptShift ) );
break;
case RelativeSize:
- element.setAttribute( "subscriptshift", QString( "%1%" ).arg( m_subScriptShift * 100.0 ) );
+ element.setAttribute( "subscriptshift", TQString( "%1%" ).tqarg( m_subScriptShift * 100.0 ) );
break;
case PixelSize:
- element.setAttribute( "subscriptshift", QString( "%1px" ).arg( m_subScriptShift ) );
+ element.setAttribute( "subscriptshift", TQString( "%1px" ).tqarg( m_subScriptShift ) );
break;
default:
break;
@@ -1674,13 +1674,13 @@ void IndexElement::writeMathMLAttributes( QDomElement& element ) const
if ( tag == "msup" || tag == "msubsup" ) {
switch ( m_superScriptShiftType ) {
case AbsoluteSize:
- element.setAttribute( "superscriptshift", QString( "%1pt" ).arg( m_superScriptShift ) );
+ element.setAttribute( "superscriptshift", TQString( "%1pt" ).tqarg( m_superScriptShift ) );
break;
case RelativeSize:
- element.setAttribute( "superscriptshift", QString( "%1%" ).arg( m_superScriptShift * 100.0 ) );
+ element.setAttribute( "superscriptshift", TQString( "%1%" ).tqarg( m_superScriptShift * 100.0 ) );
break;
case PixelSize:
- element.setAttribute( "superscriptshift", QString( "%1px" ).arg( m_superScriptShift ) );
+ element.setAttribute( "superscriptshift", TQString( "%1px" ).tqarg( m_superScriptShift ) );
break;
default:
break;
@@ -1699,11 +1699,11 @@ void IndexElement::writeMathMLAttributes( QDomElement& element ) const
}
-void IndexElement::writeMathMLContent( QDomDocument& doc,
- QDomElement& element,
+void IndexElement::writeMathMLContent( TQDomDocument& doc,
+ TQDomElement& element,
bool oasisFormat ) const
{
- QDomElement de;
+ TQDomElement de;
content->writeMathML( doc, element, oasisFormat ); // base
if ( hasUpperMiddle() && hasLowerMiddle() )