diff options
Diffstat (limited to 'lib/kformula/sequenceelement.cc')
-rw-r--r-- | lib/kformula/sequenceelement.cc | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/lib/kformula/sequenceelement.cc b/lib/kformula/sequenceelement.cc index 93293db7..c44c1b50 100644 --- a/lib/kformula/sequenceelement.cc +++ b/lib/kformula/sequenceelement.cc @@ -76,7 +76,7 @@ SequenceElement::SequenceElement(BasicElement* parent) : BasicElement(parent), parseTree(0), textSequence(true),singlePipe(true), style(0) { assert( creationStrategy != 0 ); - tqchildren.setAutoDelete(true); + children.setAutoDelete(true); } @@ -88,12 +88,12 @@ SequenceElement::~SequenceElement() SequenceElement::SequenceElement( const SequenceElement& other ) : BasicElement( other ) { - tqchildren.setAutoDelete(true); - uint count = other.tqchildren.count(); + children.setAutoDelete(true); + uint count = other.children.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = tqchildren.at(i)->clone(); + BasicElement* child = children.at(i)->clone(); child->setParent( this ); - tqchildren.append( child ); + children.append( child ); } } @@ -121,18 +121,18 @@ BasicElement* SequenceElement::goToPos( FormulaCursor* cursor, bool& handled, LuPixelPoint myPos(parentOrigin.x() + getX(), parentOrigin.y() + getY()); - uint count = tqchildren.count(); + uint count = children.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = tqchildren.at(i); + BasicElement* child = children.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, tqchildren.find(e)); + cursor->setTo(this, children.find(e)); } else { - cursor->setTo(this, tqchildren.find(e)+1); + cursor->setTo(this, children.find(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 = tqchildren.at(i); + BasicElement* child = children.at(i); if (dx < child->getX()) { cursor->setTo( this, i ); handled = true; - return tqchildren.at( i ); + return children.at( i ); } } @@ -161,9 +161,9 @@ BasicElement* SequenceElement::goToPos( FormulaCursor* cursor, bool& handled, bool SequenceElement::isEmpty() { - uint count = tqchildren.count(); + uint count = children.count(); for (uint i = 0; i < count; i++) { - BasicElement* child = tqchildren.at(i); + BasicElement* child = children.at(i); if (!child->isInvisible()) { return false; } @@ -174,7 +174,7 @@ bool SequenceElement::isEmpty() /** * Calculates our width and height and - * our tqchildren's parentPosition. + * our children's parentPosition. */ 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. - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); @@ -237,7 +237,7 @@ void SequenceElement::calcSizes( const ContextStyle& context, void SequenceElement::setChildrenPositions() { - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); child->setY(getBaseline() - child->getBaseline()); @@ -246,7 +246,7 @@ void SequenceElement::setChildrenPositions() /** - * Draws the whole element including its tqchildren. + * 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. */ @@ -264,7 +264,7 @@ void SequenceElement::draw( TQPainter& painter, const LuPixelRect& r, // return; if (!isEmpty()) { - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); for (int i = 0 ; it.current(); i++) { BasicElement* child = it.current(); if (!child->isInvisible()) { @@ -308,7 +308,7 @@ void SequenceElement::draw( TQPainter& painter, const LuPixelRect& r, void SequenceElement::dispatchFontCommand( FontCommand* cmd ) { - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); for ( ; it.current(); ++it ) { BasicElement* child = it.current(); child->dispatchFontCommand( cmd ); @@ -420,12 +420,12 @@ void SequenceElement::drawCursor( TQPainter& painter, const ContextStyle& contex luPixel SequenceElement::getChildPosition( const ContextStyle& context, uint child ) { - if (child < tqchildren.count()) { - return tqchildren.at(child)->getX(); + if (child < children.count()) { + return children.at(child)->getX(); } else { - if (tqchildren.count() > 0) { - return tqchildren.at(child-1)->getX() + tqchildren.at(child-1)->getWidth(); + if (children.count() > 0) { + return children.at(child-1)->getX() + children.at(child-1)->getWidth(); } else { return context.ptToLayoutUnitPixX( 2 ); @@ -451,9 +451,9 @@ void SequenceElement::moveLeft(FormulaCursor* cursor, BasicElement* from) { // Our parent asks us for a cursor position. Found. if (from == getParent()) { - cursor->setTo(this, tqchildren.count()); + cursor->setTo(this, children.count()); if ( cursor->isSelectionMode() ) { - cursor->setMark( tqchildren.count() ); + cursor->setMark( children.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 (tqchildren.at(cursor->getPos())->isInvisible()) { + if (children.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 tqchildren or + // The cursor came from one of our children or // something is wrong. else { - int fromPos = tqchildren.find(from); + int fromPos = children.find(from); if ( fromPos > 0 ) { - tqchildren.at( fromPos - 1)->moveLeft( cursor, this ); + children.at( fromPos - 1)->moveLeft( cursor, this ); } // invisible elements are not visible so we move on. @@ -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 < tqchildren.count()) { + if (pos < children.count()) { cursor->setTo(this, pos+1); // invisible elements are not visible so we move on. - if (tqchildren.at(pos)->isInvisible()) { + if (children.at(pos)->isInvisible()) { moveRight(cursor, this); } } @@ -530,12 +530,12 @@ void SequenceElement::moveRight(FormulaCursor* cursor, BasicElement* from) } } - // The cursor came from one of our tqchildren or + // The cursor came from one of our children or // something is wrong. else { - int fromPos = tqchildren.find(from); - if ( fromPos < tqchildren.count() - 1 ) { - tqchildren.at( fromPos + 1 )->moveDown( cursor, this ); + int fromPos = children.find(from); + if ( fromPos < children.count() - 1 ) { + children.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 = tqchildren.at(pos-1)->getElementType(); + ElementType* type = children.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 < tqchildren.count()) { - ElementType* type = tqchildren.at(pos)->getElementType(); + if (pos < children.count()) { + ElementType* type = children.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 < (tqchildren.count() - 1) / 2 ) { + if ( pos < (children.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 < tqchildren.count()) { - tqchildren.at(pos)->moveDown(cursor, this); + if (pos < children.count()) { + children.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, tqchildren.count() ); + cursor->setTo( this, children.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(tqchildren.find(element)+1); + cursor->setMark(children.find(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(tqchildren.count()); + cursor->setMark(children.count()); break; } } if (element != 0) { - cursor->setMark(tqchildren.find(element)); + cursor->setMark(children.find(element)); } } } - cursor->setTo(this, tqchildren.count()); + cursor->setTo(this, children.count()); } /** @@ -705,11 +705,11 @@ void SequenceElement::goInside(FormulaCursor* cursor) void SequenceElement::goInsideLast(FormulaCursor* cursor) { cursor->setSelection(false); - cursor->setTo(this, tqchildren.count()); + cursor->setTo(this, children.count()); } -// tqchildren +// children /** * Insert a new child in the sequence @@ -723,7 +723,7 @@ void SequenceElement::goInsideLast(FormulaCursor* cursor) bool SequenceElement::insert( uint index, BasicElement *child ) { - return tqchildren.insert( index, child ); + return children.insert( index, child ); } /** @@ -735,12 +735,12 @@ bool SequenceElement::insert( uint index, BasicElement *child ) */ // void SequenceElement::removeChild(FormulaCursor* cursor, BasicElement* child) // { -// int pos = tqchildren.find(child); +// int pos = children.find(child); // formula()->elementRemoval(child, pos); // cursor->setTo(this, pos); -// tqchildren.remove(pos); +// children.remove(pos); // /* -// if len(self.tqchildren) == 0: +// if len(self.children) == 0: // if self.parent != None: // self.parent.removeChild(cursor, self) // return @@ -750,7 +750,7 @@ bool SequenceElement::insert( uint index, BasicElement *child ) /** - * Inserts all new tqchildren at the cursor position. Places the + * Inserts all new children at the cursor position. Places the * cursor according to the direction. The inserted elements will * be selected. * @@ -765,7 +765,7 @@ void SequenceElement::insert(FormulaCursor* cursor, for (uint i = 0; i < count; i++) { BasicElement* child = newChildren.take(0); child->setParent(this); - tqchildren.insert(pos+i, child); + children.insert(pos+i, child); } if (direction == beforeCursor) { cursor->setTo(this, pos+count, pos); @@ -780,8 +780,8 @@ void SequenceElement::insert(FormulaCursor* cursor, /** - * Removes all selected tqchildren and returns them. Places the - * cursor to where the tqchildren have been. + * Removes all selected children and returns them. Places the + * cursor to where the children have been. * * The ownership of the list is passed to the caller. */ @@ -803,9 +803,9 @@ void SequenceElement::remove(FormulaCursor* cursor, int pos = cursor->getPos() - 1; if (pos >= 0) { while (pos >= 0) { - BasicElement* child = tqchildren.at(pos); + BasicElement* child = children.at(pos); formula()->elementRemoval(child); - tqchildren.take(pos); + children.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 < tqchildren.count()) { - while (pos < tqchildren.count()) { - BasicElement* child = tqchildren.at(pos); + if (pos < children.count()) { + while (pos < children.count()) { + BasicElement* child = children.at(pos); formula()->elementRemoval(child); - tqchildren.take(pos); + children.take(pos); removedChildren.append(child); if (!child->isInvisible()) { break; @@ -841,13 +841,13 @@ void SequenceElement::remove(FormulaCursor* cursor, /** - * Removes the tqchildren at pos and appends it to the list. + * Removes the children at pos and appends it to the list. */ void SequenceElement::removeChild(TQPtrList<BasicElement>& removedChildren, int pos) { - BasicElement* child = tqchildren.at(pos); + BasicElement* child = children.at(pos); formula()->elementRemoval(child); - tqchildren.take(pos); + children.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 tqchildren.at( cursor->getPos() - 1 ); + return children.at( cursor->getPos() - 1 ); } } else { - if ( cursor->getPos() < tqRound( tqchildren.count() ) ) { - return tqchildren.at( cursor->getPos() ); + if ( cursor->getPos() < tqRound( children.count() ) ) { + return children.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 = tqchildren.find(child); + int pos = children.find(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 = tqchildren.find(child); + int childPos = children.find(child); if (childPos > -1) { int pos = cursor->getPos(); if (pos > childPos) { @@ -914,11 +914,11 @@ void SequenceElement::childWillVanish(FormulaCursor* cursor, BasicElement* child /** - * Selects all tqchildren. The cursor is put behind, the mark before them. + * Selects all children. The cursor is put behind, the mark before them. */ void SequenceElement::selectAllChildren(FormulaCursor* cursor) { - cursor->setTo(this, tqchildren.count(), 0); + cursor->setTo(this, children.count(), 0); } bool SequenceElement::onlyTextSelected( FormulaCursor* cursor ) @@ -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*>( tqchildren.at( cursor->getPos()-1 ) ); + dynamic_cast<IndexElement*>( children.at( cursor->getPos()-1 ) ); if ( element != 0 ) { element->goInside( cursor ); return element->buildCommand( container, request ); @@ -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( tqchildren.at( i ) ); + cmd->addElement( children.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( tqchildren.at( i ) ); + cmd->addElement( children.at( i ) ); } return cmd; } @@ -1397,25 +1397,25 @@ KCommand* SequenceElement::input( Container* container, TQChar ch ) } /** - * Stores the given tqchildrens dom in the element. + * Stores the given childrens dom in the element. */ void SequenceElement::getChildrenDom( TQDomDocument& doc, TQDomElement elem, uint from, uint to) { for (uint i = from; i < to; i++) { - TQDomElement tmpEleDom=tqchildren.at(i)->getElementDom(doc); + TQDomElement tmpEleDom=children.at(i)->getElementDom(doc); elem.appendChild(tmpEleDom); } } /** - * Stores the given tqchildrens MathML dom in the element. + * Stores the given childrens MathML dom in the element. */ void SequenceElement::getChildrenMathMLDom( TQDomDocument& doc, TQDomNode& parent, uint from, uint to) { for ( uint i = from; i < to; i++ ) { - tqchildren.at( i )->writeMathML( doc, parent, false ); + children.at( i )->writeMathML( doc, parent, false ); } } @@ -1467,7 +1467,7 @@ void SequenceElement::writeDom(TQDomElement element) { BasicElement::writeDom(element); - uint count = tqchildren.count(); + uint count = children.count(); TQDomDocument doc = element.ownerDocument(); getChildrenDom(doc, element, 0, count); } @@ -1495,7 +1495,7 @@ bool SequenceElement::readContentFromDom(TQDomNode& node) return false; } - return buildChildrenFromDom(tqchildren, node); + return buildChildrenFromDom(children, node); } @@ -1504,9 +1504,9 @@ void SequenceElement::parse() delete parseTree; textSequence = true; - for (BasicElement* element = tqchildren.first(); + for (BasicElement* element = children.first(); element != 0; - element = tqchildren.next()) { + element = children.next()) { // Those types are gone. Make sure they won't // be used. @@ -1519,7 +1519,7 @@ void SequenceElement::parse() const SymbolTable& symbols = formula()->getSymbolTable(); SequenceParser parser(symbols); - parseTree = parser.parse(tqchildren); + parseTree = parser.parse(children); // With the IndexElement dynamically changing its text/non-text // behaviour we need to reparse your parent, too. Hacky! @@ -1544,9 +1544,9 @@ bool SequenceElement::isFirstOfToken( BasicElement* child ) TQString SequenceElement::toLatex() { TQString content; - uint count = tqchildren.count(); + uint count = children.count(); for ( uint i = 0; i < count; i++ ) { - BasicElement* child = tqchildren.at( i ); + BasicElement* child = children.at( i ); // if ( isFirstOfToken( child ) ) { // content += ""; // } @@ -1559,9 +1559,9 @@ TQString SequenceElement::toLatex() TQString SequenceElement::formulaString() { TQString content; - uint count = tqchildren.count(); + uint count = children.count(); for ( uint i = 0; i < count; i++ ) { - BasicElement* child = tqchildren.at( i ); + BasicElement* child = children.at( i ); //if ( isFirstOfToken( child ) ) { // content += " "; //} @@ -1573,7 +1573,7 @@ TQString SequenceElement::formulaString() void SequenceElement::writeMathMLContent( TQDomDocument& doc, TQDomElement& element, bool oasisFormat ) const { - for ( TQPtrListIterator<BasicElement> it( tqchildren ); it.current(); ++it ) { + for ( TQPtrListIterator<BasicElement> it( children ); it.current(); ++it ) { it.current()->writeMathML( doc, element, oasisFormat ); } } @@ -1581,7 +1581,7 @@ void SequenceElement::writeMathMLContent( TQDomDocument& doc, TQDomElement& elem const BasicElement* SequenceElement::getChild( uint i ) const { - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); it += i; return it.current(); } @@ -1589,7 +1589,7 @@ const BasicElement* SequenceElement::getChild( uint i ) const int SequenceElement::childPos( const BasicElement* child ) const { - TQPtrListIterator<BasicElement> it( tqchildren ); + TQPtrListIterator<BasicElement> it( children ); uint count = it.count(); for ( uint i=0; i<count; ++i, ++it ) { if ( it.current() == child ) { @@ -1782,7 +1782,7 @@ BasicElement* NameSequence::createElement( TQString type ) // void NameSequence::parse() // { -// // A name sequence is known as name and so are its tqchildren. +// // A name sequence is known as name and so are its children. // // Caution: this is fake! // for ( int i = 0; i < countChildren(); i++ ) { // getChild( i )->setElementType( getElementType() ); @@ -1891,7 +1891,7 @@ int SequenceElement::readContentFromMathMLDom(TQDomNode& node) return -1; } - return buildChildrenFromMathMLDom(tqchildren, node); + return buildChildrenFromMathMLDom(children, node); } int SequenceElement::buildMathMLChild( TQDomNode node ) @@ -1915,7 +1915,7 @@ int SequenceElement::buildMathMLChild( TQDomNode node ) child->setStyle(style); } if (child->buildFromMathMLDom(e) != -1) { - tqchildren.append(child); + children.append(child); } else { delete child; |