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/vgradient.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/vgradient.cc')
-rw-r--r-- | karbon/core/vgradient.cc | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/karbon/core/vgradient.cc b/karbon/core/vgradient.cc index cd3b55b6..11d6239f 100644 --- a/karbon/core/vgradient.cc +++ b/karbon/core/vgradient.cc @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qdom.h> -#include <qbuffer.h> +#include <tqdom.h> +#include <tqbuffer.h> #include "vdocument.h" #include "vglobal.h" @@ -28,7 +28,7 @@ #include <KoXmlWriter.h> #include <KoXmlNS.h> -int VGradient::VColorStopList::compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) +int VGradient::VColorStopList::compareItems( TQPtrCollection::Item item1, TQPtrCollection::Item item2 ) { float r1 = ( (VColorStop*)item1 )->rampPoint; float r2 = ( (VColorStop*)item2 )->rampPoint; @@ -66,7 +66,7 @@ VGradient::VGradient( const VGradient& gradient ) m_repeatMethod = gradient.m_repeatMethod; m_colorStops.clear(); - QPtrVector<VColorStop> cs = gradient.colorStops(); + TQPtrVector<VColorStop> cs = gradient.colorStops(); for( uint i = 0; i < cs.count(); i++ ) m_colorStops.append( new VColorStop( *cs[i] ) ); m_colorStops.sort(); @@ -86,7 +86,7 @@ VGradient& VGradient::operator=( const VGradient& gradient ) m_repeatMethod = gradient.m_repeatMethod; m_colorStops.clear(); - QPtrVector<VColorStop> cs = gradient.colorStops(); + TQPtrVector<VColorStop> cs = gradient.colorStops(); for( uint i = 0; i < cs.count(); i++ ) m_colorStops.append( new VColorStop( *cs[i] ) ); m_colorStops.sort(); @@ -94,9 +94,9 @@ VGradient& VGradient::operator=( const VGradient& gradient ) return *this; } // VGradient::operator= -const QPtrVector<VColorStop> VGradient::colorStops() const +const TQPtrVector<VColorStop> VGradient::colorStops() const { - QPtrVector<VColorStop> v; + TQPtrVector<VColorStop> v; m_colorStops.toVector( &v ); v.setAutoDelete( false ); return v; @@ -140,9 +140,9 @@ void VGradient::removeStop( const VColorStop& colorstop ) } // VGradient::removeStop void -VGradient::save( QDomElement& element ) const +VGradient::save( TQDomElement& element ) const { - QDomElement me = element.ownerDocument().createElement( "GRADIENT" ); + TQDomElement me = element.ownerDocument().createElement( "GRADIENT" ); me.setAttribute( "originX", m_origin.x() ); me.setAttribute( "originY", m_origin.y() ); @@ -155,10 +155,10 @@ VGradient::save( QDomElement& element ) const // save stops VColorStop* colorstop; - QPtrList<VColorStop>& colorStops = const_cast<VColorStopList&>( m_colorStops ); + TQPtrList<VColorStop>& colorStops = const_cast<VColorStopList&>( m_colorStops ); for( colorstop = colorStops.first(); colorstop; colorstop = colorStops.next() ) { - QDomElement stop = element.ownerDocument().createElement( "COLORSTOP" ); + TQDomElement stop = element.ownerDocument().createElement( "COLORSTOP" ); colorstop->color.save( stop ); stop.setAttribute( "ramppoint", colorstop->rampPoint ); stop.setAttribute( "midpoint", colorstop->midPoint ); @@ -168,7 +168,7 @@ VGradient::save( QDomElement& element ) const element.appendChild( me ); } -QString +TQString VGradient::saveOasis( KoGenStyles &mainStyles ) const { bool radial = m_type == VGradient::radial; @@ -198,50 +198,50 @@ VGradient::saveOasis( KoGenStyles &mainStyles ) const gradientStyle.addAttribute( "svg:spreadMethod", "reflect" ); else gradientStyle.addAttribute( "svg:spreadMethod", "pad" ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level // save stops VColorStop* colorstop; - QPtrList<VColorStop>& colorStops = const_cast<VColorStopList&>( m_colorStops ); + TQPtrList<VColorStop>& colorStops = const_cast<VColorStopList&>( m_colorStops ); for( colorstop = colorStops.first(); colorstop; colorstop = colorStops.next() ) { elementWriter.startElement( "svg:stop" ); - elementWriter.addAttribute( "svg:offset", QString( "%1" ).arg( colorstop->rampPoint ) ); - elementWriter.addAttribute( "svg:color", QColor( colorstop->color ).name() ); + elementWriter.addAttribute( "svg:offset", TQString( "%1" ).tqarg( colorstop->rampPoint ) ); + elementWriter.addAttribute( "svg:color", TQColor( colorstop->color ).name() ); if( colorstop->color.opacity() < 1 ) - elementWriter.addAttribute( "svg:stop-opacity", QString( "%1" ).arg( colorstop->color.opacity() ) ); + elementWriter.addAttribute( "svg:stop-opacity", TQString( "%1" ).tqarg( colorstop->color.opacity() ) ); elementWriter.endElement(); } - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); gradientStyle.addChildElement( "svg:stop", elementContents ); return mainStyles.lookup( gradientStyle, "gradient" ); } void -VGradient::loadOasis( const QDomElement &object, KoStyleStack &/*stack*/, VObject* parent ) +VGradient::loadOasis( const TQDomElement &object, KoStyleStack &/*stack*/, VObject* tqparent ) { kdDebug(38000) << "namespaceURI: " << object.namespaceURI() << endl; kdDebug(38000) << "localName: " << object.localName() << endl; KoRect bb; - if( parent ) - bb = parent->boundingBox(); + if( tqparent ) + bb = tqparent->boundingBox(); if( object.namespaceURI() == KoXmlNS::draw && object.localName() == "gradient" ) { m_repeatMethod = VGradient::reflect; - QString strType = object.attributeNS( KoXmlNS::draw, "style", QString::null ); + TQString strType = object.attributeNS( KoXmlNS::draw, "style", TQString() ); if( strType == "radial" ) { m_type = VGradient::radial; // TODO : find out whether Oasis works with boundingBox only? - double cx = KoUnit::parseValue( object.attributeNS( KoXmlNS::draw, "cx", QString::null ).remove("%") ); + double cx = KoUnit::parseValue( object.attributeNS( KoXmlNS::draw, "cx", TQString() ).remove("%") ); m_origin.setX( bb.bottomLeft().x() + bb.width() * 0.01 * cx ); - double cy = KoUnit::parseValue( object.attributeNS( KoXmlNS::draw, "cy", QString::null ).remove("%") ); + double cy = KoUnit::parseValue( object.attributeNS( KoXmlNS::draw, "cy", TQString() ).remove("%") ); m_origin.setY( bb.bottomLeft().y() - bb.height() * 0.01 * cy ); m_focalPoint = m_origin; m_vector = bb.topRight(); @@ -261,8 +261,8 @@ VGradient::loadOasis( const QDomElement &object, KoStyleStack &/*stack*/, VObjec } else return; - VColor startColor( QColor( object.attributeNS( KoXmlNS::draw, "start-color", QString::null ) ) ); - VColor endColor( QColor( object.attributeNS( KoXmlNS::draw, "end-color", QString::null ) ) ); + VColor startColor( TQColor( object.attributeNS( KoXmlNS::draw, "start-color", TQString() ) ) ); + VColor endColor( TQColor( object.attributeNS( KoXmlNS::draw, "end-color", TQString() ) ) ); double startOpacity = 0.01 * object.attributeNS( KoXmlNS::draw, "start-intensity", "100" ).remove("%").toDouble(); double endOpacity = 0.01 * object.attributeNS( KoXmlNS::draw, "end-intensity", "100" ).remove("%").toDouble(); @@ -280,25 +280,25 @@ VGradient::loadOasis( const QDomElement &object, KoStyleStack &/*stack*/, VObjec if( object.localName() == "linearGradient" ) { m_type = VGradient::linear; - m_origin.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "x1", QString::null ) ) ); - m_origin.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "y1", QString::null ) ) ); - m_vector.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "x2", QString::null ) ) ); - m_vector.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "y2", QString::null ) ) ); + m_origin.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "x1", TQString() ) ) ); + m_origin.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "y1", TQString() ) ) ); + m_vector.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "x2", TQString() ) ) ); + m_vector.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "y2", TQString() ) ) ); m_focalPoint = m_origin; } else if( object.localName() == "radialGradient" ) { m_type = VGradient::radial; - m_origin.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "cx", QString::null ) ) ); - m_origin.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "cy", QString::null ) ) ); - double r = KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "r", QString::null ) ); + m_origin.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "cx", TQString() ) ) ); + m_origin.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "cy", TQString() ) ) ); + double r = KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "r", TQString() ) ); m_vector.setX( m_origin.x() + r ); m_vector.setY( m_origin.y() ); - m_focalPoint.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "fx", QString::null ) ) ); - m_focalPoint.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "fy", QString::null ) ) ); + m_focalPoint.setX( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "fx", TQString() ) ) ); + m_focalPoint.setY( KoUnit::parseValue( object.attributeNS( KoXmlNS::svg, "fy", TQString() ) ) ); } - QString strSpread( object.attributeNS( KoXmlNS::svg, "spreadMethod", "pad" ) ); + TQString strSpread( object.attributeNS( KoXmlNS::svg, "spreadMethod", "pad" ) ); if( strSpread == "repeat" ) m_repeatMethod = VGradient::repeat; else if( strSpread == "reflect" ) @@ -309,16 +309,16 @@ VGradient::loadOasis( const QDomElement &object, KoStyleStack &/*stack*/, VObjec m_colorStops.clear(); // load stops - QDomNodeList list = object.childNodes(); + TQDomNodeList list = object.childNodes(); for( uint i = 0; i < list.count(); ++i ) { if( list.item( i ).isElement() ) { - QDomElement colorstop = list.item( i ).toElement(); + TQDomElement colorstop = list.item( i ).toElement(); if( colorstop.namespaceURI() == KoXmlNS::svg && colorstop.localName() == "stop" ) { - VColor color( QColor( colorstop.attributeNS( KoXmlNS::svg, "color", QString::null ) ) ); + VColor color( TQColor( colorstop.attributeNS( KoXmlNS::svg, "color", TQString() ) ) ); color.setOpacity( colorstop.attributeNS( KoXmlNS::svg, "stop-opacity", "1.0" ).toDouble() ); addStop( color, colorstop.attributeNS( KoXmlNS::svg, "offset", "0.0" ).toDouble(), 0.5 ); } @@ -329,7 +329,7 @@ VGradient::loadOasis( const QDomElement &object, KoStyleStack &/*stack*/, VObjec } void -VGradient::load( const QDomElement& element ) +VGradient::load( const TQDomElement& element ) { m_origin.setX( element.attribute( "originX", "0.0" ).toDouble() ); m_origin.setY( element.attribute( "originY", "0.0" ).toDouble() ); @@ -343,12 +343,12 @@ VGradient::load( const QDomElement& element ) m_colorStops.clear(); // load stops - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for( uint i = 0; i < list.count(); ++i ) { if( list.item( i ).isElement() ) { - QDomElement colorstop = list.item( i ).toElement(); + TQDomElement colorstop = list.item( i ).toElement(); if( colorstop.tagName() == "COLORSTOP" ) { @@ -362,7 +362,7 @@ VGradient::load( const QDomElement& element ) } void -VGradient::transform( const QWMatrix &m ) +VGradient::transform( const TQWMatrix &m ) { m_origin = m_origin.transform( m ); m_focalPoint = m_focalPoint.transform( m ); |