summaryrefslogtreecommitdiffstats
path: root/lib/kformula/tokenstyleelement.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/tokenstyleelement.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/tokenstyleelement.cc')
-rw-r--r--lib/kformula/tokenstyleelement.cc70
1 files changed, 35 insertions, 35 deletions
diff --git a/lib/kformula/tokenstyleelement.cc b/lib/kformula/tokenstyleelement.cc
index d205f70d..43731425 100644
--- a/lib/kformula/tokenstyleelement.cc
+++ b/lib/kformula/tokenstyleelement.cc
@@ -17,14 +17,14 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include "basicelement.h"
#include "tokenstyleelement.h"
KFORMULA_NAMESPACE_BEGIN
-TokenStyleElement::TokenStyleElement( BasicElement* parent ) : SequenceElement( parent ),
+TokenStyleElement::TokenStyleElement( BasicElement* tqparent ) : SequenceElement( tqparent ),
m_mathSizeType ( NoSize ),
m_charStyle( anyChar ),
m_charFamily( anyFamily ),
@@ -54,36 +54,36 @@ void TokenStyleElement::calcSizes( const ContextStyle& context,
resetStyle( style );
}
-void TokenStyleElement::draw( QPainter& painter, const LuPixelRect& r,
+void TokenStyleElement::draw( TQPainter& painter, const LuPixelRect& r,
const ContextStyle& context,
ContextStyle::TextStyle tstyle,
ContextStyle::IndexStyle istyle,
StyleAttributes& style,
- const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& tqparentOrigin )
{
setStyleSize( context, style );
setStyleVariant( style );
setStyleColor( style );
setStyleBackground( style );
- if ( style.background() != Qt::color0 ) {
- painter.fillRect( context.layoutUnitToPixelX( parentOrigin.x() + getX() ),
- context.layoutUnitToPixelY( parentOrigin.y() + getY() ),
- context.layoutUnitToPixelX( getWidth() ),
- context.layoutUnitToPixelY( getHeight() ),
+ if ( style.background() != TQt::color0 ) {
+ painter.fillRect( context.tqlayoutUnitToPixelX( tqparentOrigin.x() + getX() ),
+ context.tqlayoutUnitToPixelY( tqparentOrigin.y() + getY() ),
+ context.tqlayoutUnitToPixelX( getWidth() ),
+ context.tqlayoutUnitToPixelY( getHeight() ),
style.background() );
}
- inherited::draw( painter, r, context, tstyle, istyle, style, parentOrigin );
+ inherited::draw( painter, r, context, tstyle, istyle, style, tqparentOrigin );
resetStyle( style );
}
-bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element )
+bool TokenStyleElement::readAttributesFromMathMLDom( const TQDomElement& element )
{
if ( !BasicElement::readAttributesFromMathMLDom( element ) ) {
return false;
}
// MathML Section 3.2.2
- QString variantStr = element.attribute( "mathvariant" );
+ TQString variantStr = element.attribute( "mathvariant" );
if ( !variantStr.isNull() ) {
if ( variantStr == "normal" ) {
setCharStyle( normalChar );
@@ -143,7 +143,7 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
}
}
- QString sizeStr = element.attribute( "mathsize" );
+ TQString sizeStr = element.attribute( "mathsize" );
if ( !sizeStr.isNull() ) {
if ( sizeStr == "small" ) {
setRelativeSize( 0.8 ); // ### Arbitrary size
@@ -172,22 +172,22 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
}
}
- QString colorStr = element.attribute( "mathcolor" );
+ TQString colorStr = element.attribute( "mathcolor" );
if ( !colorStr.isNull() ) {
if ( colorStr[0] != '#' ) {
- setMathColor( QColor( getHtmlColor( colorStr ) ) );
+ setMathColor( TQColor( getHtmlColor( colorStr ) ) );
}
else {
- setMathColor( QColor( colorStr ) );
+ setMathColor( TQColor( colorStr ) );
}
}
- QString backgroundStr = element.attribute( "mathbackground" );
+ TQString backgroundStr = element.attribute( "mathbackground" );
if ( !backgroundStr.isNull() ) {
if ( backgroundStr[0] != '#' ) {
- setMathBackground( QColor( getHtmlColor( backgroundStr ) ) );
+ setMathBackground( TQColor( getHtmlColor( backgroundStr ) ) );
}
else {
- setMathBackground( QColor( backgroundStr ) );
+ setMathBackground( TQColor( backgroundStr ) );
}
}
@@ -222,7 +222,7 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
}
}
- QString styleStr = element.attribute( "fontstyle" );
+ TQString styleStr = element.attribute( "fontstyle" );
if ( ! styleStr.isNull() ) {
if ( styleStr.lower() == "italic" ) {
setFontStyle( true );
@@ -232,7 +232,7 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
}
}
- QString weightStr = element.attribute( "fontweight" );
+ TQString weightStr = element.attribute( "fontweight" );
if ( ! weightStr.isNull() ) {
if ( weightStr.lower() == "bold" ) {
setFontWeight( true );
@@ -242,7 +242,7 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
}
}
- QString familyStr = element.attribute( "fontfamily" );
+ TQString familyStr = element.attribute( "fontfamily" );
if ( ! familyStr.isNull() ) {
setFontFamily( familyStr );
}
@@ -250,17 +250,17 @@ bool TokenStyleElement::readAttributesFromMathMLDom( const QDomElement& element
colorStr = element.attribute( "color" );
if ( ! colorStr.isNull() ) {
if ( colorStr[0] != '#' ) {
- setColor( QColor( getHtmlColor( colorStr ) ) );
+ setColor( TQColor( getHtmlColor( colorStr ) ) );
}
else {
- setColor( QColor( colorStr ) );
+ setColor( TQColor( colorStr ) );
}
}
return true;
}
-void TokenStyleElement::writeMathMLAttributes( QDomElement& element ) const
+void TokenStyleElement::writeMathMLAttributes( TQDomElement& element ) const
{
// mathvariant attribute
if ( customMathVariant() ) {
@@ -344,13 +344,13 @@ void TokenStyleElement::writeMathMLAttributes( QDomElement& element ) const
// mathsize attribute
switch ( m_mathSizeType ) {
case AbsoluteSize:
- element.setAttribute( "mathsize", QString( "%1pt" ).arg( m_mathSize ) );
+ element.setAttribute( "mathsize", TQString( "%1pt" ).tqarg( m_mathSize ) );
break;
case RelativeSize:
- element.setAttribute( "mathsize", QString( "%1%" ).arg( m_mathSize * 100.0 ) );
+ element.setAttribute( "mathsize", TQString( "%1%" ).tqarg( m_mathSize * 100.0 ) );
break;
case PixelSize:
- element.setAttribute( "mathsize", QString( "%1px" ).arg( m_mathSize ) );
+ element.setAttribute( "mathsize", TQString( "%1px" ).tqarg( m_mathSize ) );
break;
default:
break;
@@ -370,13 +370,13 @@ void TokenStyleElement::writeMathMLAttributes( QDomElement& element ) const
// fontsize attribute
switch ( m_fontSizeType ) {
case AbsoluteSize:
- element.setAttribute( "fontsize", QString( "%1pt" ).arg( m_fontSize ) );
+ element.setAttribute( "fontsize", TQString( "%1pt" ).tqarg( m_fontSize ) );
break;
case RelativeSize:
- element.setAttribute( "fontsize", QString( "%1%" ).arg( m_fontSize * 100.0 ) );
+ element.setAttribute( "fontsize", TQString( "%1%" ).tqarg( m_fontSize * 100.0 ) );
break;
case PixelSize:
- element.setAttribute( "fontsize", QString( "%3px" ).arg( m_fontSize ) );
+ element.setAttribute( "fontsize", TQString( "%3px" ).tqarg( m_fontSize ) );
break;
default:
break;
@@ -467,7 +467,7 @@ void TokenStyleElement::setStyleVariant( StyleAttributes& style )
style.setCustomMathVariant( false );
if ( customFontFamily() ) {
style.setCustomFont( true );
- style.setFont( QFont(fontFamily()) );
+ style.setFont( TQFont(fontFamily()) );
}
bool fontweight = false;
@@ -550,7 +550,7 @@ void TokenStyleElement::resetStyle( StyleAttributes& style )
double TokenStyleElement::sizeFactor( const ContextStyle& context, double factor )
{
- double basesize = context.layoutUnitPtToPt( context.getBaseSize() );
+ double basesize = context.tqlayoutUnitPtToPt( context.getBaseSize() );
switch ( m_mathSizeType ) {
case AbsoluteSize:
return m_mathSize / basesize;
@@ -580,9 +580,9 @@ double TokenStyleElement::sizeFactor( const ContextStyle& context, double factor
/**
* Return RGB string from HTML Colors. See HTML Spec, section 6.5
*/
-QString TokenStyleElement::getHtmlColor( const QString& colorStr ){
+TQString TokenStyleElement::getHtmlColor( const TQString& colorStr ){
- QString colorname = colorStr.lower();
+ TQString colorname = colorStr.lower();
if ( colorname == "black" )
return "#000000";