diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/sequenceelement.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/sequenceelement.cc')
-rw-r--r-- | lib/kformula/sequenceelement.cc | 452 |
1 files changed, 226 insertions, 226 deletions
diff --git a/lib/kformula/sequenceelement.cc b/lib/kformula/sequenceelement.cc index b57125bd..eb64a13e 100644 --- a/lib/kformula/sequenceelement.cc +++ b/lib/kformula/sequenceelement.cc @@ -21,9 +21,9 @@ #include <stdlib.h> #include <math.h> -#include <qpainter.h> -#include <qpaintdevice.h> -#include <qvaluestack.h> +#include <tqpainter.h> +#include <tqpaintdevice.h> +#include <tqvaluestack.h> #include <kcommand.h> #include <kdebug.h> @@ -72,11 +72,11 @@ void SequenceElement::setStyle( StyleElement *st ) style = st; } -SequenceElement::SequenceElement(BasicElement* parent) - : BasicElement(parent), parseTree(0), textSequence(true),singlePipe(true), style(0) +SequenceElement::SequenceElement(BasicElement* tqparent) + : BasicElement(tqparent), parseTree(0), textSequence(true),singlePipe(true), style(0) { assert( creationStrategy != 0 ); - children.setAutoDelete(true); + tqchildren.setAutoDelete(true); } @@ -88,12 +88,12 @@ SequenceElement::~SequenceElement() SequenceElement::SequenceElement( const SequenceElement& other ) : BasicElement( other ) { - children.setAutoDelete(true); - uint count = other.children.count(); + tqchildren.setAutoDelete(true); + uint count = other.tqchildren.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = children.at(i)->clone(); + BasicElement* child = tqchildren.at(i)->clone(); child->setParent( this ); - children.append( child ); + tqchildren.append( child ); } } @@ -114,25 +114,25 @@ bool SequenceElement::readOnly( const FormulaCursor* ) const * Returns the element the point is in. */ BasicElement* SequenceElement::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()); - uint count = children.count(); + uint count = tqchildren.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = children.at(i); + BasicElement* child = tqchildren.at(i); e = child->goToPos(cursor, handled, point, myPos); if (e != 0) { if (!handled) { handled = true; if ((point.x() - myPos.x()) < (e->getX() + e->getWidth()*2/3)) { - cursor->setTo(this, children.find(e)); + cursor->setTo(this, tqchildren.tqfind(e)); } else { - cursor->setTo(this, children.find(e)+1); + cursor->setTo(this, tqchildren.tqfind(e)+1); } } return e; @@ -143,11 +143,11 @@ BasicElement* SequenceElement::goToPos( FormulaCursor* cursor, bool& handled, //int dy = point.y() - myPos.y(); for (uint i = 0; i < count; i++) { - BasicElement* child = children.at(i); + BasicElement* child = tqchildren.at(i); if (dx < child->getX()) { cursor->setTo( this, i ); handled = true; - return children.at( i ); + return tqchildren.at( i ); } } @@ -161,9 +161,9 @@ BasicElement* SequenceElement::goToPos( FormulaCursor* cursor, bool& handled, bool SequenceElement::isEmpty() { - uint count = children.count(); + uint count = tqchildren.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = children.at(i); + BasicElement* child = tqchildren.at(i); if (!child->isInvisible()) { return false; } @@ -174,7 +174,7 @@ bool SequenceElement::isEmpty() /** * Calculates our width and height and - * our children's parentPosition. + * our tqchildren's tqparentPosition. */ void SequenceElement::calcSizes( const ContextStyle& context, ContextStyle::TextStyle tstyle, @@ -190,7 +190,7 @@ void SequenceElement::calcSizes( const ContextStyle& context, width += context.ptToPixelX( getSpaceBefore( context, tstyle, factor ) ); // Let's do all normal elements that have a base line. - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); @@ -201,14 +201,14 @@ void SequenceElement::calcSizes( const ContextStyle& context, luPixel childBaseline = child->getBaseline(); if ( childBaseline > -1 ) { - toBaseline = QMAX( toBaseline, childBaseline ); - fromBaseline = QMAX( fromBaseline, + toBaseline = TQMAX( toBaseline, childBaseline ); + fromBaseline = TQMAX( fromBaseline, child->getHeight() - childBaseline ); } else { luPixel bl = child->getHeight()/2 + context.axisHeight( tstyle, factor ); - toBaseline = QMAX( toBaseline, bl ); - fromBaseline = QMAX( fromBaseline, child->getHeight() - bl ); + toBaseline = TQMAX( toBaseline, bl ); + fromBaseline = TQMAX( fromBaseline, child->getHeight() - bl ); } } else { @@ -237,7 +237,7 @@ void SequenceElement::calcSizes( const ContextStyle& context, void SequenceElement::setChildrenPositions() { - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); child->setY(getBaseline() - child->getBaseline()); @@ -246,25 +246,25 @@ void SequenceElement::setChildrenPositions() /** - * 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 SequenceElement::draw( QPainter& painter, const LuPixelRect& r, +void SequenceElement::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() ); // There might be zero sized elements that still want to be drawn at least // in edit mode. (EmptyElement) //if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) ) // return; if (!isEmpty()) { - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); for (int i = 0 ; it.current(); i++) { BasicElement* child = it.current(); if (!child->isInvisible()) { @@ -291,24 +291,24 @@ void SequenceElement::draw( QPainter& painter, const LuPixelRect& r, drawEmptyRect( painter, context, style.sizeFactor(), myPos ); } // Debug - //painter.setPen(Qt::green); - //painter.drawRect(parentOrigin.x() + getX(), parentOrigin.y() + getY(), + //painter.setPen(TQt::green); + //painter.drawRect(tqparentOrigin.x() + getX(), tqparentOrigin.y() + getY(), // getWidth(), getHeight()); -// painter.drawLine( context.layoutUnitToPixelX( parentOrigin.x() + getX() ), -// context.layoutUnitToPixelY( parentOrigin.y() + getY() + axis( context, tstyle ) ), -// context.layoutUnitToPixelX( parentOrigin.x() + getX() + getWidth() ), -// context.layoutUnitToPixelY( parentOrigin.y() + getY() + axis( context, tstyle ) ) ); -// painter.setPen(Qt::red); -// painter.drawLine( context.layoutUnitToPixelX( parentOrigin.x() + getX() ), -// context.layoutUnitToPixelY( parentOrigin.y() + getY() + getBaseline() ), -// context.layoutUnitToPixelX( parentOrigin.x() + getX() + getWidth() ), -// context.layoutUnitToPixelY( parentOrigin.y() + getY() + getBaseline() ) ); +// painter.drawLine( context.tqlayoutUnitToPixelX( tqparentOrigin.x() + getX() ), +// context.tqlayoutUnitToPixelY( tqparentOrigin.y() + getY() + axis( context, tstyle ) ), +// context.tqlayoutUnitToPixelX( tqparentOrigin.x() + getX() + getWidth() ), +// context.tqlayoutUnitToPixelY( tqparentOrigin.y() + getY() + axis( context, tstyle ) ) ); +// painter.setPen(TQt::red); +// painter.drawLine( context.tqlayoutUnitToPixelX( tqparentOrigin.x() + getX() ), +// context.tqlayoutUnitToPixelY( tqparentOrigin.y() + getY() + getBaseline() ), +// context.tqlayoutUnitToPixelX( tqparentOrigin.x() + getX() + getWidth() ), +// context.tqlayoutUnitToPixelY( tqparentOrigin.y() + getY() + getBaseline() ) ); } void SequenceElement::dispatchFontCommand( FontCommand* cmd ) { - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); child->dispatchFontCommand( cmd ); @@ -316,17 +316,17 @@ void SequenceElement::dispatchFontCommand( FontCommand* cmd ) } -void SequenceElement::drawEmptyRect( QPainter& painter, const ContextStyle& context, +void SequenceElement::drawEmptyRect( TQPainter& painter, const ContextStyle& context, double factor, const LuPixelPoint& upperLeft ) { if ( context.edit() ) { - painter.setBrush(Qt::NoBrush); - painter.setPen( QPen( context.getEmptyColor(), - context.layoutUnitToPixelX( context.getLineWidth( factor ) ) ) ); - painter.drawRect( context.layoutUnitToPixelX( upperLeft.x() ), - context.layoutUnitToPixelY( upperLeft.y() ), - context.layoutUnitToPixelX( getWidth() ), - context.layoutUnitToPixelY( getHeight() ) ); + painter.setBrush(TQt::NoBrush); + painter.setPen( TQPen( context.getEmptyColor(), + context.tqlayoutUnitToPixelX( context.getLineWidth( factor ) ) ) ); + painter.drawRect( context.tqlayoutUnitToPixelX( upperLeft.x() ), + context.tqlayoutUnitToPixelY( upperLeft.y() ), + context.tqlayoutUnitToPixelX( getWidth() ), + context.tqlayoutUnitToPixelY( getHeight() ) ); } } @@ -347,7 +347,7 @@ void SequenceElement::calcCursorSize( const ContextStyle& context, if ( cursor->isSelection() ) { uint mark = cursor->getMark(); luPixel markX = getChildPosition( context, mark ); - luPixel x = QMIN(posX, markX); + luPixel x = TQMIN(posX, markX); luPixel width = abs(posX - markX); if ( smallCursor ) { @@ -377,21 +377,21 @@ void SequenceElement::calcCursorSize( const ContextStyle& context, /** * If the cursor is inside a sequence it needs to be drawn. */ -void SequenceElement::drawCursor( QPainter& painter, const ContextStyle& context, +void SequenceElement::drawCursor( TQPainter& painter, const ContextStyle& context, StyleAttributes& style, FormulaCursor* cursor, bool smallCursor, bool activeCursor ) { - painter.setRasterOp( Qt::XorROP ); + painter.setRasterOp( TQt::XorROP ); if ( cursor->isSelection() ) { const LuPixelRect& r = cursor->cursorSize; - painter.fillRect( context.layoutUnitToPixelX( r.x() ), - context.layoutUnitToPixelY( r.y() ), - context.layoutUnitToPixelX( r.width() ), - context.layoutUnitToPixelY( r.height() ), - Qt::white ); - } - painter.setPen( QPen( Qt::white, - context.layoutUnitToPixelX( context.getLineWidth( style.sizeFactor() )/2 ) ) ); + painter.fillRect( context.tqlayoutUnitToPixelX( r.x() ), + context.tqlayoutUnitToPixelY( r.y() ), + context.tqlayoutUnitToPixelX( r.width() ), + context.tqlayoutUnitToPixelY( r.height() ), + TQt::white ); + } + painter.setPen( TQPen( TQt::white, + context.tqlayoutUnitToPixelX( context.getLineWidth( style.sizeFactor() )/2 ) ) ); const LuPixelPoint& point = cursor->getCursorPoint(); const LuPixelRect& size = cursor->getCursorSize(); if ( activeCursor ) @@ -399,33 +399,33 @@ void SequenceElement::drawCursor( QPainter& painter, const ContextStyle& context int offset = 0; if ( cursor->isSelection() && cursor->getPos() > cursor->getMark() ) offset = -1; - painter.drawLine( context.layoutUnitToPixelX( point.x() ) + offset, - context.layoutUnitToPixelY( size.top() ), - context.layoutUnitToPixelX( point.x() ) + offset, - context.layoutUnitToPixelY( size.bottom() )-1 ); - painter.drawLine( context.layoutUnitToPixelX( point.x() ) + offset + 1, - context.layoutUnitToPixelY( size.top() ), - context.layoutUnitToPixelX( point.x() ) + offset + 1, - context.layoutUnitToPixelY( size.bottom() )-1 ); + painter.drawLine( context.tqlayoutUnitToPixelX( point.x() ) + offset, + context.tqlayoutUnitToPixelY( size.top() ), + context.tqlayoutUnitToPixelX( point.x() ) + offset, + context.tqlayoutUnitToPixelY( size.bottom() )-1 ); + painter.drawLine( context.tqlayoutUnitToPixelX( point.x() ) + offset + 1, + context.tqlayoutUnitToPixelY( size.top() ), + context.tqlayoutUnitToPixelX( point.x() ) + offset + 1, + context.tqlayoutUnitToPixelY( size.bottom() )-1 ); } if ( !smallCursor && !cursor->isSelection() ) - painter.drawLine( context.layoutUnitToPixelX( size.left() ), - context.layoutUnitToPixelY( size.bottom() )-1, - context.layoutUnitToPixelX( size.right() )-1, - context.layoutUnitToPixelY( size.bottom() )-1 ); + painter.drawLine( context.tqlayoutUnitToPixelX( size.left() ), + context.tqlayoutUnitToPixelY( size.bottom() )-1, + context.tqlayoutUnitToPixelX( size.right() )-1, + context.tqlayoutUnitToPixelY( size.bottom() )-1 ); // This might be wrong but probably isn't. - painter.setRasterOp( Qt::CopyROP ); + painter.setRasterOp( TQt::CopyROP ); } luPixel SequenceElement::getChildPosition( const ContextStyle& context, uint child ) { - if (child < children.count()) { - return children.at(child)->getX(); + if (child < tqchildren.count()) { + return tqchildren.at(child)->getX(); } else { - if (children.count() > 0) { - return children.at(child-1)->getX() + children.at(child-1)->getWidth(); + if (tqchildren.count() > 0) { + return tqchildren.at(child-1)->getX() + tqchildren.at(child-1)->getWidth(); } else { return context.ptToLayoutUnitPixX( 2 ); @@ -449,11 +449,11 @@ luPixel SequenceElement::getChildPosition( const ContextStyle& context, uint chi */ void SequenceElement::moveLeft(FormulaCursor* cursor, BasicElement* from) { - // Our parent asks us for a cursor position. Found. + // Our tqparent asks us for a cursor position. Found. if (from == getParent()) { - cursor->setTo(this, children.count()); + cursor->setTo(this, tqchildren.count()); if ( cursor->isSelectionMode() ) { - cursor->setMark( children.count() ); + cursor->setMark( tqchildren.count() ); } from->entered( this ); } @@ -464,7 +464,7 @@ void SequenceElement::moveLeft(FormulaCursor* cursor, BasicElement* from) cursor->setTo(this, cursor->getPos()-1); // invisible elements are not visible so we move on. - if (children.at(cursor->getPos())->isInvisible()) { + if (tqchildren.at(cursor->getPos())->isInvisible()) { moveLeft(cursor, this); } } @@ -479,12 +479,12 @@ void SequenceElement::moveLeft(FormulaCursor* cursor, BasicElement* from) } } - // The cursor came from one of our children or + // The cursor came from one of our tqchildren or // something is wrong. else { - int fromPos = children.find(from); + int fromPos = tqchildren.tqfind(from); if ( fromPos > 0 ) { - children.at( fromPos - 1)->moveLeft( cursor, this ); + tqchildren.at( fromPos - 1)->moveLeft( cursor, this ); } // invisible elements are not visible so we move on. @@ -502,7 +502,7 @@ void SequenceElement::moveLeft(FormulaCursor* cursor, BasicElement* from) */ void SequenceElement::moveRight(FormulaCursor* cursor, BasicElement* from) { - // Our parent asks us for a cursor position. Found. + // Our tqparent asks us for a cursor position. Found. if (from == getParent()) { cursor->setTo(this, 0); from->entered( this ); @@ -511,11 +511,11 @@ void SequenceElement::moveRight(FormulaCursor* cursor, BasicElement* from) // We already owned the cursor. Ask next child then. else if (from == this) { uint pos = cursor->getPos(); - if (pos < children.count()) { + if (pos < tqchildren.count()) { cursor->setTo(this, pos+1); // invisible elements are not visible so we move on. - if (children.at(pos)->isInvisible()) { + if (tqchildren.at(pos)->isInvisible()) { moveRight(cursor, this); } } @@ -530,12 +530,12 @@ void SequenceElement::moveRight(FormulaCursor* cursor, BasicElement* from) } } - // The cursor came from one of our children or + // The cursor came from one of our tqchildren or // something is wrong. else { - int fromPos = children.find(from); - if ( fromPos < children.count() - 1 ) { - children.at( fromPos + 1 )->moveDown( cursor, this ); + int fromPos = tqchildren.tqfind(from); + if ( fromPos < tqchildren.count() - 1 ) { + tqchildren.at( fromPos + 1 )->moveDown( cursor, this ); } else { cursor->setTo(this, fromPos+1); @@ -557,7 +557,7 @@ void SequenceElement::moveWordLeft(FormulaCursor* cursor) { uint pos = cursor->getPos(); if (pos > 0) { - ElementType* type = children.at(pos-1)->getElementType(); + ElementType* type = tqchildren.at(pos-1)->getElementType(); if (type != 0) { cursor->setTo(this, type->start()); } @@ -571,8 +571,8 @@ void SequenceElement::moveWordLeft(FormulaCursor* cursor) void SequenceElement::moveWordRight(FormulaCursor* cursor) { uint pos = cursor->getPos(); - if (pos < children.count()) { - ElementType* type = children.at(pos)->getElementType(); + if (pos < tqchildren.count()) { + ElementType* type = tqchildren.at(pos)->getElementType(); if (type != 0) { cursor->setTo(this, type->end()); } @@ -596,7 +596,7 @@ void SequenceElement::moveUp(FormulaCursor* cursor, BasicElement* from) else if ( from == this ) { if ( getParent() != 0 ) { uint pos = cursor->getPos(); - if ( pos < (children.count() - 1) / 2 ) { + if ( pos < (tqchildren.count() - 1) / 2 ) { getParent()->moveLeft( cursor, this ); } else { @@ -630,8 +630,8 @@ void SequenceElement::moveDown(FormulaCursor* cursor, BasicElement* from) } else if (from == this) { uint pos = cursor->getPos(); - if (pos < children.count()) { - children.at(pos)->moveDown(cursor, this); + if (pos < tqchildren.count()) { + tqchildren.at(pos)->moveDown(cursor, this); } } else { @@ -639,7 +639,7 @@ void SequenceElement::moveDown(FormulaCursor* cursor, BasicElement* from) getParent()->moveDown(cursor, this); } else { - cursor->setTo( this, children.count() ); + cursor->setTo( this, tqchildren.count() ); from->entered( this ); // formula()->moveOutBelow( cursor ); } @@ -658,7 +658,7 @@ void SequenceElement::moveHome(FormulaCursor* cursor) while (element->getParent() != this) { element = element->getParent(); } - cursor->setMark(children.find(element)+1); + cursor->setMark(tqchildren.tqfind(element)+1); } } cursor->setTo(this, 0); @@ -676,16 +676,16 @@ void SequenceElement::moveEnd(FormulaCursor* cursor) while (element->getParent() != this) { element = element->getParent(); if (element == 0) { - cursor->setMark(children.count()); + cursor->setMark(tqchildren.count()); break; } } if (element != 0) { - cursor->setMark(children.find(element)); + cursor->setMark(tqchildren.tqfind(element)); } } } - cursor->setTo(this, children.count()); + cursor->setTo(this, tqchildren.count()); } /** @@ -705,11 +705,11 @@ void SequenceElement::goInside(FormulaCursor* cursor) void SequenceElement::goInsideLast(FormulaCursor* cursor) { cursor->setSelection(false); - cursor->setTo(this, children.count()); + cursor->setTo(this, tqchildren.count()); } -// children +// tqchildren /** * Insert a new child in the sequence @@ -723,7 +723,7 @@ void SequenceElement::goInsideLast(FormulaCursor* cursor) bool SequenceElement::insert( uint index, BasicElement *child ) { - return children.insert( index, child ); + return tqchildren.insert( index, child ); } /** @@ -735,14 +735,14 @@ bool SequenceElement::insert( uint index, BasicElement *child ) */ // void SequenceElement::removeChild(FormulaCursor* cursor, BasicElement* child) // { -// int pos = children.find(child); +// int pos = tqchildren.tqfind(child); // formula()->elementRemoval(child, pos); // cursor->setTo(this, pos); -// children.remove(pos); +// tqchildren.remove(pos); // /* -// if len(self.children) == 0: -// if self.parent != None: -// self.parent.removeChild(cursor, self) +// if len(self.tqchildren) == 0: +// if self.tqparent != None: +// self.tqparent.removeChild(cursor, self) // return // */ // formula()->changed(); @@ -750,14 +750,14 @@ bool SequenceElement::insert( uint index, BasicElement *child ) /** - * 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. The inserted elements will * be selected. * * The list will be emptied but stays the property of the caller. */ void SequenceElement::insert(FormulaCursor* cursor, - QPtrList<BasicElement>& newChildren, + TQPtrList<BasicElement>& newChildren, Direction direction) { int pos = cursor->getPos(); @@ -765,7 +765,7 @@ void SequenceElement::insert(FormulaCursor* cursor, for (uint i = 0; i < count; i++) { BasicElement* child = newChildren.take(0); child->setParent(this); - children.insert(pos+i, child); + tqchildren.insert(pos+i, child); } if (direction == beforeCursor) { cursor->setTo(this, pos+count, pos); @@ -780,13 +780,13 @@ void SequenceElement::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 ownership of the list is passed to the caller. */ void SequenceElement::remove(FormulaCursor* cursor, - QPtrList<BasicElement>& removedChildren, + TQPtrList<BasicElement>& removedChildren, Direction direction) { if (cursor->isSelection()) { @@ -803,9 +803,9 @@ void SequenceElement::remove(FormulaCursor* cursor, int pos = cursor->getPos() - 1; if (pos >= 0) { while (pos >= 0) { - BasicElement* child = children.at(pos); + BasicElement* child = tqchildren.at(pos); formula()->elementRemoval(child); - children.take(pos); + tqchildren.take(pos); removedChildren.prepend(child); if (!child->isInvisible()) { break; @@ -818,11 +818,11 @@ void SequenceElement::remove(FormulaCursor* cursor, } else { uint pos = cursor->getPos(); - if (pos < children.count()) { - while (pos < children.count()) { - BasicElement* child = children.at(pos); + if (pos < tqchildren.count()) { + while (pos < tqchildren.count()) { + BasicElement* child = tqchildren.at(pos); formula()->elementRemoval(child); - children.take(pos); + tqchildren.take(pos); removedChildren.append(child); if (!child->isInvisible()) { break; @@ -841,13 +841,13 @@ void SequenceElement::remove(FormulaCursor* cursor, /** - * Removes the children at pos and appends it to the list. + * Removes the tqchildren at pos and appends it to the list. */ -void SequenceElement::removeChild(QPtrList<BasicElement>& removedChildren, int pos) +void SequenceElement::removeChild(TQPtrList<BasicElement>& removedChildren, int pos) { - BasicElement* child = children.at(pos); + BasicElement* child = tqchildren.at(pos); formula()->elementRemoval(child); - children.take(pos); + tqchildren.take(pos); removedChildren.append(child); //cerr << *removedChildren.at(0) << endl; formula()->changed(); @@ -872,12 +872,12 @@ BasicElement* SequenceElement::getChild( FormulaCursor* cursor, Direction direct { if ( direction == beforeCursor ) { if ( cursor->getPos() > 0 ) { - return children.at( cursor->getPos() - 1 ); + return tqchildren.at( cursor->getPos() - 1 ); } } else { - if ( cursor->getPos() < qRound( children.count() ) ) { - return children.at( cursor->getPos() ); + if ( cursor->getPos() < tqRound( tqchildren.count() ) ) { + return tqchildren.at( cursor->getPos() ); } } return 0; @@ -890,7 +890,7 @@ BasicElement* SequenceElement::getChild( FormulaCursor* cursor, Direction direct */ void SequenceElement::selectChild(FormulaCursor* cursor, BasicElement* child) { - int pos = children.find(child); + int pos = tqchildren.tqfind(child); if (pos > -1) { cursor->setTo(this, pos+1, pos); } @@ -898,7 +898,7 @@ void SequenceElement::selectChild(FormulaCursor* cursor, BasicElement* child) void SequenceElement::childWillVanish(FormulaCursor* cursor, BasicElement* child) { - int childPos = children.find(child); + int childPos = tqchildren.tqfind(child); if (childPos > -1) { int pos = cursor->getPos(); if (pos > childPos) { @@ -914,21 +914,21 @@ void SequenceElement::childWillVanish(FormulaCursor* cursor, BasicElement* child /** - * Selects all children. The cursor is put behind, the mark before them. + * Selects all tqchildren. The cursor is put behind, the mark before them. */ void SequenceElement::selectAllChildren(FormulaCursor* cursor) { - cursor->setTo(this, children.count(), 0); + cursor->setTo(this, tqchildren.count(), 0); } bool SequenceElement::onlyTextSelected( FormulaCursor* cursor ) { if ( cursor->isSelection() ) { - uint from = QMIN( cursor->getPos(), cursor->getMark() ); - uint to = QMAX( cursor->getPos(), cursor->getMark() ); + uint from = TQMIN( cursor->getPos(), cursor->getMark() ); + uint to = TQMAX( cursor->getPos(), cursor->getMark() ); for ( uint i = from; i < to; i++ ) { BasicElement* element = getChild( i ); - if ( element->getCharacter() == QChar::null ) { + if ( element->getCharacter() == TQChar::null ) { return false; } } @@ -1116,7 +1116,7 @@ KCommand* SequenceElement::buildCommand( Container* container, Request* request case req_addIndex: { if ( cursor->getPos() > 0 && !cursor->isSelection() ) { IndexElement* element = - dynamic_cast<IndexElement*>( children.at( cursor->getPos()-1 ) ); + dynamic_cast<IndexElement*>( tqchildren.at( cursor->getPos()-1 ) ); if ( element != 0 ) { element->goInside( cursor ); return element->buildCommand( container, request ); @@ -1182,9 +1182,9 @@ KCommand* SequenceElement::buildCommand( Container* container, Request* request if ((element != 0) && !element->isSymbol()) { cursor->selectActiveElement(); const SymbolTable& table = container->document()->getSymbolTable(); - if (table.greekLetters().find(element->getCharacter()) != -1) { + if (table.greekLetters().tqfind(element->getCharacter()) != -1) { KFCReplace* command = new KFCReplace( i18n( "Change Char to Symbol" ), container ); - TextElement* symbol = creationStrategy->createTextElement( table.unicodeFromSymbolFont( element->getCharacter() ), true ); + TextElement* symbol = creationStrategy->createTextElement( table.tqunicodeFromSymbolFont( element->getCharacter() ), true ); command->addElement( symbol ); return command; } @@ -1206,7 +1206,7 @@ KCommand* SequenceElement::buildCommand( Container* container, Request* request CharStyleCommand* cmd = new CharStyleCommand( cs, i18n( "Change Char Style" ), container ); int end = cursor->getSelectionEnd(); for ( int i = cursor->getSelectionStart(); i<end; ++i ) { - cmd->addElement( children.at( i ) ); + cmd->addElement( tqchildren.at( i ) ); } return cmd; } @@ -1219,7 +1219,7 @@ KCommand* SequenceElement::buildCommand( Container* container, Request* request CharFamilyCommand* cmd = new CharFamilyCommand( cf, i18n( "Change Char Family" ), container ); int end = cursor->getSelectionEnd(); for ( int i = cursor->getSelectionStart(); i<end; ++i ) { - cmd->addElement( children.at( i ) ); + cmd->addElement( tqchildren.at( i ) ); } return cmd; } @@ -1232,9 +1232,9 @@ KCommand* SequenceElement::buildCommand( Container* container, Request* request } -KCommand* SequenceElement::input( Container* container, QKeyEvent* event ) +KCommand* SequenceElement::input( Container* container, TQKeyEvent* event ) { - QChar ch = event->text().at( 0 ); + TQChar ch = event->text().at( 0 ); if ( ch.isPrint() ) { return input( container, ch ); } @@ -1244,58 +1244,58 @@ KCommand* SequenceElement::input( Container* container, QKeyEvent* event ) MoveFlag flag = movementFlag(state); switch ( action ) { - case Qt::Key_BackSpace: { + case TQt::Key_BackSpace: { DirectedRemove r( req_remove, beforeCursor ); return buildCommand( container, &r ); } - case Qt::Key_Delete: { + case TQt::Key_Delete: { DirectedRemove r( req_remove, afterCursor ); return buildCommand( container, &r ); } - case Qt::Key_Left: { + case TQt::Key_Left: { FormulaCursor* cursor = container->activeCursor(); cursor->moveLeft( flag ); formula()->cursorHasMoved( cursor ); break; } - case Qt::Key_Right: { + case TQt::Key_Right: { FormulaCursor* cursor = container->activeCursor(); cursor->moveRight( flag ); formula()->cursorHasMoved( cursor ); break; } - case Qt::Key_Up: { + case TQt::Key_Up: { FormulaCursor* cursor = container->activeCursor(); cursor->moveUp( flag ); formula()->cursorHasMoved( cursor ); break; } - case Qt::Key_Down: { + case TQt::Key_Down: { FormulaCursor* cursor = container->activeCursor(); cursor->moveDown( flag ); formula()->cursorHasMoved( cursor ); break; } - case Qt::Key_Home: { + case TQt::Key_Home: { FormulaCursor* cursor = container->activeCursor(); cursor->moveHome( flag ); formula()->cursorHasMoved( cursor ); break; } - case Qt::Key_End: { + case TQt::Key_End: { FormulaCursor* cursor = container->activeCursor(); cursor->moveEnd( flag ); formula()->cursorHasMoved( cursor ); break; } default: - if ( state & Qt::ControlButton ) { + if ( state & TQt::ControlButton ) { switch ( event->key() ) { - case Qt::Key_AsciiCircum: { + case TQt::Key_AsciiCircum: { IndexRequest r( upperLeftPos ); return buildCommand( container, &r ); } - case Qt::Key_Underscore: { + case TQt::Key_Underscore: { IndexRequest r( lowerLeftPos ); return buildCommand( container, &r ); } @@ -1309,10 +1309,10 @@ KCommand* SequenceElement::input( Container* container, QKeyEvent* event ) } -KCommand* SequenceElement::input( Container* container, QChar ch ) +KCommand* SequenceElement::input( Container* container, TQChar ch ) { - int unicode = ch.unicode(); - switch (unicode) { + int tqunicode = ch.tqunicode(); + switch (tqunicode) { case '(': { BracketRequest r( container->document()->leftBracketChar(), container->document()->rightBracketChar() ); @@ -1397,25 +1397,25 @@ KCommand* SequenceElement::input( Container* container, QChar ch ) } /** - * Stores the given childrens dom in the element. + * Stores the given tqchildrens dom in the element. */ -void SequenceElement::getChildrenDom( QDomDocument& doc, QDomElement elem, +void SequenceElement::getChildrenDom( TQDomDocument& doc, TQDomElement elem, uint from, uint to) { for (uint i = from; i < to; i++) { - QDomElement tmpEleDom=children.at(i)->getElementDom(doc); + TQDomElement tmpEleDom=tqchildren.at(i)->getElementDom(doc); elem.appendChild(tmpEleDom); } } /** - * Stores the given childrens MathML dom in the element. + * Stores the given tqchildrens MathML dom in the element. */ -void SequenceElement::getChildrenMathMLDom( QDomDocument& doc, QDomNode& parent, +void SequenceElement::getChildrenMathMLDom( TQDomDocument& doc, TQDomNode& tqparent, uint from, uint to) { for ( uint i = from; i < to; i++ ) { - children.at( i )->writeMathML( doc, parent, false ); + tqchildren.at( i )->writeMathML( doc, tqparent, false ); } } @@ -1425,13 +1425,13 @@ void SequenceElement::getChildrenMathMLDom( QDomDocument& doc, QDomNode& parent, * puts them into the list. * Returns false if an error occures. */ -bool SequenceElement::buildChildrenFromDom(QPtrList<BasicElement>& list, QDomNode n) +bool SequenceElement::buildChildrenFromDom(TQPtrList<BasicElement>& list, TQDomNode n) { while (!n.isNull()) { if (n.isElement()) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); BasicElement* child = 0; - QString tag = e.tagName().upper(); + TQString tag = e.tagName().upper(); child = createElement(tag, e); if (child != 0) { @@ -1455,7 +1455,7 @@ bool SequenceElement::buildChildrenFromDom(QPtrList<BasicElement>& list, QDomNod } -BasicElement* SequenceElement::createElement( QString type, const QDomElement& element ) +BasicElement* SequenceElement::createElement( TQString type, const TQDomElement& element ) { return creationStrategy->createElement( type, element ); } @@ -1463,12 +1463,12 @@ BasicElement* SequenceElement::createElement( QString type, const QDomElement& e /** * Appends our attributes to the dom element. */ -void SequenceElement::writeDom(QDomElement element) +void SequenceElement::writeDom(TQDomElement element) { BasicElement::writeDom(element); - uint count = children.count(); - QDomDocument doc = element.ownerDocument(); + uint count = tqchildren.count(); + TQDomDocument doc = element.ownerDocument(); getChildrenDom(doc, element, 0, count); } @@ -1476,7 +1476,7 @@ void SequenceElement::writeDom(QDomElement element) * Reads our attributes from the element. * Returns false if it failed. */ -bool SequenceElement::readAttributesFromDom(QDomElement element) +bool SequenceElement::readAttributesFromDom(TQDomElement element) { if (!BasicElement::readAttributesFromDom(element)) { return false; @@ -1489,13 +1489,13 @@ bool SequenceElement::readAttributesFromDom(QDomElement element) * that needs to be read. * Returns false if it failed. */ -bool SequenceElement::readContentFromDom(QDomNode& node) +bool SequenceElement::readContentFromDom(TQDomNode& node) { if (!BasicElement::readContentFromDom(node)) { return false; } - return buildChildrenFromDom(children, node); + return buildChildrenFromDom(tqchildren, node); } @@ -1504,9 +1504,9 @@ void SequenceElement::parse() delete parseTree; textSequence = true; - for (BasicElement* element = children.first(); + for (BasicElement* element = tqchildren.first(); element != 0; - element = children.next()) { + element = tqchildren.next()) { // Those types are gone. Make sure they won't // be used. @@ -1519,10 +1519,10 @@ void SequenceElement::parse() const SymbolTable& symbols = formula()->getSymbolTable(); SequenceParser parser(symbols); - parseTree = parser.parse(children); + parseTree = parser.parse(tqchildren); // With the IndexElement dynamically changing its text/non-text - // behaviour we need to reparse your parent, too. Hacky! + // behaviour we need to reparse your tqparent, too. Hacky! BasicElement* p = getParent(); if ( p != 0 ) { SequenceElement* seq = dynamic_cast<SequenceElement*>( p->getParent() ); @@ -1541,12 +1541,12 @@ bool SequenceElement::isFirstOfToken( BasicElement* child ) } -QString SequenceElement::toLatex() +TQString SequenceElement::toLatex() { - QString content; - uint count = children.count(); + TQString content; + uint count = tqchildren.count(); for ( uint i = 0; i < count; i++ ) { - BasicElement* child = children.at( i ); + BasicElement* child = tqchildren.at( i ); // if ( isFirstOfToken( child ) ) { // content += ""; // } @@ -1556,12 +1556,12 @@ QString SequenceElement::toLatex() } -QString SequenceElement::formulaString() +TQString SequenceElement::formulaString() { - QString content; - uint count = children.count(); + TQString content; + uint count = tqchildren.count(); for ( uint i = 0; i < count; i++ ) { - BasicElement* child = children.at( i ); + BasicElement* child = tqchildren.at( i ); //if ( isFirstOfToken( child ) ) { // content += " "; //} @@ -1571,9 +1571,9 @@ QString SequenceElement::formulaString() } -void SequenceElement::writeMathMLContent( QDomDocument& doc, QDomElement& element, bool oasisFormat ) const +void SequenceElement::writeMathMLContent( TQDomDocument& doc, TQDomElement& element, bool oasisFormat ) const { - for ( QPtrListIterator<BasicElement> it( children ); it.current(); ++it ) { + for ( TQPtrListIterator<BasicElement> it( tqchildren ); it.current(); ++it ) { it.current()->writeMathML( doc, element, oasisFormat ); } } @@ -1581,7 +1581,7 @@ void SequenceElement::writeMathMLContent( QDomDocument& doc, QDomElement& elemen const BasicElement* SequenceElement::getChild( uint i ) const { - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); it += i; return it.current(); } @@ -1589,7 +1589,7 @@ const BasicElement* SequenceElement::getChild( uint i ) const int SequenceElement::childPos( const BasicElement* child ) const { - QPtrListIterator<BasicElement> it( children ); + TQPtrListIterator<BasicElement> it( tqchildren ); uint count = it.count(); for ( uint i=0; i<count; ++i, ++it ) { if ( it.current() == child ) { @@ -1600,8 +1600,8 @@ int SequenceElement::childPos( const BasicElement* child ) const } -NameSequence::NameSequence( BasicElement* parent ) - : SequenceElement( parent ) +NameSequence::NameSequence( BasicElement* tqparent ) + : SequenceElement( tqparent ) { } @@ -1623,19 +1623,19 @@ void NameSequence::calcCursorSize( const ContextStyle& context, getWidth()+2*unitX, getHeight()+2*unitY ) ); } -void NameSequence::drawCursor( QPainter& painter, const ContextStyle& context, +void NameSequence::drawCursor( TQPainter& painter, const ContextStyle& context, StyleAttributes& style, FormulaCursor* cursor, bool smallCursor, bool activeCursor ) { LuPixelPoint point = widgetPos(); - painter.setPen( QPen( context.getEmptyColor(), - context.layoutUnitToPixelX( context.getLineWidth( style.sizeFactor() )/2 ) ) ); + painter.setPen( TQPen( context.getEmptyColor(), + context.tqlayoutUnitToPixelX( context.getLineWidth( style.sizeFactor() )/2 ) ) ); luPixel unitX = context.ptToLayoutUnitPixX( 1 ); luPixel unitY = context.ptToLayoutUnitPixY( 1 ); - painter.drawRect( context.layoutUnitToPixelX( point.x()-unitX ), - context.layoutUnitToPixelY( point.y()-unitY ), - context.layoutUnitToPixelX( getWidth()+2*unitX ), - context.layoutUnitToPixelY( getHeight()+2*unitY ) ); + painter.drawRect( context.tqlayoutUnitToPixelX( point.x()-unitX ), + context.tqlayoutUnitToPixelY( point.y()-unitY ), + context.tqlayoutUnitToPixelX( getWidth()+2*unitX ), + context.tqlayoutUnitToPixelY( getHeight()+2*unitY ) ); inherited::drawCursor( painter, context, style, cursor, smallCursor, activeCursor ); } @@ -1698,10 +1698,10 @@ KCommand* NameSequence::buildCommand( Container* container, Request* request ) } -KCommand* NameSequence::input( Container* container, QChar ch ) +KCommand* NameSequence::input( Container* container, TQChar ch ) { - int unicode = ch.unicode(); - switch (unicode) { + int tqunicode = ch.tqunicode(); + switch (tqunicode) { case '(': case '[': case '|': @@ -1745,13 +1745,13 @@ void NameSequence::setElementType( ElementType* t ) BasicElement* NameSequence::replaceElement( const SymbolTable& table ) { - QString name = buildName(); - QChar ch = table.unicode( name ); + TQString name = buildName(); + TQChar ch = table.tqunicode( name ); if ( !ch.isNull() ) { return new TextElement( ch, true ); } else { - ch = table.unicode( i18n( name.latin1() ) ); + ch = table.tqunicode( i18n( name.latin1() ) ); if ( !ch.isNull() ) { return new TextElement( ch, true ); } @@ -1761,7 +1761,7 @@ BasicElement* NameSequence::replaceElement( const SymbolTable& table ) if ( name == "," ) return new SpaceElement( THIN ); if ( name == ">" ) return new SpaceElement( MEDIUM ); if ( name == ";" ) return new SpaceElement( THICK ); - if ( name == "quad" ) return new SpaceElement( QUAD ); + if ( name == "quad" ) return new SpaceElement( TQUAD ); if ( name == "frac" ) return new FractionElement(); if ( name == "atop" ) { @@ -1774,7 +1774,7 @@ BasicElement* NameSequence::replaceElement( const SymbolTable& table ) return 0; } -BasicElement* NameSequence::createElement( QString type ) +BasicElement* NameSequence::createElement( TQString type ) { if ( type == "TEXT" ) return new TextElement(); return 0; @@ -1782,16 +1782,16 @@ BasicElement* NameSequence::createElement( QString type ) // void NameSequence::parse() // { -// // A name sequence is known as name and so are its children. +// // A name sequence is known as name and so are its tqchildren. // // Caution: this is fake! // for ( int i = 0; i < countChildren(); i++ ) { // getChild( i )->setElementType( getElementType() ); // } // } -QString NameSequence::buildName() +TQString NameSequence::buildName() { - QString name; + TQString name; for ( uint i = 0; i < countChildren(); i++ ) { name += getChild( i )->getCharacter(); } @@ -1807,18 +1807,18 @@ bool NameSequence::isValidSelection( FormulaCursor* cursor ) return sequence->onlyTextSelected( cursor ); } -int SequenceElement::buildChildrenFromMathMLDom(QPtrList<BasicElement>& list, QDomNode n) +int SequenceElement::buildChildrenFromMathMLDom(TQPtrList<BasicElement>& list, TQDomNode n) { while (!n.isNull()) { int nodeNumber = 1; if (n.isElement()) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); BasicElement* child = 0; - QString tag = e.tagName().lower(); + TQString tag = e.tagName().lower(); kdDebug( DEBUGID ) << "Sequence Tag: " << tag << endl; if ( tag == "semantics" ) { // Special case, just pick the first child - QDomNode node = e.firstChild(); + TQDomNode node = e.firstChild(); while( ! node.isElement() ) { node = node.nextSibling(); if ( node.isNull() ) { @@ -1885,16 +1885,16 @@ int SequenceElement::buildChildrenFromMathMLDom(QPtrList<BasicElement>& list, QD /** */ -int SequenceElement::readContentFromMathMLDom(QDomNode& node) +int SequenceElement::readContentFromMathMLDom(TQDomNode& node) { if ( BasicElement::readContentFromMathMLDom(node) == -1 ) { return -1; } - return buildChildrenFromMathMLDom(children, node); + return buildChildrenFromMathMLDom(tqchildren, node); } -int SequenceElement::buildMathMLChild( QDomNode node ) +int SequenceElement::buildMathMLChild( TQDomNode node ) { int nodeCounter = 1; while ( ! node.isElement() ) { @@ -1904,9 +1904,9 @@ int SequenceElement::buildMathMLChild( QDomNode node ) return -1; } } - QDomElement e = node.toElement(); + TQDomElement e = node.toElement(); BasicElement* child = 0; - QString tag = e.tagName().lower(); + TQString tag = e.tagName().lower(); child = creationStrategy->createElement(tag, e); if (child != 0) { @@ -1915,7 +1915,7 @@ int SequenceElement::buildMathMLChild( QDomNode node ) child->setStyle(style); } if (child->buildFromMathMLDom(e) != -1) { - children.append(child); + tqchildren.append(child); } else { delete child; |