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 /karbon/core/vcomposite.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 'karbon/core/vcomposite.cc')
-rw-r--r-- | karbon/core/vcomposite.cc | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/karbon/core/vcomposite.cc b/karbon/core/vcomposite.cc index 8cd61311..d8eaf027 100644 --- a/karbon/core/vcomposite.cc +++ b/karbon/core/vcomposite.cc @@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -#include <qdom.h> -#include <qpainter.h> -#include <qwmatrix.h> -#include <qregexp.h> +#include <tqdom.h> +#include <tqpainter.h> +#include <tqwmatrix.h> +#include <tqregexp.h> #include <KoPoint.h> #include <KoRect.h> @@ -44,8 +44,8 @@ #include <kdebug.h> -VPath::VPath( VObject* parent, VState state ) - : VObject( parent, state ), m_fillRule( winding ) +VPath::VPath( VObject* tqparent, VState state ) + : VObject( tqparent, state ), m_fillRule( winding ) { m_paths.setAutoDelete( true ); @@ -124,9 +124,9 @@ VPath::draw( VPainter* painter, const KoRect *rect ) const if( !itr.current()->isEmpty() ) { painter->newPath(); - painter->setRasterOp( Qt::XorROP ); - painter->setPen( Qt::yellow ); - painter->setBrush( Qt::NoBrush ); + painter->setRasterOp( TQt::XorROP ); + painter->setPen( TQt::yellow ); + painter->setBrush( TQt::NoBrush ); VSubpathIterator jtr( *( itr.current() ) ); for( ; jtr.current(); ++jtr ) @@ -156,14 +156,14 @@ VPath::draw( VPainter* painter, const KoRect *rect ) const } } - painter->setRasterOp( Qt::CopyROP ); - painter->setPen( Qt::NoPen ); + painter->setRasterOp( TQt::CopyROP ); + painter->setPen( TQt::NoPen ); painter->setBrush( *fill() ); painter->fillPath(); // draw stroke: painter->setPen( *stroke() ); - painter->setBrush( Qt::NoBrush ); + painter->setBrush( TQt::NoBrush ); painter->strokePath(); } @@ -264,7 +264,7 @@ bool VPath::pointIsInside( const KoPoint& p ) const { // Check if point is inside boundingbox. - if( !boundingBox().contains( p ) ) + if( !boundingBox().tqcontains( p ) ) return false; @@ -340,16 +340,16 @@ VPath::clone() const } void -VPath::save( QDomElement& element ) const +VPath::save( TQDomElement& element ) const { if( state() != deleted ) { - QDomElement me = element.ownerDocument().createElement( "PATH" ); + TQDomElement me = element.ownerDocument().createElement( "PATH" ); element.appendChild( me ); VObject::save( me ); - QString d; + TQString d; saveSvgPath( d ); me.setAttribute( "d", d ); @@ -368,7 +368,7 @@ VPath::saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyle { docWriter->startElement( "draw:path" ); - QString d; + TQString d; saveSvgPath( d ); docWriter->addAttribute( "svg:d", d ); @@ -377,7 +377,7 @@ VPath::saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyle double w = boundingBox().width(); double h = boundingBox().height(); - docWriter->addAttribute( "svg:viewBox", QString( "%1 %2 %3 %4" ).arg( x ).arg( y ).arg( w ).arg( h ) ); + docWriter->addAttribute( "svg:viewBox", TQString( "%1 %2 %3 %4" ).tqarg( x ).tqarg( y ).tqarg( w ).tqarg( h ) ); docWriter->addAttributePt( "svg:x", x ); docWriter->addAttributePt( "svg:y", y ); docWriter->addAttributePt( "svg:width", w ); @@ -385,11 +385,11 @@ VPath::saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyle VObject::saveOasis( store, docWriter, mainStyles, index ); - QWMatrix tmpMat; + TQWMatrix tmpMat; tmpMat.scale( 1, -1 ); tmpMat.translate( 0, -document()->height() ); - QString transform = buildOasisTransform( tmpMat ); + TQString transform = buildOasisTransform( tmpMat ); if( !transform.isEmpty() ) docWriter->addAttribute( "draw:transform", transform ); @@ -402,7 +402,7 @@ VPath::saveOasisFill( KoGenStyles &mainStyles, KoGenStyle &stylesobjectauto ) co { if( m_fill ) { - QWMatrix mat; + TQWMatrix mat; mat.scale( 1, -1 ); mat.translate( 0, -document()->height() ); @@ -417,19 +417,19 @@ VPath::saveOasisFill( KoGenStyles &mainStyles, KoGenStyle &stylesobjectauto ) co } void -VPath::transformByViewbox( const QDomElement &element, QString viewbox ) +VPath::transformByViewbox( const TQDomElement &element, TQString viewbox ) { if( ! viewbox.isEmpty() ) { // allow for viewbox def with ',' or whitespace - QStringList points = QStringList::split( ' ', viewbox.replace( ',', ' ' ).simplifyWhiteSpace() ); + TQStringList points = TQStringList::split( ' ', viewbox.tqreplace( ',', ' ' ).simplifyWhiteSpace() ); - double w = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "width", QString::null ) ); - double h = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "height", QString::null ) ); - double x = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "x", QString::null ) ); - double y = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "y", QString::null ) ); + double w = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "width", TQString() ) ); + double h = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "height", TQString() ) ); + double x = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "x", TQString() ) ); + double y = KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "y", TQString() ) ); - QWMatrix mat; + TQWMatrix mat; mat.translate( x-KoUnit::parseValue( points[0] ), y-KoUnit::parseValue( points[1] ) ); mat.scale( w / KoUnit::parseValue( points[2] ) , h / KoUnit::parseValue( points[3] ) ); VTransformCmd cmd( 0L, mat ); @@ -438,42 +438,42 @@ VPath::transformByViewbox( const QDomElement &element, QString viewbox ) } bool -VPath::loadOasis( const QDomElement &element, KoOasisLoadingContext &context ) +VPath::loadOasis( const TQDomElement &element, KoOasisLoadingContext &context ) { setState( normal ); - QString viewbox; + TQString viewbox; if( element.localName() == "path" ) { - QString data = element.attributeNS( KoXmlNS::svg, "d", QString::null ); + TQString data = element.attributeNS( KoXmlNS::svg, "d", TQString() ); if( data.length() > 0 ) { loadSvgPath( data ); } - m_fillRule = element.attributeNS( KoXmlNS::svg, "fill-rule", QString::null ) == "winding" ? winding : evenOdd; + m_fillRule = element.attributeNS( KoXmlNS::svg, "fill-rule", TQString() ) == "winding" ? winding : evenOdd; - viewbox = element.attributeNS( KoXmlNS::svg, "viewBox", QString::null ); + viewbox = element.attributeNS( KoXmlNS::svg, "viewBox", TQString() ); } - else if( element.localName() == "custom-shape" ) + else if( element.localName() == "custom-tqshape" ) { - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for( uint i = 0; i < list.count(); ++i ) { if( list.item( i ).isElement() ) { - QDomElement e = list.item( i ).toElement(); + TQDomElement e = list.item( i ).toElement(); if( e.namespaceURI() != KoXmlNS::draw ) continue; - if( e.localName() == "enhanced-geometry" ) + if( e.localName() == "enhanced-tqgeometry" ) { - QString data = e.attributeNS( KoXmlNS::draw, "enhanced-path", QString::null ); + TQString data = e.attributeNS( KoXmlNS::draw, "enhanced-path", TQString() ); if( ! data.isEmpty() ) loadSvgPath( data ); - viewbox = e.attributeNS( KoXmlNS::svg, "viewBox", QString::null ); + viewbox = e.attributeNS( KoXmlNS::svg, "viewBox", TQString() ); } } } @@ -481,7 +481,7 @@ VPath::loadOasis( const QDomElement &element, KoOasisLoadingContext &context ) transformByViewbox( element, viewbox ); - QString trafo = element.attributeNS( KoXmlNS::draw, "transform", QString::null ); + TQString trafo = element.attributeNS( KoXmlNS::draw, "transform", TQString() ); if( !trafo.isEmpty() ) transformOasis( trafo ); @@ -489,24 +489,24 @@ VPath::loadOasis( const QDomElement &element, KoOasisLoadingContext &context ) } void -VPath::load( const QDomElement& element ) +VPath::load( const TQDomElement& element ) { setState( normal ); VObject::load( element ); - QString data = element.attribute( "d" ); + TQString data = element.attribute( "d" ); if( data.length() > 0 ) { loadSvgPath( data ); } m_fillRule = element.attribute( "fillRule" ) == 0 ? evenOdd : winding; - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for( uint i = 0; i < list.count(); ++i ) { if( list.item( i ).isElement() ) { - QDomElement child = list.item( i ).toElement(); + TQDomElement child = list.item( i ).toElement(); if( child.tagName() == "PATH" ) { @@ -522,21 +522,21 @@ VPath::load( const QDomElement& element ) } } - QString trafo = element.attribute( "transform" ); + TQString trafo = element.attribute( "transform" ); if( !trafo.isEmpty() ) transform( trafo ); } void -VPath::loadSvgPath( const QString &d ) +VPath::loadSvgPath( const TQString &d ) { - //QTime s;s.start(); + //TQTime s;s.start(); parseSVG( d, true ); //kdDebug(38000) << "Parsing time : " << s.elapsed() << endl; } void -VPath::saveSvgPath( QString &d ) const +VPath::saveSvgPath( TQString &d ) const { // save paths to svg: VSubpathListIterator itr( m_paths ); @@ -578,36 +578,36 @@ VPath::accept( VVisitor& visitor ) } void -VPath::transform( const QString &transform ) +VPath::transform( const TQString &transform ) { VTransformCmd cmd( 0L, parseTransform( transform ) ); cmd.visitVPath( *this ); } void -VPath::transformOasis( const QString &transform ) +VPath::transformOasis( const TQString &transform ) { VTransformCmd cmd( 0L, parseOasisTransform( transform ) ); cmd.visitVPath( *this ); } -QWMatrix -VPath::parseTransform( const QString &transform ) +TQWMatrix +VPath::parseTransform( const TQString &transform ) { - QWMatrix result; + TQWMatrix result; // Split string for handling 1 transform statement at a time - QStringList subtransforms = QStringList::split(')', transform); - QStringList::ConstIterator it = subtransforms.begin(); - QStringList::ConstIterator end = subtransforms.end(); + TQStringList subtransforms = TQStringList::split(')', transform); + TQStringList::ConstIterator it = subtransforms.begin(); + TQStringList::ConstIterator end = subtransforms.end(); for(; it != end; ++it) { - QStringList subtransform = QStringList::split('(', (*it)); + TQStringList subtransform = TQStringList::split('(', (*it)); subtransform[0] = subtransform[0].stripWhiteSpace().lower(); subtransform[1] = subtransform[1].simplifyWhiteSpace(); - QRegExp reg("[,( ]"); - QStringList params = QStringList::split(reg, subtransform[1]); + TQRegExp reg("[,( ]"); + TQStringList params = TQStringList::split(reg, subtransform[1]); if(subtransform[0].startsWith(";") || subtransform[0].startsWith(",")) subtransform[0] = subtransform[0].right(subtransform[0].length() - 1); @@ -656,23 +656,23 @@ VPath::parseTransform( const QString &transform ) return result; } -QWMatrix -VPath::parseOasisTransform( const QString &transform ) +TQWMatrix +VPath::parseOasisTransform( const TQString &transform ) { - QWMatrix result; + TQWMatrix result; // Split string for handling 1 transform statement at a time - QStringList subtransforms = QStringList::split(')', transform); - QStringList::ConstIterator it = subtransforms.begin(); - QStringList::ConstIterator end = subtransforms.end(); + TQStringList subtransforms = TQStringList::split(')', transform); + TQStringList::ConstIterator it = subtransforms.begin(); + TQStringList::ConstIterator end = subtransforms.end(); for(; it != end; ++it) { - QStringList subtransform = QStringList::split('(', (*it)); + TQStringList subtransform = TQStringList::split('(', (*it)); subtransform[0] = subtransform[0].stripWhiteSpace().lower(); subtransform[1] = subtransform[1].simplifyWhiteSpace(); - QRegExp reg("[,( ]"); - QStringList params = QStringList::split(reg, subtransform[1]); + TQRegExp reg("[,( ]"); + TQStringList params = TQStringList::split(reg, subtransform[1]); if(subtransform[0].startsWith(";") || subtransform[0].startsWith(",")) subtransform[0] = subtransform[0].right(subtransform[0].length() - 1); @@ -730,46 +730,46 @@ VPath::parseOasisTransform( const QString &transform ) return result; } -QString +TQString VPath::buildSvgTransform() const { return buildSvgTransform( m_matrix ); } -QString -VPath::buildSvgTransform( const QWMatrix &mat ) const +TQString +VPath::buildSvgTransform( const TQWMatrix &mat ) const { - QString transform; + TQString transform; if( !mat.isIdentity() ) { - transform = QString( "matrix(%1, %2, %3, %4, %5, %6)" ).arg( mat.m11() ) - .arg( mat.m12() ) - .arg( mat.m21() ) - .arg( mat.m22() ) - .arg( mat.dx() ) - .arg( mat.dy() ); + transform = TQString( "matrix(%1, %2, %3, %4, %5, %6)" ).tqarg( mat.m11() ) + .tqarg( mat.m12() ) + .tqarg( mat.m21() ) + .tqarg( mat.m22() ) + .tqarg( mat.dx() ) + .tqarg( mat.dy() ); } return transform; } -QString +TQString VPath::buildOasisTransform() const { return buildSvgTransform( m_matrix ); } -QString -VPath::buildOasisTransform( const QWMatrix &mat ) const +TQString +VPath::buildOasisTransform( const TQWMatrix &mat ) const { - QString transform; + TQString transform; if( !mat.isIdentity() ) { - transform = QString( "matrix(%1, %2, %3, %4, %5pt, %6pt)" ).arg( mat.m11() ) - .arg( mat.m12() ) - .arg( mat.m21() ) - .arg( mat.m22() ) - .arg( mat.dx() ) - .arg( mat.dy() ); + transform = TQString( "matrix(%1, %2, %3, %4, %5pt, %6pt)" ).tqarg( mat.m11() ) + .tqarg( mat.m12() ) + .tqarg( mat.m21() ) + .tqarg( mat.m22() ) + .tqarg( mat.dx() ) + .tqarg( mat.dy() ); } return transform; } |