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 /kpresenter/KPrAutoformObject.cpp | |
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 'kpresenter/KPrAutoformObject.cpp')
-rw-r--r-- | kpresenter/KPrAutoformObject.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/kpresenter/KPrAutoformObject.cpp b/kpresenter/KPrAutoformObject.cpp index c5d7028d..774f9f3e 100644 --- a/kpresenter/KPrAutoformObject.cpp +++ b/kpresenter/KPrAutoformObject.cpp @@ -24,13 +24,13 @@ #include "KPrUtils.h" #include "KPrGradient.h" -#include <qbitmap.h> -#include <qpointarray.h> -#include <qptrlist.h> -#include <qregion.h> -#include <qdom.h> -#include <qpainter.h> -#include <qwmatrix.h> +#include <tqbitmap.h> +#include <tqpointarray.h> +#include <tqptrlist.h> +#include <tqregion.h> +#include <tqdom.h> +#include <tqpainter.h> +#include <tqwmatrix.h> #include <kstandarddirs.h> #include <kdebug.h> #include <KoTextZoomHandler.h> @@ -44,10 +44,10 @@ KPrAutoformObject::KPrAutoformObject() { } -KPrAutoformObject::KPrAutoformObject( const KoPen & _pen, const QBrush &_brush, const QString & _filename, +KPrAutoformObject::KPrAutoformObject( const KoPen & _pen, const TQBrush &_brush, const TQString & _filename, LineEnd _lineBegin, LineEnd _lineEnd, - FillType _fillType, const QColor &_gColor1, - const QColor &_gColor2, BCType _gType, + FillType _fillType, const TQColor &_gColor1, + const TQColor &_gColor2, BCType _gType, bool _unbalanced, int _xfactor, int _yfactor) : KPr2DObject( _pen, _brush, _fillType, _gColor1, _gColor2, _gType, _unbalanced, _xfactor, _yfactor ) , KPrStartEndLine( _lineBegin, _lineEnd ) @@ -68,7 +68,7 @@ DCOPObject* KPrAutoformObject::dcopObject() return dcop; } -void KPrAutoformObject::setFileName( const QString & _filename ) +void KPrAutoformObject::setFileName( const TQString & _filename ) { filename = _filename; atfInterp.load( filename ); @@ -78,12 +78,12 @@ void KPrAutoformObject::setFileName( const QString & _filename ) bool KPrAutoformObject::saveOasisObjectAttributes( KPOasisSaveContext &sc ) const { kdDebug(33001) << "bool KPrAutoformObject::saveOasisObjectAttributes()" << endl; - QSize size( int( ext.width() * 100 ), int( ext.height() * 100 ) ); + TQSize size( int( ext.width() * 100 ), int( ext.height() * 100 ) ); - sc.xmlWriter.addAttribute( "svg:viewBox", QString( "0 0 %1 %2" ).arg( size.width() ) - .arg( size.height() ) ); + sc.xmlWriter.addAttribute( "svg:viewBox", TQString( "0 0 %1 %2" ).tqarg( size.width() ) + .tqarg( size.height() ) ); - QPointArray points = const_cast<ATFInterpreter &>( atfInterp ).getPointArray( size.width(), size.height() ); + TQPointArray points = const_cast<ATFInterpreter &>( atfInterp ).getPointArray( size.width(), size.height() ); unsigned int pointCount = points.size(); unsigned int pos = 0; @@ -92,15 +92,15 @@ bool KPrAutoformObject::saveOasisObjectAttributes( KPOasisSaveContext &sc ) cons if ( closed ) --pointCount; - QString d; - d += QString( "M%1 %2" ).arg( points.at(pos).x() ) - .arg( points.at(pos).y() ); + TQString d; + d += TQString( "M%1 %2" ).tqarg( points.at(pos).x() ) + .tqarg( points.at(pos).y() ); ++pos; while ( pos < pointCount ) { - d += QString( "L%1 %2" ).arg( points.at( pos ).x() ) - .arg( points.at( pos ).y() ); + d += TQString( "L%1 %2" ).tqarg( points.at( pos ).x() ) + .tqarg( points.at( pos ).y() ); ++pos; } @@ -117,7 +117,7 @@ void KPrAutoformObject::fillStyle( KoGenStyle& styleObjectAuto, KoGenStyles& mai kdDebug(33001) << "KPr2DObject::fillStyle" << endl; KPrShadowObject::fillStyle( styleObjectAuto, mainStyles ); - QPointArray points = const_cast<ATFInterpreter &>( atfInterp ).getPointArray( int( ext.width() * 100 ), + TQPointArray points = const_cast<ATFInterpreter &>( atfInterp ).getPointArray( int( ext.width() * 100 ), int( ext.height() * 100 ) ); // if it is a closed object save the background @@ -136,34 +136,34 @@ const char * KPrAutoformObject::getOasisElementName() const return "draw:path"; } -QDomDocumentFragment KPrAutoformObject::save( QDomDocument& doc, double offset ) +TQDomDocumentFragment KPrAutoformObject::save( TQDomDocument& doc, double offset ) { - QDomDocumentFragment fragment=KPr2DObject::save(doc, offset); + TQDomDocumentFragment fragment=KPr2DObject::save(doc, offset); KPrStartEndLine::save( fragment, doc ); // The filename contains the absolute path to the autoform. This is // bad, so we simply remove everything but the last dir and the name. // e.g. /my/local/path/to/kpresenter/Arrow/.source/Arrow1.atf -> Arrow/.source/Arrow1.atf - QStringList afDirs = KPrFactory::global()->dirs()->resourceDirs("autoforms"); - QValueList<QString>::ConstIterator it=afDirs.begin(); - QString str; + TQStringList afDirs = KPrFactory::global()->dirs()->resourceDirs("autoforms"); + TQValueList<TQString>::ConstIterator it=afDirs.begin(); + TQString str; for( ; it!=afDirs.end(); ++it) { if(filename.startsWith(*it)) { str=filename.mid((*it).length()); break; } } - QDomElement elem=doc.createElement("FILENAME"); + TQDomElement elem=doc.createElement("FILENAME"); elem.setAttribute("value", str); fragment.appendChild(elem); return fragment; } -double KPrAutoformObject::load(const QDomElement &element) +double KPrAutoformObject::load(const TQDomElement &element) { double offset=KPr2DObject::load(element); KPrStartEndLine::load( element ); - QDomElement e=element.namedItem("FILENAME").toElement(); + TQDomElement e=element.namedItem("FILENAME").toElement(); if(!e.isNull()) { if(e.hasAttribute("value")) filename=e.attribute("value"); @@ -174,15 +174,15 @@ double KPrAutoformObject::load(const QDomElement &element) if(filename[0]=='/') { kdDebug(33001) << "rubbish ahead! cleaning up..." << endl; // remove the leading absolute path (i.e. to create Arrow/Arrow1.atf) - filename=filename.mid(filename.findRev('/', filename.findRev('/')-1)+1); + filename=filename.mid(filename.tqfindRev('/', filename.tqfindRev('/')-1)+1); } // okay... we changed the file format again and now the autoforms // are stored in .../kpresenter/autoforms/.source/foo.atf (note: we didn't have .source // before. Therefore we have to add this dir if it's not already there to make it // work with old files - if(filename.find(".source")==-1) { + if(filename.tqfind(".source")==-1) { // okay, old file -- add the .source dir - filename=filename.insert(filename.find('/'), "/.source"); + filename=filename.insert(filename.tqfind('/'), "/.source"); } filename = locate("autoforms", filename, KPrFactory::global()); atfInterp.load( filename ); @@ -190,28 +190,28 @@ double KPrAutoformObject::load(const QDomElement &element) return offset; } -void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandler, +void KPrAutoformObject::paint( TQPainter* _painter, KoTextZoomHandler *_zoomHandler, int /* pageNum */, bool drawingShadow, bool drawContour ) { unsigned int pw = 0, pwOrig = 0, px, py; - QPen pen2; - QSize size( _zoomHandler->zoomSize( ext ) ); + TQPen pen2; + TQSize size( _zoomHandler->zoomSize( ext ) ); if ( drawContour ) - pen2 = QPen( Qt::black, 1, Qt::DotLine ); + pen2 = TQPen( TQt::black, 1, TQt::DotLine ); else { pen2 = pen.zoomedPen( _zoomHandler ); } _painter->setPen( pen2 ); - pwOrig = ( pen2.style() == Qt::NoPen ) ? 1 : pen2.width(); + pwOrig = ( pen2.style() == TQt::NoPen ) ? 1 : pen2.width(); if ( !drawContour ) _painter->setBrush( getBrush() ); - QPointArray pntArray = atfInterp.getPointArray( _zoomHandler->zoomItX( ext.width()), + TQPointArray pntArray = atfInterp.getPointArray( _zoomHandler->zoomItX( ext.width()), _zoomHandler->zoomItY( ext.height() ) ); - QPtrList<ATFInterpreter::AttribList> atrLs = atfInterp.getAttribList(); - QPointArray pntArray2( pntArray.size() ); + TQPtrList<ATFInterpreter::AttribList> atrLs = atfInterp.getAttribList(); + TQPointArray pntArray2( pntArray.size() ); int ex = _zoomHandler->zoomItX(ext.width()); int ey = _zoomHandler->zoomItY(ext.height()); for ( unsigned int i = 0; i < pntArray.size(); i++ ) @@ -237,19 +237,19 @@ void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandl { if ( angle == 0 || angle==360 ) { - //int ox = _painter->viewport().x() + static_cast<int>( _painter->worldMatrix().dx() ); - //int oy = _painter->viewport().y() + static_cast<int>( _painter->worldMatrix().dy() ); + //int ox = _painter->viewport().x() + static_cast<int>( _painter->tqworldMatrix().dx() ); + //int oy = _painter->viewport().y() + static_cast<int>( _painter->tqworldMatrix().dy() ); - QPointArray pntArray3 = pntArray2.copy(); + TQPointArray pntArray3 = pntArray2.copy(); _painter->save(); - QRegion clipregion( pntArray3 ); + TQRegion clipregion( pntArray3 ); // Intersect with current clipregion (whereas setupClipRegion unites) if ( _painter->hasClipping() ) - clipregion = _painter->clipRegion(QPainter::CoordPainter).intersect( clipregion ); + clipregion = _painter->clipRegion(TQPainter::CoordPainter).intersect( clipregion ); - _painter->setClipRegion( clipregion, QPainter::CoordPainter ); + _painter->setClipRegion( clipregion, TQPainter::CoordPainter ); gradient->setSize( size ); _painter->drawPixmap( 0, 0, gradient->pixmap() ); @@ -263,14 +263,14 @@ void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandl kdDebug(33001) << "KPrAutoformObject::draw redrawPix" << endl; gradient->setSize( size ); m_redrawGradientPix = false; - QRegion clipregion( pntArray2 ); + TQRegion clipregion( pntArray2 ); m_gradientPix.resize ( _zoomHandler->zoomItX(ext.width()),_zoomHandler->zoomItY(ext.height()) ); - m_gradientPix.fill( Qt::white ); + m_gradientPix.fill( TQt::white ); - QPainter p; + TQPainter p; p.begin( &m_gradientPix ); - p.setClipRegion( clipregion , QPainter::CoordPainter); + p.setClipRegion( clipregion , TQPainter::CoordPainter); p.drawPixmap( 0, 0, gradient->pixmap() ); p.end(); @@ -281,7 +281,7 @@ void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandl } _painter->setPen( pen2 ); - _painter->setBrush( Qt::NoBrush ); + _painter->setBrush( TQt::NoBrush ); _painter->drawPolygon( pntArray2 ); } } @@ -300,8 +300,8 @@ void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandl { if ( lineBegin != L_NORMAL && !drawContour ) { - QPoint pnt1( pntArray2.at( 0 ) ), pnt2( pntArray2.at( 1 ) ); - QPoint pnt3, pnt4( pntArray.at( 0 ) ); + TQPoint pnt1( pntArray2.at( 0 ) ), pnt2( pntArray2.at( 1 ) ); + TQPoint pnt3, pnt4( pntArray.at( 0 ) ); float _angle = KoPoint::getAngle( KoPoint( pnt1 ), KoPoint( pnt2 ) ); switch ( static_cast<int>( _angle ) ) @@ -336,8 +336,8 @@ void KPrAutoformObject::paint( QPainter* _painter, KoTextZoomHandler *_zoomHandl if ( lineEnd != L_NORMAL && !drawContour ) { - QPoint pnt1( pntArray2.at( pntArray2.size() - 1 ) ), pnt2( pntArray2.at( pntArray2.size() - 2 ) ); - QPoint pnt3, pnt4( pntArray.at( pntArray.size() - 1 ) ); + TQPoint pnt1( pntArray2.at( pntArray2.size() - 1 ) ), pnt2( pntArray2.at( pntArray2.size() - 2 ) ); + TQPoint pnt3, pnt4( pntArray.at( pntArray.size() - 1 ) ); float _angle = KoPoint::getAngle( KoPoint( pnt1 ), KoPoint( pnt2 ) ); switch ( ( int )_angle ) |