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/spaceelement.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/spaceelement.cc')
-rw-r--r-- | lib/kformula/spaceelement.cc | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/lib/kformula/spaceelement.cc b/lib/kformula/spaceelement.cc index 1ff62da7..7bc21d24 100644 --- a/lib/kformula/spaceelement.cc +++ b/lib/kformula/spaceelement.cc @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qfontmetrics.h> -#include <qpainter.h> +#include <tqfontmetrics.h> +#include <tqpainter.h> #include <kdebug.h> #include <kprinter.h> @@ -33,8 +33,8 @@ KFORMULA_NAMESPACE_BEGIN -SpaceElement::SpaceElement( SpaceWidth space, bool tab, BasicElement* parent ) - : BasicElement( parent ), +SpaceElement::SpaceElement( SpaceWidth space, bool tab, BasicElement* tqparent ) + : BasicElement( tqparent ), m_tab( tab ), m_widthType( NoSize ), m_heightType( NoSize ), @@ -55,7 +55,7 @@ SpaceElement::SpaceElement( SpaceWidth space, bool tab, BasicElement* parent ) case THICK: m_widthType = ThickMathSpace; break; - case QUAD: + case TQUAD: m_widthType = VeryVeryThickMathSpace; break; } @@ -88,35 +88,35 @@ void SpaceElement::calcSizes( const ContextStyle& context, { double factor = style.sizeFactor(); luPt mySize = context.getAdjustedSize( tstyle, factor ); - QFont font = context.getDefaultFont(); + TQFont font = context.getDefaultFont(); font.setPointSize( mySize ); - QFontMetrics fm( font ); - QChar w = 'M'; + TQFontMetrics fm( font ); + TQChar w = 'M'; LuPixelRect hbound = fm.boundingRect( w ); - QChar h = 'x'; + TQChar h = 'x'; LuPixelRect vbound = fm.boundingRect( h ); double width = style.getSpace( m_widthType, m_width ); if ( m_widthType == AbsoluteSize ) { - width = m_width / context.layoutUnitPtToPt( context.getBaseSize() ); + width = m_width / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } else if ( m_widthType == PixelSize ) { - width = context.pixelYToPt( m_width ) / context.layoutUnitPtToPt( context.getBaseSize() ); + width = context.pixelYToPt( m_width ) / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } double height = style.getSpace( m_heightType, m_height ); if ( m_heightType == AbsoluteSize ) { - height = m_height / context.layoutUnitPtToPt( context.getBaseSize() ); + height = m_height / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } else if ( m_heightType == PixelSize ) { - height = context.pixelYToPt( m_height ) / context.layoutUnitPtToPt( context.getBaseSize() ); + height = context.pixelYToPt( m_height ) / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } double depth = style.getSpace( m_depthType, m_depth ); if ( m_depthType == AbsoluteSize ) { - depth = m_depth / context.layoutUnitPtToPt( context.getBaseSize() ); + depth = m_depth / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } else if ( m_depthType == PixelSize ) { - depth = context.pixelYToPt( m_depth ) / context.layoutUnitPtToPt( context.getBaseSize() ); + depth = context.pixelYToPt( m_depth ) / context.tqlayoutUnitPtToPt( context.getBaseSize() ); } setWidth( hbound.width() * width ); @@ -128,37 +128,37 @@ void SpaceElement::calcSizes( const ContextStyle& context, } } -void SpaceElement::draw( QPainter& painter, const LuPixelRect& /*r*/, +void SpaceElement::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 is such a thing as negative space! //if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) ) // return; if ( context.edit() ) { painter.setPen( context.getEmptyColor() ); - painter.drawLine( context.layoutUnitToPixelX( myPos.x() ), - context.layoutUnitToPixelY( myPos.y()+getHeight() ), - context.layoutUnitToPixelX( myPos.x()+getWidth()-1 ), - context.layoutUnitToPixelY( myPos.y()+getHeight() ) ); - painter.drawLine( context.layoutUnitToPixelX( myPos.x() ), - context.layoutUnitToPixelY( myPos.y()+getHeight() ), - context.layoutUnitToPixelX( myPos.x() ), - context.layoutUnitToPixelY( myPos.y()+getHeight()-getHeight()/5 ) ); - painter.drawLine( context.layoutUnitToPixelX( myPos.x()+getWidth()-1 ), - context.layoutUnitToPixelY( myPos.y()+getHeight() ), - context.layoutUnitToPixelX( myPos.x()+getWidth()-1 ), - context.layoutUnitToPixelY( myPos.y()+getHeight()-getHeight()/5 ) ); + painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x() ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight() ), + context.tqlayoutUnitToPixelX( myPos.x()+getWidth()-1 ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight() ) ); + painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x() ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight() ), + context.tqlayoutUnitToPixelX( myPos.x() ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight()-getHeight()/5 ) ); + painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x()+getWidth()-1 ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight() ), + context.tqlayoutUnitToPixelX( myPos.x()+getWidth()-1 ), + context.tqlayoutUnitToPixelY( myPos.y()+getHeight()-getHeight()/5 ) ); } } -void SpaceElement::writeDom(QDomElement element) +void SpaceElement::writeDom(TQDomElement element) { BasicElement::writeDom(element); switch ( m_widthType ) { @@ -203,12 +203,12 @@ void SpaceElement::writeDom(QDomElement element) } } -bool SpaceElement::readAttributesFromDom( QDomElement element ) +bool SpaceElement::readAttributesFromDom( TQDomElement element ) { if ( !BasicElement::readAttributesFromDom( element ) ) { return false; } - QString widthStr = element.attribute( "WIDTH" ); + TQString widthStr = element.attribute( "WIDTH" ); if( !widthStr.isNull() ) { if ( widthStr.lower() == "quad" ) { m_widthType = VeryVeryThickMathSpace; @@ -229,38 +229,38 @@ bool SpaceElement::readAttributesFromDom( QDomElement element ) else { return false; } - QString tabStr = element.attribute( "TAB" ); + TQString tabStr = element.attribute( "TAB" ); m_tab = !tabStr.isNull(); return true; } -bool SpaceElement::readContentFromDom(QDomNode& node) +bool SpaceElement::readContentFromDom(TQDomNode& node) { return BasicElement::readContentFromDom( node ); } -bool SpaceElement::readAttributesFromMathMLDom(const QDomElement& element) +bool SpaceElement::readAttributesFromMathMLDom(const TQDomElement& element) { if ( ! BasicElement::readAttributesFromMathMLDom( element ) ) { return false; } - QString widthStr = element.attribute( "width" ).stripWhiteSpace().lower(); + TQString widthStr = element.attribute( "width" ).stripWhiteSpace().lower(); if ( ! widthStr.isNull() ) { m_width = getSize( widthStr, &m_widthType ); if ( m_widthType == NoSize ) { m_widthType = getSpace( widthStr ); } } - QString heightStr = element.attribute( "height" ).stripWhiteSpace().lower(); + TQString heightStr = element.attribute( "height" ).stripWhiteSpace().lower(); if ( ! heightStr.isNull() ) { m_height = getSize( heightStr, &m_heightType ); } - QString depthStr = element.attribute( "depth" ).stripWhiteSpace().lower(); + TQString depthStr = element.attribute( "depth" ).stripWhiteSpace().lower(); if ( ! depthStr.isNull() ) { m_depth = getSize( depthStr, &m_depthType ); } - QString linebreakStr = element.attribute( "linebreak" ).stripWhiteSpace().lower(); + TQString linebreakStr = element.attribute( "linebreak" ).stripWhiteSpace().lower(); if ( ! linebreakStr.isNull() ) { if ( linebreakStr == "auto" ) { m_lineBreak = AutoBreak; @@ -284,17 +284,17 @@ bool SpaceElement::readAttributesFromMathMLDom(const QDomElement& element) return true; } -void SpaceElement::writeMathMLAttributes( QDomElement& element ) const +void SpaceElement::writeMathMLAttributes( TQDomElement& element ) const { switch ( m_widthType ) { case AbsoluteSize: - element.setAttribute( "width", QString( "%1pt" ).arg( m_width ) ); + element.setAttribute( "width", TQString( "%1pt" ).tqarg( m_width ) ); break; case RelativeSize: - element.setAttribute( "width", QString( "%1%" ).arg( m_width * 100.0 ) ); + element.setAttribute( "width", TQString( "%1%" ).tqarg( m_width * 100.0 ) ); break; case PixelSize: - element.setAttribute( "width", QString( "%1px" ).arg( m_width ) ); + element.setAttribute( "width", TQString( "%1px" ).tqarg( m_width ) ); break; case NegativeVeryVeryThinMathSpace: element.setAttribute( "width", "negativeveryverythinmathspace" ); @@ -343,26 +343,26 @@ void SpaceElement::writeMathMLAttributes( QDomElement& element ) const } switch ( m_heightType ) { case AbsoluteSize: - element.setAttribute( "height", QString( "%1pt" ).arg( m_height ) ); + element.setAttribute( "height", TQString( "%1pt" ).tqarg( m_height ) ); break; case RelativeSize: - element.setAttribute( "height", QString( "%1%" ).arg( m_height * 100.0 ) ); + element.setAttribute( "height", TQString( "%1%" ).tqarg( m_height * 100.0 ) ); break; case PixelSize: - element.setAttribute( "height", QString( "%1px" ).arg( m_height ) ); + element.setAttribute( "height", TQString( "%1px" ).tqarg( m_height ) ); break; default: break; } switch ( m_depthType ) { case AbsoluteSize: - element.setAttribute( "depth", QString( "%1pt" ).arg( m_depth ) ); + element.setAttribute( "depth", TQString( "%1pt" ).tqarg( m_depth ) ); break; case RelativeSize: - element.setAttribute( "depth", QString( "%1%" ).arg( m_depth * 100.0 ) ); + element.setAttribute( "depth", TQString( "%1%" ).tqarg( m_depth * 100.0 ) ); break; case PixelSize: - element.setAttribute( "depth", QString( "%1px" ).arg( m_depth ) ); + element.setAttribute( "depth", TQString( "%1px" ).tqarg( m_depth ) ); break; default: break; @@ -391,7 +391,7 @@ void SpaceElement::writeMathMLAttributes( QDomElement& element ) const } } -QString SpaceElement::toLatex() +TQString SpaceElement::toLatex() { switch ( m_widthType ) { case NegativeVeryVeryThinMathSpace: |