From f008adb5a77e094eaf6abf3fc0f36958e66896a5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 25 Jun 2011 05:28:35 +0000 Subject: 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 --- filters/karbon/xcf/xcfexport.cc | 244 ++++++++++++++++++++-------------------- filters/karbon/xcf/xcfexport.h | 9 +- 2 files changed, 127 insertions(+), 126 deletions(-) (limited to 'filters/karbon/xcf') diff --git a/filters/karbon/xcf/xcfexport.cc b/filters/karbon/xcf/xcfexport.cc index fde8bbd5..d5a0c71b 100644 --- a/filters/karbon/xcf/xcfexport.cc +++ b/filters/karbon/xcf/xcfexport.cc @@ -17,12 +17,12 @@ * Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -45,15 +45,15 @@ typedef KGenericFactory XcfExportFactory; K_EXPORT_COMPONENT_FACTORY( libkarbonxcfexport, XcfExportFactory( "kofficefilters" ) ) -XcfExport::XcfExport( KoFilter*, const char*, const QStringList& ) +XcfExport::XcfExport( KoFilter*, const char*, const TQStringList& ) : KoFilter() { m_zoomX = 1.0; m_zoomY = 1.0; } -KoFilter::ConversionStatus -XcfExport::convert( const QCString& from, const QCString& to ) +KoFilter::ConversiontqStatus +XcfExport::convert( const TQCString& from, const TQCString& to ) { if( to != "image/x-xcf-gimp" || from != "application/x-karbon" ) { @@ -67,17 +67,17 @@ XcfExport::convert( const QCString& from, const QCString& to ) return KoFilter::StupidError; - QFile fileOut( m_chain->outputFile() ); + TQFile fileOut( m_chain->outputFile() ); if( !fileOut.open( IO_WriteOnly ) ) return KoFilter::StupidError; - QDomDocument domIn; + TQDomDocument domIn; domIn.setContent( storeIn ); - QDomElement docNode = domIn.documentElement(); + TQDomElement docNode = domIn.documentElement(); - m_stream = new QDataStream( &fileOut ); + m_stream = new TQDataStream( &fileOut ); // Load the document. @@ -98,9 +98,9 @@ void XcfExport::visitVDocument( VDocument& document ) { // Offsets. - QIODevice::Offset current = 0; - QIODevice::Offset start = 0; - QIODevice::Offset end = 0; + TQIODevice::Offset current = 0; + TQIODevice::Offset start = 0; + TQIODevice::Offset end = 0; // Save width and height for layer saving. m_width = static_cast( document.width() * m_zoomX ); @@ -111,27 +111,27 @@ XcfExport::visitVDocument( VDocument& document ) m_stream->writeRawBytes( "gimp xcf file", 14 ); // Image width. - *m_stream << static_cast( m_width ); + *m_stream << static_cast( m_width ); // Image height. - *m_stream << static_cast( m_height ); + *m_stream << static_cast( m_height ); // Image type = RGB. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Do not save any properties currently. *m_stream // "END". - << static_cast( 0 ) + << static_cast( 0 ) // Property size in bytes. - << static_cast( 0 ); + << static_cast( 0 ); // Save current offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Leave space for layer and channel offsets. - m_stream->device()->at( + m_stream->tqdevice()->at( // current position + (number layers + number channels + 2) * 4. current + ( document.layers().count() + 3 + 2 ) * 4 ); @@ -142,7 +142,7 @@ XcfExport::visitVDocument( VDocument& document ) for( ; itr.current(); ++itr ) { // Save start offset. - start = m_stream->device()->at(); + start = m_stream->tqdevice()->at(); // Write layer. @@ -150,142 +150,142 @@ XcfExport::visitVDocument( VDocument& document ) // Save end offset. - end = m_stream->device()->at(); + end = m_stream->tqdevice()->at(); // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Save layer offset. *m_stream << start; // Increment offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Return to end offset. - m_stream->device()->at( end ); + m_stream->tqdevice()->at( end ); } // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Append a zero offset to indicate end of layer offsets. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Return to end offset. - m_stream->device()->at( end ); + m_stream->tqdevice()->at( end ); // Append a zero offset to indicate end of channel offsets. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); } void XcfExport::visitVLayer( VLayer& layer ) { // Layer width = image width. - *m_stream << static_cast( m_width ); + *m_stream << static_cast( m_width ); // Layer height = image height. - *m_stream << static_cast( m_height ); + *m_stream << static_cast( m_height ); // Layer type = RGBA. - *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); // Layer name. *m_stream << layer.name().latin1(); // Layer opacity. - *m_stream << static_cast( 6 ); + *m_stream << static_cast( 6 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // Fully opaque = 255. - *m_stream << static_cast( 255 ); + *m_stream << static_cast( 255 ); // Layer visible? - *m_stream << static_cast( 8 ); + *m_stream << static_cast( 8 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // True. - *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); // Layer linked? - *m_stream << static_cast( 9 ); + *m_stream << static_cast( 9 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Preserve transparency? - *m_stream << static_cast( 10 ); + *m_stream << static_cast( 10 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); - // Apply mask? - *m_stream << static_cast( 11 ); + // Apply tqmask? + *m_stream << static_cast( 11 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); - // Edit mask? - *m_stream << static_cast( 12 ); + // Edit tqmask? + *m_stream << static_cast( 12 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); - // Show mask? - *m_stream << static_cast( 13 ); + // Show tqmask? + *m_stream << static_cast( 13 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Layer offsets. - *m_stream << static_cast( 15 ); + *m_stream << static_cast( 15 ); // Property size in bytes. - *m_stream << static_cast( 8 ); + *m_stream << static_cast( 8 ); // X-Offset. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Y-Offset. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Layer mode. - *m_stream << static_cast( 7 ); + *m_stream << static_cast( 7 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // Normal mode. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // TODO: Tattoo. - *m_stream << static_cast( 20 ); + *m_stream << static_cast( 20 ); // Property size in bytes. - *m_stream << static_cast( 4 ); + *m_stream << static_cast( 4 ); // False. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Layer properties end. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Property size in bytes. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); // Offsets. - QIODevice::Offset current = 0; - QIODevice::Offset start = 0; - QIODevice::Offset end = 0; + TQIODevice::Offset current = 0; + TQIODevice::Offset start = 0; + TQIODevice::Offset end = 0; // Save current offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Leave space for hierarchy offsets. - m_stream->device()->at( current + 8 ); + m_stream->tqdevice()->at( current + 8 ); // Save start offset. - start = m_stream->device()->at(); + start = m_stream->tqdevice()->at(); // Write hierarchy. @@ -293,26 +293,26 @@ XcfExport::visitVLayer( VLayer& layer ) // Save end offset. - end = m_stream->device()->at(); + end = m_stream->tqdevice()->at(); // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Save hierarchy offset. *m_stream << start; - // Append a zero offset to indicate end of layer mask offsets. - *m_stream << static_cast( 0 ); + // Append a zero offset to indicate end of layer tqmask offsets. + *m_stream << static_cast( 0 ); } void XcfExport::writeHierarchy() { // Offsets. - QIODevice::Offset current = 0; - QIODevice::Offset start = 0; - QIODevice::Offset end = 0; + TQIODevice::Offset current = 0; + TQIODevice::Offset start = 0; + TQIODevice::Offset end = 0; // Width (again?). *m_stream << m_width; @@ -321,27 +321,27 @@ XcfExport::writeHierarchy() *m_stream << m_height; // Color depth. - *m_stream << static_cast( 3 ); + *m_stream << static_cast( 3 ); // Calculate level number. int levX = levels( m_width, m_tileWidth ); int levY = levels( m_height, m_tileHeight ); - int levels = QMAX( levX, levY ); + int levels = TQMAX( levX, levY ); int width = m_width; int height = m_height; // Save current offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Leave space for level offsets. - m_stream->device()->at( current + ( levels + 1 ) * 4 ); + m_stream->tqdevice()->at( current + ( levels + 1 ) * 4 ); for( int i = 0; i < levels; ++i ) { // Save start offset. - start = m_stream->device()->at(); + start = m_stream->tqdevice()->at(); if( i == 0 ) { @@ -354,90 +354,90 @@ XcfExport::writeHierarchy() width /= 2; height /= 2; - *m_stream << static_cast( width ); - *m_stream << static_cast( height ); - *m_stream << static_cast( 0 ); + *m_stream << static_cast( width ); + *m_stream << static_cast( height ); + *m_stream << static_cast( 0 ); } // Save end offset. - end = m_stream->device()->at(); + end = m_stream->tqdevice()->at(); // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Save level offset. *m_stream << start; // Increment offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Return to end offset. - m_stream->device()->at( end ); + m_stream->tqdevice()->at( end ); } // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Append a zero offset to indicate end of level offsets. - *m_stream << static_cast( 0 ); + *m_stream << static_cast( 0 ); } void XcfExport::writeLevel() { // Offsets. - QIODevice::Offset current = 0; - QIODevice::Offset start = 0; - QIODevice::Offset end = 0; + TQIODevice::Offset current = 0; + TQIODevice::Offset start = 0; + TQIODevice::Offset end = 0; - *m_stream << static_cast( m_width ); - *m_stream << static_cast( m_height ); + *m_stream << static_cast( m_width ); + *m_stream << static_cast( m_height ); int rows = ( m_height + m_tileHeight - 1 ) / m_tileHeight; int cols = ( m_width + m_tileWidth - 1 ) / m_tileWidth; int tiles = rows * cols; // Save current offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Leave space for tile offsets. - m_stream->device()->at( current + ( tiles + 1 ) * 4 ); + m_stream->tqdevice()->at( current + ( tiles + 1 ) * 4 ); for( int i = 0; i < tiles; ++i ) { // Save start offset. - start = m_stream->device()->at(); + start = m_stream->tqdevice()->at(); // TODO: Save tile. - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); - *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); + *m_stream << static_cast( 1 ); // Save end offset. - end = m_stream->device()->at(); + end = m_stream->tqdevice()->at(); // Return to current offset. - m_stream->device()->at( current ); + m_stream->tqdevice()->at( current ); // Save tile offset. *m_stream << start; // Increment offset. - current = m_stream->device()->at(); + current = m_stream->tqdevice()->at(); // Return to end offset. - m_stream->device()->at( end ); + m_stream->tqdevice()->at( end ); } } diff --git a/filters/karbon/xcf/xcfexport.h b/filters/karbon/xcf/xcfexport.h index 92913cb4..0c60dd4e 100644 --- a/filters/karbon/xcf/xcfexport.h +++ b/filters/karbon/xcf/xcfexport.h @@ -26,7 +26,7 @@ #include "vvisitor.h" -class QDataStream; +class TQDataStream; class VDocument; class VLayer; @@ -34,12 +34,13 @@ class VLayer; class XcfExport : public KoFilter, private VVisitor { Q_OBJECT + TQ_OBJECT public: - XcfExport( KoFilter* parent, const char* name, const QStringList& ); + XcfExport( KoFilter* tqparent, const char* name, const TQStringList& ); virtual ~XcfExport() {} - virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to ); + virtual KoFilter::ConversiontqStatus convert( const TQCString& from, const TQCString& to ); virtual void visitVDocument( VDocument& document ); virtual void visitVLayer( VLayer& layer ); @@ -70,7 +71,7 @@ private: /** * Output stream. */ - QDataStream* m_stream; + TQDataStream* m_stream; /** * Image width. -- cgit v1.2.1