summaryrefslogtreecommitdiffstats
path: root/lib/kformula/symbolelement.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kformula/symbolelement.cc')
-rw-r--r--lib/kformula/symbolelement.cc134
1 files changed, 67 insertions, 67 deletions
diff --git a/lib/kformula/symbolelement.cc b/lib/kformula/symbolelement.cc
index 49932bee..518fba2f 100644
--- a/lib/kformula/symbolelement.cc
+++ b/lib/kformula/symbolelement.cc
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include <kdebug.h>
@@ -36,7 +36,7 @@ class SymbolSequenceElement : public SequenceElement {
typedef SequenceElement inherited;
public:
- SymbolSequenceElement( BasicElement* parent = 0 ) : SequenceElement( parent ) {}
+ SymbolSequenceElement( BasicElement* tqparent = 0 ) : SequenceElement( tqparent ) {}
/**
* This is called by the container to get a command depending on
@@ -87,8 +87,8 @@ KCommand* SymbolSequenceElement::buildCommand( Container* container, Request* re
}
-SymbolElement::SymbolElement(SymbolType type, BasicElement* parent)
- : BasicElement(parent), symbol( 0 ), symbolType( type )
+SymbolElement::SymbolElement(SymbolType type, BasicElement* tqparent)
+ : BasicElement(tqparent), symbol( 0 ), symbolType( type )
{
content = new SymbolSequenceElement( this );
upper = 0;
@@ -134,12 +134,12 @@ bool SymbolElement::accept( ElementVisitor* visitor )
BasicElement* SymbolElement::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) {
@@ -192,7 +192,7 @@ BasicElement* SymbolElement::goToPos( FormulaCursor* cursor, bool& handled,
/**
* Calculates our width and height and
- * our children's parentPosition.
+ * our tqchildren's tqparentPosition.
*/
void SymbolElement::calcSizes( const ContextStyle& context,
ContextStyle::TextStyle tstyle,
@@ -212,7 +212,7 @@ void SymbolElement::calcSizes( const ContextStyle& context,
symbol->calcSizes(context, tstyle, factor, mySize);
content->calcSizes( context, tstyle, istyle, style );
- //symbol->scale(((double)parentSize)/symbol->getHeight()*2);
+ //symbol->scale(((double)tqparentSize)/symbol->getHeight()*2);
luPixel upperWidth = 0;
luPixel upperHeight = 0;
@@ -233,7 +233,7 @@ void SymbolElement::calcSizes( const ContextStyle& context,
}
// widths
- luPixel xOffset = QMAX(symbol->getWidth(), QMAX(upperWidth, lowerWidth));
+ luPixel xOffset = TQMAX(symbol->getWidth(), TQMAX(upperWidth, lowerWidth));
if (context.getCenterSymbol()) {
symbol->setX((xOffset - symbol->getWidth()) / 2);
}
@@ -245,15 +245,15 @@ void SymbolElement::calcSizes( const ContextStyle& context,
static_cast<luPixel>( symbol->slant()*symbol->getHeight()/2 ) +
distX/2);
- setWidth(QMAX(content->getX() + content->getWidth(),
- QMAX(upperWidth, lowerWidth)));
+ setWidth(TQMAX(content->getX() + content->getWidth(),
+ TQMAX(upperWidth, lowerWidth)));
// heights
- //int toMidline = QMAX(content->getHeight() / 2,
- luPixel toMidline = QMAX(content->axis( context, tstyle, factor ),
+ //int toMidline = TQMAX(content->getHeight() / 2,
+ luPixel toMidline = TQMAX(content->axis( context, tstyle, factor ),
upperHeight + symbol->getHeight()/2);
- //int fromMidline = QMAX(content->getHeight() / 2,
- luPixel fromMidline = QMAX(content->getHeight() - content->axis( context, tstyle, factor ),
+ //int fromMidline = TQMAX(content->getHeight() / 2,
+ luPixel fromMidline = TQMAX(content->getHeight() - content->axis( context, tstyle, factor ),
lowerHeight + symbol->getHeight()/2);
setHeight(toMidline + fromMidline);
//setMidline(toMidline);
@@ -299,18 +299,18 @@ void SymbolElement::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 SymbolElement::draw( QPainter& painter, const LuPixelRect& r,
+void SymbolElement::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;
@@ -328,21 +328,21 @@ void SymbolElement::draw( QPainter& painter, const LuPixelRect& r,
// Debug
#if 0
- painter.setBrush(Qt::NoBrush);
- painter.setPen(Qt::red);
-// painter.drawRect( context.layoutUnitToPixelX( myPos.x() ),
-// context.layoutUnitToPixelY( myPos.y() ),
-// context.layoutUnitToPixelX( getWidth() ),
-// context.layoutUnitToPixelY( getHeight() ) );
- painter.drawRect( context.layoutUnitToPixelX( myPos.x()+symbol->getX() ),
- context.layoutUnitToPixelY( myPos.y()+symbol->getY() ),
- context.layoutUnitToPixelX( symbol->getWidth() ),
- context.layoutUnitToPixelY( symbol->getHeight() ) );
- painter.setPen(Qt::green);
- painter.drawLine( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y()+axis(context, tstyle) ),
- context.layoutUnitToPixelX( myPos.x()+getWidth() ),
- context.layoutUnitToPixelY( myPos.y()+axis(context, tstyle) ) );
+ painter.setBrush(TQt::NoBrush);
+ painter.setPen(TQt::red);
+// painter.drawRect( context.tqlayoutUnitToPixelX( myPos.x() ),
+// context.tqlayoutUnitToPixelY( myPos.y() ),
+// context.tqlayoutUnitToPixelX( getWidth() ),
+// context.tqlayoutUnitToPixelY( getHeight() ) );
+ painter.drawRect( context.tqlayoutUnitToPixelX( myPos.x()+symbol->getX() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+symbol->getY() ),
+ context.tqlayoutUnitToPixelX( symbol->getWidth() ),
+ context.tqlayoutUnitToPixelY( symbol->getHeight() ) );
+ painter.setPen(TQt::green);
+ painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+axis(context, tstyle) ),
+ context.tqlayoutUnitToPixelX( myPos.x()+getWidth() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+axis(context, tstyle) ) );
#endif
}
@@ -502,11 +502,11 @@ void SymbolElement::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 SymbolElement::setMainChild(SequenceElement* child)
// {
@@ -518,7 +518,7 @@ void SymbolElement::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
@@ -528,7 +528,7 @@ void SymbolElement::moveDown(FormulaCursor* cursor, BasicElement* from)
* The list will be emptied but stays the property of the caller.
*/
void SymbolElement::insert(FormulaCursor* cursor,
- QPtrList<BasicElement>& newChildren,
+ TQPtrList<BasicElement>& newChildren,
Direction direction)
{
SequenceElement* index = static_cast<SequenceElement*>(newChildren.take(0));
@@ -557,8 +557,8 @@ void SymbolElement::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
@@ -568,7 +568,7 @@ void SymbolElement::insert(FormulaCursor* cursor,
* The ownership of the list is passed to the caller.
*/
void SymbolElement::remove(FormulaCursor* cursor,
- QPtrList<BasicElement>& removedChildren,
+ TQPtrList<BasicElement>& removedChildren,
Direction direction)
{
int pos = cursor->getPos();
@@ -586,9 +586,9 @@ void SymbolElement::remove(FormulaCursor* cursor,
setToLower(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;
}
}
@@ -705,25 +705,25 @@ ElementIndexPtr SymbolElement::getIndex( int position )
/**
* Appends our attributes to the dom element.
*/
-void SymbolElement::writeDom(QDomElement element)
+void SymbolElement::writeDom(TQDomElement element)
{
BasicElement::writeDom(element);
element.setAttribute("TYPE", symbolType);
- QDomDocument doc = element.ownerDocument();
+ TQDomDocument doc = element.ownerDocument();
- QDomElement con = doc.createElement("CONTENT");
+ TQDomElement con = doc.createElement("CONTENT");
con.appendChild(content->getElementDom(doc));
element.appendChild(con);
if(hasLower()) {
- QDomElement ind = doc.createElement("LOWER");
+ TQDomElement ind = doc.createElement("LOWER");
ind.appendChild(lower->getElementDom(doc));
element.appendChild(ind);
}
if(hasUpper()) {
- QDomElement ind = doc.createElement("UPPER");
+ TQDomElement ind = doc.createElement("UPPER");
ind.appendChild(upper->getElementDom(doc));
element.appendChild(ind);
}
@@ -733,13 +733,13 @@ void SymbolElement::writeDom(QDomElement element)
* Reads our attributes from the element.
* Returns false if it failed.
*/
-bool SymbolElement::readAttributesFromDom(QDomElement element)
+bool SymbolElement::readAttributesFromDom(TQDomElement element)
{
if (!BasicElement::readAttributesFromDom(element)) {
return false;
}
- QString typeStr = element.attribute("TYPE");
+ TQString typeStr = element.attribute("TYPE");
if(!typeStr.isNull()) {
symbolType = static_cast<SymbolType>(typeStr.toInt());
}
@@ -752,7 +752,7 @@ bool SymbolElement::readAttributesFromDom(QDomElement element)
* that needs to be read.
* Returns false if it failed.
*/
-bool SymbolElement::readContentFromDom(QDomNode& node)
+bool SymbolElement::readContentFromDom(TQDomNode& node)
{
if (!BasicElement::readContentFromDom(node)) {
return false;
@@ -784,9 +784,9 @@ bool SymbolElement::readContentFromDom(QDomNode& node)
return true;
}
-QString SymbolElement::toLatex()
+TQString SymbolElement::toLatex()
{
- QString sym;
+ TQString sym;
switch(symbolType) {
@@ -826,9 +826,9 @@ QString SymbolElement::toLatex()
return sym;
}
-QString SymbolElement::formulaString()
+TQString SymbolElement::formulaString()
{
- QString sym;
+ TQString sym;
switch ( symbolType ) {
case 1001:
sym="int(";
@@ -852,12 +852,12 @@ QString SymbolElement::formulaString()
return sym + ")";
}
-void SymbolElement::writeMathML( QDomDocument& doc, QDomNode& parent, bool oasisFormat ) const
+void SymbolElement::writeMathML( TQDomDocument& doc, TQDomNode& tqparent, bool oasisFormat ) const
{
- QDomElement de = doc.createElement( oasisFormat ? "math:mrow" : "mrow" );
- QDomElement mo = doc.createElement( oasisFormat ? "math:mo" : "mo" );
+ TQDomElement de = doc.createElement( oasisFormat ? "math:mrow" : "mrow" );
+ TQDomElement mo = doc.createElement( oasisFormat ? "math:mo" : "mo" );
- QString value;
+ TQString value;
switch( symbolType )
{
@@ -871,10 +871,10 @@ void SymbolElement::writeMathML( QDomDocument& doc, QDomNode& parent, bool oasis
case Product:
mo.appendChild( doc.createEntityReference( "prod" ) ); break;
default:
- mo.appendChild( doc.createTextNode( QChar( symbolType ) ) );
+ mo.appendChild( doc.createTextNode( TQChar( symbolType ) ) );
}
- QDomElement between;
+ TQDomElement between;
if ( hasUpper() && hasLower() )
{
between = doc.createElement( oasisFormat ? "math:msubsup" : "msubsup" );
@@ -900,7 +900,7 @@ void SymbolElement::writeMathML( QDomDocument& doc, QDomNode& parent, bool oasis
de.appendChild( between );
content->writeMathML( doc, de, oasisFormat );
- parent.appendChild( de );
+ tqparent.appendChild( de );
}
KFORMULA_NAMESPACE_END