summaryrefslogtreecommitdiffstats
path: root/lib/kofficecore/KoPictureShared.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kofficecore/KoPictureShared.cpp')
-rw-r--r--lib/kofficecore/KoPictureShared.cpp126
1 files changed, 63 insertions, 63 deletions
diff --git a/lib/kofficecore/KoPictureShared.cpp b/lib/kofficecore/KoPictureShared.cpp
index 5c2ff2a2..16fea2ef 100644
--- a/lib/kofficecore/KoPictureShared.cpp
+++ b/lib/kofficecore/KoPictureShared.cpp
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
-#include <qfile.h>
+#include <tqpainter.h>
+#include <tqfile.h>
#include <kdebug.h>
#include <kurl.h>
@@ -45,9 +45,9 @@ void KoPictureShared::assignPictureId( uint _id)
m_pictureId = _id;
}
-QString KoPictureShared::uniquePictureId() const
+TQString KoPictureShared::uniquePictureId() const
{
- return "Pictures"+ QString::number(m_pictureId);
+ return "Pictures"+ TQString::number(m_pictureId);
}
KoPictureShared::~KoPictureShared(void)
@@ -56,7 +56,7 @@ KoPictureShared::~KoPictureShared(void)
}
KoPictureShared::KoPictureShared(const KoPictureShared &other)
- : QShared() // Some compilers want it explicitly!
+ : TQShared() // Some compilers want it explicitly!
{
// We need to use newCopy, because we want a real copy, not just a copy of the part of KoPictureBase
if (other.m_base)
@@ -89,7 +89,7 @@ bool KoPictureShared::isNull(void) const
return true;
}
-void KoPictureShared::draw(QPainter& painter, int x, int y, int width, int height, int sx, int sy, int sw, int sh, bool fastMode)
+void KoPictureShared::draw(TQPainter& painter, int x, int y, int width, int height, int sx, int sy, int sw, int sh, bool fastMode)
{
if (m_base)
m_base->draw(painter, x, y, width, height, sx, sy, sw, sh, fastMode);
@@ -98,27 +98,27 @@ void KoPictureShared::draw(QPainter& painter, int x, int y, int width, int heigh
// Draw a red box (easier DEBUG)
kdWarning(30003) << "Drawing red rectangle! (KoPictureShared::draw)" << endl;
painter.save();
- painter.setBrush(QColor(255,0,0));
+ painter.setBrush(TQColor(255,0,0));
painter.drawRect(x,y,width,height);
painter.restore();
}
}
-bool KoPictureShared::loadWmf(QIODevice* io)
+bool KoPictureShared::loadWmf(TQIODevice* io)
{
kdDebug(30003) << "KoPictureShared::loadWmf" << endl;
if (!io)
{
- kdError(30003) << "No QIODevice!" << endl;
+ kdError(30003) << "No TQIODevice!" << endl;
return false;
}
clear();
- // The extension .wmf was used (KOffice 1.1.x) for QPicture files
+ // The extension .wmf was used (KOffice 1.1.x) for TQPicture files
// For an extern file or in the storage, .wmf can mean a real Windows Meta File.
- QByteArray array ( io->readAll() );
+ TQByteArray array ( io->readAll() );
if ((array[0]=='Q') && (array[1]=='P') &&(array[2]=='I') && (array[3]=='C'))
{
@@ -133,25 +133,25 @@ bool KoPictureShared::loadWmf(QIODevice* io)
return m_base->loadData(array, m_extension);
}
-bool KoPictureShared::loadTmp(QIODevice* io)
+bool KoPictureShared::loadTmp(TQIODevice* io)
// We have a temp file, probably from a downloaded file
// We must check the file type
{
kdDebug(30003) << "KoPictureShared::loadTmp" << endl;
if (!io)
{
- kdError(30003) << "No QIODevice!" << endl;
+ kdError(30003) << "No TQIODevice!" << endl;
return false;
}
- // The extension .wmf was used (KOffice 1.1.x) for QPicture files
+ // The extension .wmf was used (KOffice 1.1.x) for TQPicture files
// For an extern file or in the storage, .wmf can mean a real Windows Meta File.
- QByteArray array ( io->readAll() );
+ TQByteArray array ( io->readAll() );
return identifyAndLoad( array );
}
-bool KoPictureShared::identifyAndLoad( QByteArray array )
+bool KoPictureShared::identifyAndLoad( TQByteArray array )
{
if ( array.size() < 5 )
{
@@ -159,11 +159,11 @@ bool KoPictureShared::identifyAndLoad( QByteArray array )
return false;
}
- QString strExtension;
+ TQString strExtension;
bool flag=false;
// Try to find the file type by comparing magic on the first few bytes!
- // ### TODO: could not QImageIO::imageFormat do it too? (At least most of them?)
+ // ### TODO: could not TQImageIO::imageFormat do it too? (At least most of them?)
if ((array[0]==char(0x89)) && (array[1]=='P') &&(array[2]=='N') && (array[3]=='G'))
{
strExtension="png";
@@ -205,19 +205,19 @@ bool KoPictureShared::identifyAndLoad( QByteArray array )
else if ( ( array[0] == char( 0037 ) ) && ( array[1] == char( 0213 ) ) )
{
// Gzip
- QBuffer buffer(array);
+ TQBuffer buffer(array);
buffer.open(IO_ReadOnly);
- const bool flag = loadCompressed( &buffer, "application/x-gzip", "tmp" );
+ const bool flag = loadCompressed( TQT_TQIODEVICE(&buffer), "application/x-gzip", "tmp" );
buffer.close();
return flag;
}
else if ( ( array[0] == 'B' ) && ( array[1] == 'Z' ) && ( array[2] == 'h') )
{
// BZip2
- QBuffer buffer(array);
+ TQBuffer buffer(array);
buffer.open(IO_ReadOnly);
- const bool flag = loadCompressed( &buffer, "application/x-bzip2", "tmp" );
+ const bool flag = loadCompressed( TQT_TQIODEVICE(&buffer), "application/x-bzip2", "tmp" );
buffer.close();
return flag;
}
@@ -226,17 +226,17 @@ bool KoPictureShared::identifyAndLoad( QByteArray array )
kdDebug(30003) << "Cannot identify the type of temp file!"
<< " Trying to convert to PNG! (in KoPictureShared::loadTmp" << endl;
- // Do not trust QBuffer and do not work directly on the QByteArray array
+ // Do not trust TQBuffer and do not work directly on the TQByteArray array
// DF: It would be faster to work on array here, and to create a completely
- // different QBuffer for the writing code!
- QBuffer buf( array.copy() );
+ // different TQBuffer for the writing code!
+ TQBuffer buf( array.copy() );
if (!buf.open(IO_ReadOnly))
{
kdError(30003) << "Could not open read buffer!" << endl;
return false;
}
- QImageIO imageIO(&buf,NULL);
+ TQImageIO imageIO(&buf,NULL);
if (!imageIO.read())
{
@@ -252,7 +252,7 @@ bool KoPictureShared::identifyAndLoad( QByteArray array )
return false;
}
- imageIO.setIODevice(&buf);
+ imageIO.setIODevice(TQT_TQIODEVICE(&buf));
imageIO.setFormat("PNG");
if (!imageIO.write())
@@ -279,12 +279,12 @@ bool KoPictureShared::identifyAndLoad( QByteArray array )
-bool KoPictureShared::loadXpm(QIODevice* io)
+bool KoPictureShared::loadXpm(TQIODevice* io)
{
kdDebug(30003) << "KoPictureShared::loadXpm" << endl;
if (!io)
{
- kdError(30003) << "No QIODevice!" << endl;
+ kdError(30003) << "No TQIODevice!" << endl;
return false;
}
@@ -293,13 +293,13 @@ bool KoPictureShared::loadXpm(QIODevice* io)
// Old KPresenter XPM files have char(1) instead of some "
// Therefore we need to treat XPM separately
- QByteArray array=io->readAll();
+ TQByteArray array=io->readAll();
// As XPM files are normally only ASCII files, we can replace it without problems
int pos=0;
- while ((pos=array.find(char(1),pos))!=-1)
+ while ((pos=array.tqfind(char(1),pos))!=-1)
{
array[pos]='"';
}
@@ -308,13 +308,13 @@ bool KoPictureShared::loadXpm(QIODevice* io)
m_base=new KoPictureImage();
- QBuffer buffer(array);
- bool check = m_base->load(&buffer,"xpm");
+ TQBuffer buffer(array);
+ bool check = m_base->load(TQT_TQIODEVICE(&buffer),"xpm");
setExtension("xpm");
return check;
}
-bool KoPictureShared::save(QIODevice* io) const
+bool KoPictureShared::save(TQIODevice* io) const
{
if (!io)
return false;
@@ -337,12 +337,12 @@ void KoPictureShared::clear(void)
m_base=NULL;
}
-void KoPictureShared::clearAndSetMode(const QString& newMode)
+void KoPictureShared::clearAndSetMode(const TQString& newMode)
{
delete m_base;
m_base=NULL;
- const QString mode=newMode.lower();
+ const TQString mode=newMode.lower();
if ((mode=="svg") || (mode=="qpic"))
{
@@ -357,42 +357,42 @@ void KoPictureShared::clearAndSetMode(const QString& newMode)
m_base=new KoPictureEps();
}
else
- { // TODO: test if QImageIO really knows the file format
+ { // TODO: test if TQImageIO really knows the file format
m_base=new KoPictureImage();
}
}
-QString KoPictureShared::getExtension(void) const
+TQString KoPictureShared::getExtension(void) const
{
return m_extension;
}
-void KoPictureShared::setExtension(const QString& extension)
+void KoPictureShared::setExtension(const TQString& extension)
{
m_extension = extension;
}
-QString KoPictureShared::getMimeType(void) const
+TQString KoPictureShared::getMimeType(void) const
{
if (m_base)
return m_base->getMimeType(m_extension);
- return QString(NULL_MIME_TYPE);
+ return TQString(NULL_MIME_TYPE);
}
-bool KoPictureShared::loadFromBase64( const QCString& str )
+bool KoPictureShared::loadFromBase64( const TQCString& str )
{
clear();
- QByteArray data;
+ TQByteArray data;
KCodecs::base64Decode( str, data );
return identifyAndLoad( data );
}
-bool KoPictureShared::load(QIODevice* io, const QString& extension)
+bool KoPictureShared::load(TQIODevice* io, const TQString& extension)
{
- kdDebug(30003) << "KoPictureShared::load(QIODevice*, const QString&) " << extension << endl;
+ kdDebug(30003) << "KoPictureShared::load(TQIODevice*, const TQString&) " << extension << endl;
bool flag=false;
- QString ext(extension.lower());
+ TQString ext(extension.lower());
if (ext=="wmf")
flag=loadWmf(io);
else if (ext=="tmp") // ### TODO: also remote scripts need this, don't they?
@@ -423,7 +423,7 @@ bool KoPictureShared::load(QIODevice* io, const QString& extension)
return flag;
}
-bool KoPictureShared::loadFromFile(const QString& fileName)
+bool KoPictureShared::loadFromFile(const TQString& fileName)
{
kdDebug(30003) << "KoPictureShared::loadFromFile " << fileName << endl;
if ( fileName.isEmpty() )
@@ -431,54 +431,54 @@ bool KoPictureShared::loadFromFile(const QString& fileName)
kdError(30003) << "Cannot load file with empty name!" << endl;
return false;
}
- QFile file(fileName);
+ TQFile file(fileName);
if (!file.open(IO_ReadOnly))
return false;
bool flag = false;
- const int pos=fileName.findRev('.');
+ const int pos=fileName.tqfindRev('.');
if (pos==-1)
{
kdDebug(30003) << "File with no extension!" << endl;
// As we have no extension, consider it like a temporary file
- flag = loadTmp( &file );
+ flag = loadTmp( TQT_TQIODEVICE(&file) );
}
else
{
- const QString extension( fileName.mid( pos+1 ) );
+ const TQString extension( fileName.mid( pos+1 ) );
// ### TODO: check if the extension if gz or bz2 and find the previous extension
- flag = load( &file, extension );
+ flag = load( TQT_TQIODEVICE(&file), extension );
}
file.close();
return flag;
}
-QSize KoPictureShared::getOriginalSize(void) const
+TQSize KoPictureShared::getOriginalSize(void) const
{
if (m_base)
return m_base->getOriginalSize();
- return QSize(0,0);
+ return TQSize(0,0);
}
-QPixmap KoPictureShared::generatePixmap(const QSize& size, bool smoothScale)
+TQPixmap KoPictureShared::generatePixmap(const TQSize& size, bool smoothScale)
{
if (m_base)
return m_base->generatePixmap(size, smoothScale);
- return QPixmap();
+ return TQPixmap();
}
-QDragObject* KoPictureShared::dragObject( QWidget *dragSource, const char *name )
+TQDragObject* KoPictureShared::dragObject( TQWidget *dragSource, const char *name )
{
if (m_base)
return m_base->dragObject( dragSource, name );
return 0L;
}
-QImage KoPictureShared::generateImage(const QSize& size)
+TQImage KoPictureShared::generateImage(const TQSize& size)
{
if (m_base)
return m_base->generateImage( size );
- return QImage();
+ return TQImage();
}
bool KoPictureShared::hasAlphaBuffer() const
@@ -494,11 +494,11 @@ void KoPictureShared::setAlphaBuffer(bool enable)
m_base->setAlphaBuffer(enable);
}
-QImage KoPictureShared::createAlphaMask(int conversion_flags) const
+TQImage KoPictureShared::createAlphaMask(int conversion_flags) const
{
if (m_base)
return m_base->createAlphaMask(conversion_flags);
- return QImage();
+ return TQImage();
}
void KoPictureShared::clearCache(void)
@@ -507,10 +507,10 @@ void KoPictureShared::clearCache(void)
m_base->clearCache();
}
-bool KoPictureShared::loadCompressed( QIODevice* io, const QString& mimeType, const QString& extension )
+bool KoPictureShared::loadCompressed( TQIODevice* io, const TQString& mimeType, const TQString& extension )
{
// ### TODO: check that we do not have an endless recursion
- QIODevice* in = KFilterDev::device( io, mimeType, false);
+ TQIODevice* in = KFilterDev::device( io, mimeType, false);
if ( !in )
{