summaryrefslogtreecommitdiffstats
path: root/lib/kformula/textelement.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kformula/textelement.cc')
-rw-r--r--lib/kformula/textelement.cc174
1 files changed, 87 insertions, 87 deletions
diff --git a/lib/kformula/textelement.cc b/lib/kformula/textelement.cc
index 7526acb64..24eae2d80 100644
--- a/lib/kformula/textelement.cc
+++ b/lib/kformula/textelement.cc
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qfontmetrics.h>
-#include <qpainter.h>
+#include <tqfontmetrics.h>
+#include <tqpainter.h>
#include <kdebug.h>
@@ -37,8 +37,8 @@
KFORMULA_NAMESPACE_BEGIN
-TextElement::TextElement(QChar ch, bool beSymbol, BasicElement* parent)
- : BasicElement(parent), character(ch), symbol(beSymbol)
+TextElement::TextElement(TQChar ch, bool beSymbol, BasicElement* tqparent)
+ : BasicElement(tqparent), character(ch), symbol(beSymbol)
{
charStyle( anyChar );
charFamily( anyFamily );
@@ -66,7 +66,7 @@ TokenType TextElement::getTokenType() const
return getSymbolTable().charClass( character );
}
- switch ( character.unicode() ) {
+ switch ( character.tqunicode() ) {
case '+':
case '-':
case '*':
@@ -106,7 +106,7 @@ bool TextElement::isInvisible() const
/**
* Calculates our width and height and
- * our children's parentPosition.
+ * our tqchildren's tqparentPosition.
*/
void TextElement::calcSizes( const ContextStyle& context,
ContextStyle::TextStyle tstyle,
@@ -119,27 +119,27 @@ void TextElement::calcSizes( const ContextStyle& context,
setCharStyle( style.charStyle() );
setCharFamily( style.charFamily() );
- QFont font = getFont( context, style );
- double fontsize = context.layoutUnitPtToPt( mySize );
+ TQFont font = getFont( context, style );
+ double fontsize = context.tqlayoutUnitPtToPt( mySize );
double scriptsize = pow( style.scriptSizeMultiplier(), style.scriptLevel() );
double size = fontsize * scriptsize;
font.setPointSizeFloat( size < style.scriptMinSize() ? style.scriptMinSize() : size );
- QFontMetrics fm( font );
+ TQFontMetrics fm( font );
if ( character == applyFunctionChar || character == invisibleTimes || character == invisibleComma ) {
setWidth( 0 );
setHeight( 0 );
setBaseline( getHeight() );
}
else {
- QChar ch = getRealCharacter(context);
- if ( ch == QChar::null ) {
- setWidth( qRound( context.getEmptyRectWidth( factor ) * 2./3. ) );
- setHeight( qRound( context.getEmptyRectHeight( factor ) * 2./3. ) );
+ TQChar ch = getRealCharacter(context);
+ if ( ch == TQChar::null ) {
+ setWidth( tqRound( context.getEmptyRectWidth( factor ) * 2./3. ) );
+ setHeight( tqRound( context.getEmptyRectHeight( factor ) * 2./3. ) );
setBaseline( getHeight() );
}
else {
- QRect bound = fm.boundingRect( ch );
+ TQRect bound = fm.boundingRect( ch );
setWidth( context.ptToLayoutUnitPt( fm.width( ch ) ) );
setHeight( context.ptToLayoutUnitPt( bound.height() ) );
setBaseline( context.ptToLayoutUnitPt( -bound.top() ) );
@@ -155,22 +155,22 @@ void TextElement::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 TextElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
+void TextElement::draw( TQPainter& painter, const LuPixelRect& /*r*/,
const ContextStyle& context,
ContextStyle::TextStyle tstyle,
ContextStyle::IndexStyle /*istyle*/,
StyleAttributes& style,
- const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& tqparentOrigin )
{
if ( character == applyFunctionChar || character == invisibleTimes || character == invisibleComma ) {
return;
}
- 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;
@@ -183,8 +183,8 @@ void TextElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
double factor = style.sizeFactor();
luPt mySize = context.getAdjustedSize( tstyle, factor );
- QFont font = getFont( context, style );
- double fontsize = context.layoutUnitPtToPt( mySize );
+ TQFont font = getFont( context, style );
+ double fontsize = context.tqlayoutUnitPtToPt( mySize );
double scriptsize = pow( style.scriptSizeMultiplier(), style.scriptLevel() );
double size = fontsize * scriptsize;
font.setPointSizeFloat( size < style.scriptMinSize() ? style.scriptMinSize() : size );
@@ -192,7 +192,7 @@ void TextElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
//kdDebug( DEBUGID ) << "TextElement::draw font=" << font.rawName() << endl;
//kdDebug( DEBUGID ) << "TextElement::draw size=" << mySize << endl;
- //kdDebug( DEBUGID ) << "TextElement::draw size=" << context.layoutUnitToFontSize( mySize, false ) << endl;
+ //kdDebug( DEBUGID ) << "TextElement::draw size=" << context.tqlayoutUnitToFontSize( mySize, false ) << endl;
//kdDebug( DEBUGID ) << "TextElement::draw height: " << getHeight() << endl;
//kdDebug( DEBUGID ) << "TextElement::draw width: " << getWidth() << endl;
//kdDebug( DEBUGID ) << endl;
@@ -201,23 +201,23 @@ void TextElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
/*
ElementType* token = getElementType();
if ( ( token != 0 ) && !symbol ) {
- QString text = token->text( static_cast<SequenceElement*>( getParent() ) );
-// kdDebug() << "draw text: " << text[0].unicode()
+ TQString text = token->text( static_cast<SequenceElement*>( getParent() ) );
+// kdDebug() << "draw text: " << text[0].tqunicode()
// << " " << painter.font().family().latin1()
// << endl;
- painter.fillRect( context.layoutUnitToPixelX( parentOrigin.x() ),
- context.layoutUnitToPixelY( parentOrigin.y() ),
- context.layoutUnitToPixelX( getParent()->getWidth() ),
- context.layoutUnitToPixelY( getParent()->getHeight() ),
+ painter.fillRect( context.tqlayoutUnitToPixelX( tqparentOrigin.x() ),
+ context.tqlayoutUnitToPixelY( tqparentOrigin.y() ),
+ context.tqlayoutUnitToPixelX( getParent()->getWidth() ),
+ context.tqlayoutUnitToPixelY( getParent()->getHeight() ),
style.background() );
- painter.drawText( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y()+getBaseline() ),
+ painter.drawText( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+getBaseline() ),
text );
}
else {
*/
- QChar ch = getRealCharacter(context);
- if ( ch != QChar::null ) {
+ TQChar ch = getRealCharacter(context);
+ if ( ch != TQChar::null ) {
luPixel bl = getBaseline();
if ( bl == -1 ) {
// That's quite hacky and actually not the way it's
@@ -226,29 +226,29 @@ void TextElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
// baseline==0 glyphs without yet another flag.
bl = -( getHeight()/2 + context.axisHeight( tstyle, factor ) );
}
- painter.drawText( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y()+bl ),
- ch );
+ painter.drawText( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+bl ),
+ TQString(ch) );
}
else {
- painter.setPen( QPen( context.getErrorColor(),
- context.layoutUnitToPixelX( context.getLineWidth( factor ) ) ) );
- painter.drawRect( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y() ),
- context.layoutUnitToPixelX( getWidth() ),
- context.layoutUnitToPixelY( getHeight() ) );
+ painter.setPen( TQPen( context.getErrorColor(),
+ context.tqlayoutUnitToPixelX( context.getLineWidth( factor ) ) ) );
+ painter.drawRect( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y() ),
+ context.tqlayoutUnitToPixelX( getWidth() ),
+ context.tqlayoutUnitToPixelY( getHeight() ) );
}
// }
// Debug
- //painter.setBrush(Qt::NoBrush);
+ //painter.setBrush(TQt::NoBrush);
// if ( isSymbol() ) {
-// painter.setPen( Qt::red );
-// painter.drawRect( context.layoutUnitToPixelX( myPos.x() ),
-// context.layoutUnitToPixelX( myPos.y() ),
-// context.layoutUnitToPixelX( getWidth() ),
-// context.layoutUnitToPixelX( getHeight() ) );
-// painter.setPen(Qt::green);
+// painter.setPen( TQt::red );
+// painter.drawRect( context.tqlayoutUnitToPixelX( myPos.x() ),
+// context.tqlayoutUnitToPixelX( myPos.y() ),
+// context.tqlayoutUnitToPixelX( getWidth() ),
+// context.tqlayoutUnitToPixelX( getHeight() ) );
+// painter.setPen(TQt::green);
// painter.drawLine(myPos.x(), myPos.y()+axis( context, tstyle ),
// myPos.x()+getWidth(), myPos.y()+axis( context, tstyle ));
// }
@@ -272,7 +272,7 @@ void TextElement::setCharFamily( CharFamily cf )
formula()->changed();
}
-QChar TextElement::getRealCharacter(const ContextStyle& context)
+TQChar TextElement::getRealCharacter(const ContextStyle& context)
{
return character;
/*
@@ -296,10 +296,10 @@ QChar TextElement::getRealCharacter(const ContextStyle& context)
}
-QFont TextElement::getFont(const ContextStyle& context, const StyleAttributes& style)
+TQFont TextElement::getFont(const ContextStyle& context, const StyleAttributes& style)
{
const FontStyle& fontStyle = context.fontStyle();
- QFont font;
+ TQFont font;
if ( style.customFont() ) {
font = style.font();
}
@@ -335,13 +335,13 @@ QFont TextElement::getFont(const ContextStyle& context, const StyleAttributes& s
}
-void TextElement::setUpPainter(const ContextStyle& context, QPainter& painter)
+void TextElement::setUpPainter(const ContextStyle& context, TQPainter& painter)
{
if (getElementType() != 0) {
getElementType()->setUpPainter(context, painter);
}
else {
- painter.setPen(Qt::red);
+ painter.setPen(TQt::red);
}
}
@@ -351,19 +351,19 @@ const SymbolTable& TextElement::getSymbolTable() const
}
-void TextElement::writeMathML( QDomDocument& doc, QDomNode& parent, bool ) const
+void TextElement::writeMathML( TQDomDocument& doc, TQDomNode& tqparent, bool ) const
{
- parent.appendChild( doc.createTextNode( getCharacter() ) );
+ tqparent.appendChild( doc.createTextNode( getCharacter() ) );
}
/**
* Appends our attributes to the dom element.
*/
-void TextElement::writeDom(QDomElement element)
+void TextElement::writeDom(TQDomElement element)
{
BasicElement::writeDom(element);
- element.setAttribute("CHAR", QString(character));
- //QString s;
+ element.setAttribute("CHAR", TQString(character));
+ //TQString s;
//element.setAttribute("CHAR", s.sprintf( "#x%05X", character ) );
if (symbol) element.setAttribute("SYMBOL", "3");
@@ -388,23 +388,23 @@ void TextElement::writeDom(QDomElement element)
* Reads our attributes from the element.
* Returns false if it failed.
*/
-bool TextElement::readAttributesFromDom(QDomElement element)
+bool TextElement::readAttributesFromDom(TQDomElement element)
{
if (!BasicElement::readAttributesFromDom(element)) {
return false;
}
- QString charStr = element.attribute("CHAR");
+ TQString charStr = element.attribute("CHAR");
if(!charStr.isNull()) {
character = charStr.at(0);
}
- QString symbolStr = element.attribute("SYMBOL");
+ TQString symbolStr = element.attribute("SYMBOL");
if(!symbolStr.isNull()) {
int symbolInt = symbolStr.toInt();
if ( symbolInt == 1 ) {
- character = getSymbolTable().unicodeFromSymbolFont(character);
+ character = getSymbolTable().tqunicodeFromSymbolFont(character);
}
if ( symbolInt == 2 ) {
- switch ( character.unicode() ) {
+ switch ( character.tqunicode() ) {
case 0x03D5: character = 0x03C6; break;
case 0x03C6: character = 0x03D5; break;
case 0x03Ba: character = 0x03BA; break;
@@ -423,7 +423,7 @@ bool TextElement::readAttributesFromDom(QDomElement element)
symbol = symbolInt != 0;
}
- QString styleStr = element.attribute("STYLE");
+ TQString styleStr = element.attribute("STYLE");
if ( styleStr == "normal" ) {
charStyle( normalChar );
}
@@ -440,7 +440,7 @@ bool TextElement::readAttributesFromDom(QDomElement element)
charStyle( anyChar );
}
- QString familyStr = element.attribute( "FAMILY" );
+ TQString familyStr = element.attribute( "FAMILY" );
if ( familyStr == "normal" ) {
charFamily( normalFamily );
}
@@ -469,28 +469,28 @@ bool TextElement::readAttributesFromDom(QDomElement element)
* that needs to be read.
* Returns false if it failed.
*/
-bool TextElement::readContentFromDom(QDomNode& node)
+bool TextElement::readContentFromDom(TQDomNode& node)
{
return BasicElement::readContentFromDom(node);
}
-QString TextElement::toLatex()
+TQString TextElement::toLatex()
{
if ( isSymbol() ) {
- QString texName = getSymbolTable().name( character );
+ TQString texName = getSymbolTable().name( character );
if ( !texName.isNull() )
return " \\" + texName + " ";
return " ? ";
}
else {
- return QString(character);
+ return TQString(character);
}
}
-QString TextElement::formulaString()
+TQString TextElement::formulaString()
{
if ( isSymbol() ) {
- QString texName = getSymbolTable().name( character );
+ TQString texName = getSymbolTable().name( character );
if ( !texName.isNull() )
return " " + texName + " ";
return " ? ";
@@ -501,8 +501,8 @@ QString TextElement::formulaString()
}
-EmptyElement::EmptyElement( BasicElement* parent )
- : BasicElement( parent )
+EmptyElement::EmptyElement( BasicElement* tqparent )
+ : BasicElement( tqparent )
{
}
@@ -526,25 +526,25 @@ void EmptyElement::calcSizes( const ContextStyle& context,
luPt mySize = context.getAdjustedSize( tstyle, style.sizeFactor() );
//kdDebug( DEBUGID ) << "TextElement::calcSizes size=" << mySize << endl;
- QFont font = context.getDefaultFont();
- font.setPointSizeFloat( context.layoutUnitPtToPt( mySize ) );
+ TQFont font = context.getDefaultFont();
+ font.setPointSizeFloat( context.tqlayoutUnitPtToPt( mySize ) );
- QFontMetrics fm( font );
- QChar ch = 'A';
- QRect bound = fm.boundingRect( ch );
+ TQFontMetrics fm( font );
+ TQChar ch = 'A';
+ TQRect bound = fm.boundingRect( ch );
setWidth( 0 );
setHeight( context.ptToLayoutUnitPt( bound.height() ) );
setBaseline( context.ptToLayoutUnitPt( -bound.top() ) );
}
-void EmptyElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
+void EmptyElement::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;
@@ -552,14 +552,14 @@ void EmptyElement::draw( QPainter& painter, const LuPixelRect& /*r*/,
if ( context.edit() ) {
painter.setPen( context.getHelpColor() );
- painter.drawLine( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y() ),
- context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y()+getHeight() ) );
+ painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y() ),
+ context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y()+getHeight() ) );
}
}
-QString EmptyElement::toLatex()
+TQString EmptyElement::toLatex()
{
return "{}";
}