diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-19 19:03:33 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-19 19:03:33 +0000 |
commit | e69e8b1d09fb579316595b4e6a850e717358a8b1 (patch) | |
tree | a24fc20865f65772f530d16177520190594ffdd2 /kfile-plugins/pdf | |
parent | eecec9afb81fdebb0f22e9da22635874c403f854 (diff) | |
download | tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.tar.gz tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.zip |
TQt4 port kdegraphics
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kfile-plugins/pdf')
-rw-r--r-- | kfile-plugins/pdf/Makefile.am | 1 | ||||
-rw-r--r-- | kfile-plugins/pdf/kfile_pdf.cpp | 14 | ||||
-rw-r--r-- | kfile-plugins/pdf/kfile_pdf.h | 3 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-document.cc | 54 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc | 6 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h | 40 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-link.cc | 52 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc | 2 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-page-transition.h | 4 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-page.cc | 48 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-private.cc | 44 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-private.h | 10 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/poppler-qt.h | 72 | ||||
-rw-r--r-- | kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp | 38 |
14 files changed, 195 insertions, 193 deletions
diff --git a/kfile-plugins/pdf/Makefile.am b/kfile-plugins/pdf/Makefile.am index c8af5244..65a7742b 100644 --- a/kfile-plugins/pdf/Makefile.am +++ b/kfile-plugins/pdf/Makefile.am @@ -10,6 +10,7 @@ noinst_HEADERS = kfile_pdf.h kde_module_LTLIBRARIES = kfile_pdf.la +kfile_pdf_la_COMPILE_FIRST = poppler-qt kfile_pdf_la_SOURCES = kfile_pdf.cpp kfile_pdf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) kfile_pdf_la_LIBADD = $(LIB_KIO) -L$(top_builddir)/kfile-plugins/pdf/poppler-qt/ -lpoppler-qt diff --git a/kfile-plugins/pdf/kfile_pdf.cpp b/kfile-plugins/pdf/kfile_pdf.cpp index a3dcbde7..d18ada11 100644 --- a/kfile-plugins/pdf/kfile_pdf.cpp +++ b/kfile-plugins/pdf/kfile_pdf.cpp @@ -27,8 +27,8 @@ typedef KGenericFactory<KPdfPlugin> PdfFactory; K_EXPORT_COMPONENT_FACTORY(kfile_pdf, PdfFactory("kfile_pdf")) -KPdfPlugin::KPdfPlugin(TQObject *parent, const char *name, const TQStringList &preferredItems) - : KFilePlugin(parent, name, preferredItems) +KPdfPlugin::KPdfPlugin(TQObject *tqparent, const char *name, const TQStringList &preferredItems) + : KFilePlugin(tqparent, name, preferredItems) { kdDebug(7034) << "pdf plugin\n"; @@ -83,16 +83,16 @@ bool KPdfPlugin::readInfo( KFileMetaInfo& info, uint /* what */) if (doc->isEncrypted()) { enc = i18n("Yes (Can Print:%1 Can Copy:%2 Can Change:%3 Can Add notes:%4)") - .arg(doc->okToPrint() ? i18n("Yes") : i18n("No")) - .arg(doc->okToCopy() ? i18n("Yes") : i18n("No")) - .arg(doc->okToChange() ? i18n("Yes") : i18n("No")) - .arg(doc->okToAddNotes() ? i18n("Yes") : i18n("No")); + .tqarg(doc->okToPrint() ? i18n("Yes") : i18n("No")) + .tqarg(doc->okToCopy() ? i18n("Yes") : i18n("No")) + .tqarg(doc->okToChange() ? i18n("Yes") : i18n("No")) + .tqarg(doc->okToAddNotes() ? i18n("Yes") : i18n("No")); } else enc = i18n("No"); appendItem(generalGroup, "Protected", enc ); appendItem(generalGroup, "Linearized", doc->isLinearized() ? i18n("Yes") : i18n("No") ); - TQString versionString = TQString("%1").arg( doc->getPDFVersion(), 0, 'f', 1 ); + TQString versionString = TQString("%1").tqarg( doc->getPDFVersion(), 0, 'f', 1 ); appendItem(generalGroup, "Version", versionString ); delete doc; diff --git a/kfile-plugins/pdf/kfile_pdf.h b/kfile-plugins/pdf/kfile_pdf.h index eaecdb5d..b14d3989 100644 --- a/kfile-plugins/pdf/kfile_pdf.h +++ b/kfile-plugins/pdf/kfile_pdf.h @@ -29,8 +29,9 @@ class TQStringList; class KPdfPlugin: public KFilePlugin { Q_OBJECT + TQ_OBJECT public: - KPdfPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); + KPdfPlugin( TQObject *tqparent, const char *name, const TQStringList& preferredItems ); virtual bool readInfo(KFileMetaInfo& info, uint what); }; diff --git a/kfile-plugins/pdf/poppler-qt/poppler-document.cc b/kfile-plugins/pdf/poppler-qt/poppler-document.cc index a9a7a319..40e45469 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-document.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-document.cc @@ -20,7 +20,7 @@ */ #include <poppler-qt.h> -#include <qfile.h> +#include <tqfile.h> #include <GlobalParams.h> #include <Outline.h> #include <PDFDoc.h> @@ -36,13 +36,13 @@ namespace Poppler { -Document *Document::load(const QString &filePath) +Document *Document::load(const TQString &filePath) { if (!globalParams) { globalParams = new GlobalParams(); } - DocumentData *doc = new DocumentData(new GooString(QFile::encodeName(filePath)), NULL); + DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL); Document *pdoc; if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) { pdoc = new Document(doc); @@ -72,7 +72,7 @@ bool Document::isLocked() const return data->locked; } -bool Document::unlock(const QCString &password) +bool Document::unlock(const TQCString &password) { if (data->locked) { /* racier then it needs to be */ @@ -115,14 +115,14 @@ int Document::getNumPages() const return data->doc.getNumPages(); } -QValueList<FontInfo> Document::fonts() const +TQValueList<FontInfo> Document::fonts() const { - QValueList<FontInfo> ourList; + TQValueList<FontInfo> ourList; scanForFonts(getNumPages(), &ourList); return ourList; } -bool Document::scanForFonts( int numPages, QValueList<FontInfo> *fontList ) const +bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) const { GooList *items = data->m_fontInfoScanner->scan( numPages ); @@ -130,7 +130,7 @@ bool Document::scanForFonts( int numPages, QValueList<FontInfo> *fontList ) cons return false; for ( int i = 0; i < items->getLength(); ++i ) { - QString fontName; + TQString fontName; if (((::FontInfo*)items->get(i))->getName()) fontName = ((::FontInfo*)items->get(i))->getName()->getCString(); @@ -145,7 +145,7 @@ bool Document::scanForFonts( int numPages, QValueList<FontInfo> *fontList ) cons } /* borrowed from kpdf */ -QString Document::getInfo( const QString & type ) const +TQString Document::getInfo( const TQString & type ) const { // [Albert] Code adapted from pdfinfo.cc on xpdf Object info; @@ -156,7 +156,7 @@ QString Document::getInfo( const QString & type ) const if ( !info.isDict() ) return NULL; - QString result; + TQString result; Object obj; GooString *s1; GBool isUnicode; @@ -189,7 +189,7 @@ QString Document::getInfo( const QString & type ) const u = s1->getChar(i) & 0xff; ++i; } - result += unicodeToQString( &u, 1 ); + result += tqunicodeToTQString( &u, 1 ); } obj.free(); info.free(); @@ -201,43 +201,43 @@ QString Document::getInfo( const QString & type ) const } /* borrowed from kpdf */ -QDateTime Document::getDate( const QString & type ) const +TQDateTime Document::getDate( const TQString & type ) const { // [Albert] Code adapted from pdfinfo.cc on xpdf if ( data->locked ) - return QDateTime(); + return TQDateTime(); Object info; data->doc.getDocInfo( &info ); if ( !info.isDict() ) { info.free(); - return QDateTime(); + return TQDateTime(); } Object obj; int year, mon, day, hour, min, sec, tz_hour, tz_minute; char tz; Dict *infoDict = info.getDict(); - QString result; + TQString result; if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) { - QString s = UnicodeParsedString(obj.getString()); + TQString s = UnicodeParsedString(obj.getString()); // TODO do something with the timezone information if ( parseDateString( s.latin1(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) { - QDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) - QTime t( hour, min, sec ); + TQDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) + TQTime t( hour, min, sec ); if ( d.isValid() && t.isValid() ) { obj.free(); info.free(); - return QDateTime( d, t ); + return TQDateTime( d, t ); } } } obj.free(); info.free(); - return QDateTime(); + return TQDateTime(); } bool Document::isEncrypted() const @@ -283,7 +283,7 @@ void Document::getPdfVersion(int *major, int *minor) const *minor = data->doc.getPDFMinorVersion(); } -QDomDocument *Document::toc() const +TQDomDocument *Document::toc() const { Outline * outline = data->doc.getOutline(); if ( !outline ) @@ -293,33 +293,33 @@ QDomDocument *Document::toc() const if ( !items || items->getLength() < 1 ) return NULL; - QDomDocument *toc = new QDomDocument(); + TQDomDocument *toc = new TQDomDocument(); if ( items->getLength() > 0 ) data->addTocChildren( toc, toc, items ); return toc; } -LinkDestination *Document::linkDestination( const QString &name ) +LinkDestination *Document::linkDestination( const TQString &name ) { - GooString * namedDest = QStringToGooString( name ); + GooString * namedDest = TQStringToGooString( name ); LinkDestinationData ldd(NULL, namedDest, data); LinkDestination *ld = new LinkDestination(ldd); delete namedDest; return ld; } -bool Document::print(const QString &fileName, QValueList<int> pageList, double hDPI, double vDPI, int rotate) +bool Document::print(const TQString &fileName, TQValueList<int> pageList, double hDPI, double vDPI, int rotate) { return print(fileName, pageList, hDPI, vDPI, rotate, -1, -1); } -bool Document::print(const QString &file, QValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) +bool Document::print(const TQString &file, TQValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) { PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); if (psOut->isOk()) { - QValueList<int>::iterator it; + TQValueList<int>::iterator it; for (it = pageList.begin(); it != pageList.end(); ++it ) data->doc.displayPage(psOut, *it, hDPI, vDPI, rotate, gFalse, gTrue, gTrue); diff --git a/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc b/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc index 6eb9d26f..c0e777a7 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc @@ -23,13 +23,13 @@ namespace Poppler { class FontInfoData { public: - QString fontName; + TQString fontName; bool isEmbedded; bool isSubset; FontInfo::Type type; }; -FontInfo::FontInfo( const QString &fontName, const bool isEmbedded, const bool isSubset, Type type ) +FontInfo::FontInfo( const TQString &fontName, const bool isEmbedded, const bool isSubset, Type type ) { data = new FontInfoData(); data->fontName = fontName; @@ -60,7 +60,7 @@ FontInfo::~FontInfo() delete data; } -const QString &FontInfo::name() const +const TQString &FontInfo::name() const { return data->fontName; } diff --git a/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h b/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h index 82127207..fc22d8ed 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h +++ b/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h @@ -21,8 +21,8 @@ #ifndef _POPPLER_LINK_H_ #define _POPPLER_LINK_H_ -#include <qstring.h> -#include <qrect.h> +#include <tqstring.h> +#include <tqrect.h> namespace Poppler { @@ -44,7 +44,7 @@ class LinkDestination }; LinkDestination(const LinkDestinationData &data); - LinkDestination(const QString &description); + LinkDestination(const TQString &description); // Accessors. Kind kind() const; @@ -58,7 +58,7 @@ class LinkDestination bool isChangeTop() const; bool isChangeZoom() const; - QString toString() const; + TQString toString() const; private: Kind m_kind; // destination type @@ -80,7 +80,7 @@ class LinkDestination class Link { public: - Link( const QRect &linkArea ); + Link( const TQRect &linkArea ); // get link type (inherited classes mustreturn an unique identifier) enum LinkType { None, Goto, Execute, Browse, Action, Movie }; @@ -89,10 +89,10 @@ class Link // virtual destructor virtual ~Link(); - QRect linkArea() const; + TQRect linkArea() const; private: - QRect m_linkArea; + TQRect m_linkArea; }; @@ -100,16 +100,16 @@ class Link class LinkGoto : public Link { public: - LinkGoto( const QRect &linkArea, QString extFileName, const LinkDestination & destination ); + LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ); // query for goto parameters bool isExternal() const; - const QString & fileName() const; + const TQString & fileName() const; const LinkDestination & destination() const; LinkType linkType() const; private: - QString m_extFileName; + TQString m_extFileName; LinkDestination m_destination; }; @@ -118,16 +118,16 @@ class LinkExecute : public Link { public: // query for filename / parameters - const QString & fileName() const; - const QString & parameters() const; + const TQString & fileName() const; + const TQString & parameters() const; // create a Link_Execute - LinkExecute( const QRect &linkArea, const QString & file, const QString & params ); + LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ); LinkType linkType() const; private: - QString m_fileName; - QString m_parameters; + TQString m_fileName; + TQString m_parameters; }; /** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/ @@ -135,14 +135,14 @@ class LinkBrowse : public Link { public: // query for URL - const QString & url() const; + const TQString & url() const; // create a Link_Browse - LinkBrowse( const QRect &linkArea, const QString &url ); + LinkBrowse( const TQRect &linkArea, const TQString &url ); LinkType linkType() const; private: - QString m_url; + TQString m_url; }; /** Action: contains an action to perform on document / viewer **/ @@ -167,7 +167,7 @@ class LinkAction : public Link ActionType actionType() const; // create a Link_Action - LinkAction( const QRect &linkArea, ActionType actionType ); + LinkAction( const TQRect &linkArea, ActionType actionType ); LinkType linkType() const; private: @@ -179,7 +179,7 @@ class LinkMovie : public Link // TODO this (Movie link) { public: - LinkMovie( const QRect &linkArea ); + LinkMovie( const TQRect &linkArea ); LinkType linkType() const; }; diff --git a/kfile-plugins/pdf/poppler-qt/poppler-link.cc b/kfile-plugins/pdf/poppler-qt/poppler-link.cc index af6d6452..72db1fff 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-link.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-link.cc @@ -21,7 +21,7 @@ #include <poppler-qt.h> #include <poppler-private.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include <Link.h> @@ -80,9 +80,9 @@ namespace Poppler { if (deleteDest) delete ld; } - LinkDestination::LinkDestination(const QString &description) + LinkDestination::LinkDestination(const TQString &description) { - QStringList tokens = QStringList::split(';', description); + TQStringList tokens = TQStringList::split(';', description); m_kind = static_cast<Kind>(tokens[0].toInt()); m_pageNum = tokens[1].toInt(); m_left = tokens[2].toDouble(); @@ -145,18 +145,18 @@ namespace Poppler { return m_changeZoom; } - QString LinkDestination::toString() const - { - QString s = QString::number( (Q_INT8)m_kind ); - s += ";" + QString::number( m_pageNum ); - s += ";" + QString::number( m_left ); - s += ";" + QString::number( m_bottom ); - s += ";" + QString::number( m_right ); - s += ";" + QString::number( m_top ); - s += ";" + QString::number( m_zoom ); - s += ";" + QString::number( (Q_INT8)m_changeLeft ); - s += ";" + QString::number( (Q_INT8)m_changeTop ); - s += ";" + QString::number( (Q_INT8)m_changeZoom ); + TQString LinkDestination::toString() const + { + TQString s = TQString::number( (TQ_INT8)m_kind ); + s += ";" + TQString::number( m_pageNum ); + s += ";" + TQString::number( m_left ); + s += ";" + TQString::number( m_bottom ); + s += ";" + TQString::number( m_right ); + s += ";" + TQString::number( m_top ); + s += ";" + TQString::number( m_zoom ); + s += ";" + TQString::number( (TQ_INT8)m_changeLeft ); + s += ";" + TQString::number( (TQ_INT8)m_changeTop ); + s += ";" + TQString::number( (TQ_INT8)m_changeZoom ); return s; } @@ -166,7 +166,7 @@ namespace Poppler { { } - Link::Link(const QRect &linkArea) : m_linkArea(linkArea) + Link::Link(const TQRect &linkArea) : m_linkArea(linkArea) { } @@ -175,13 +175,13 @@ namespace Poppler { return None; } - QRect Link::linkArea() const + TQRect Link::linkArea() const { return m_linkArea; } // LinkGoto - LinkGoto::LinkGoto( const QRect &linkArea, QString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination) + LinkGoto::LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination) { } @@ -190,7 +190,7 @@ namespace Poppler { return !m_extFileName.isEmpty(); } - const QString &LinkGoto::fileName() const + const TQString &LinkGoto::fileName() const { return m_extFileName; } @@ -206,15 +206,15 @@ namespace Poppler { } // LinkExecute - LinkExecute::LinkExecute( const QRect &linkArea, const QString & file, const QString & params ) : Link(linkArea), m_fileName(file), m_parameters(params) + LinkExecute::LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ) : Link(linkArea), m_fileName(file), m_parameters(params) { } - const QString & LinkExecute::fileName() const + const TQString & LinkExecute::fileName() const { return m_fileName; } - const QString & LinkExecute::parameters() const + const TQString & LinkExecute::parameters() const { return m_parameters; } @@ -225,11 +225,11 @@ namespace Poppler { } // LinkBrowse - LinkBrowse::LinkBrowse( const QRect &linkArea, const QString &url ) : Link(linkArea), m_url(url) + LinkBrowse::LinkBrowse( const TQRect &linkArea, const TQString &url ) : Link(linkArea), m_url(url) { } - const QString & LinkBrowse::url() const + const TQString & LinkBrowse::url() const { return m_url; } @@ -240,7 +240,7 @@ namespace Poppler { } // LinkAction - LinkAction::LinkAction( const QRect &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType) + LinkAction::LinkAction( const TQRect &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType) { } @@ -255,7 +255,7 @@ namespace Poppler { } // LinkMovie - LinkMovie::LinkMovie( const QRect &linkArea ) : Link(linkArea) + LinkMovie::LinkMovie( const TQRect &linkArea ) : Link(linkArea) { } diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc index cde8818d..9998f738 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc @@ -68,7 +68,7 @@ int PageTransition::duration() const return data->pt->getDuration(); } -PageTransition::Alignment PageTransition::alignment() const +PageTransition::Alignment PageTransition::tqalignment() const { return (Poppler::PageTransition::Alignment)data->pt->getAlignment(); } diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h index 53002ff9..f33a014c 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h +++ b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h @@ -60,7 +60,7 @@ class PageTransition { Fade }; - /** \brief alignment of the transition effect that shall be used + /** \brief tqalignment of the transition effect that shall be used */ // if changed remember to keep in sync with PageTransition.h enum enum Alignment { @@ -114,7 +114,7 @@ class PageTransition { /** \brief Get dimension in which the transition effect occurs. */ - Alignment alignment() const; + Alignment tqalignment() const; /** \brief Get direction of motion of the transition effect. diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page.cc b/kfile-plugins/pdf/poppler-qt/poppler-page.cc index a42aa15c..b6be9bd1 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-page.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-page.cc @@ -23,8 +23,8 @@ */ #include <poppler-qt.h> -#include <qfile.h> -#include <qimage.h> +#include <tqfile.h> +#include <tqimage.h> #include <config.h> #include <GlobalParams.h> #include <PDFDoc.h> @@ -62,18 +62,18 @@ Page::~Page() delete data; } -void Page::renderToPixmap(QPixmap **q, int x, int y, int w, int h, bool doLinks) const +void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks) const { renderToPixmap(q, x, y, w, h, 72.0, 72.0, doLinks); } -void Page::renderToPixmap(QPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks) const +void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks) const { - QImage img = renderToImage(xres, yres, doLinks); - *q = new QPixmap( img ); + TQImage img = renderToImage(xres, yres, doLinks); + *q = new TQPixmap( img ); } -QImage Page::renderToImage(double xres, double yres, bool doLinks) const +TQImage Page::renderToImage(double xres, double yres, bool doLinks) const { #if defined(HAVE_SPLASH) SplashOutputDev *output_dev; @@ -89,7 +89,7 @@ QImage Page::renderToImage(double xres, double yres, bool doLinks) const int bh = output_dev->getBitmap()->getHeight(); SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr(); - if (QImage::BigEndian == QImage::systemByteOrder()) + if (TQImage::BigEndian == TQImage::systemByteOrder()) { uchar c; int count = bw * bh * 4; @@ -106,7 +106,7 @@ QImage Page::renderToImage(double xres, double yres, bool doLinks) const } // construct a qimage SHARING the raw bitmap data in memory - QImage img( dataPtr, bw, bh, 32, 0, 0, QImage::IgnoreEndian ); + TQImage img( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian ); img = img.copy(); // unload underlying xpdf bitmap output_dev->startPage( 0, NULL ); @@ -117,16 +117,16 @@ QImage Page::renderToImage(double xres, double yres, bool doLinks) const (void)xres; (void)doLinks; - return QImage(); + return TQImage(); #endif } -QString Page::getText(const Rectangle &r) const +TQString Page::getText(const Rectangle &r) const { TextOutputDev *output_dev; GooString *s; PDFRectangle *rect; - QString result; + TQString result; ::Page *p; output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); @@ -147,18 +147,18 @@ QString Page::getText(const Rectangle &r) const s = output_dev->getText(r.m_x1, y1, r.m_x2, y2); } - result = QString::fromUtf8(s->getCString()); + result = TQString::fromUtf8(s->getCString()); delete output_dev; delete s; return result; } -QValueList<TextBox*> Page::textList() const +TQValueList<TextBox*> Page::textList() const { TextOutputDev *output_dev; - QValueList<TextBox*> output_list; + TQValueList<TextBox*> output_list; output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); @@ -175,7 +175,7 @@ QValueList<TextBox*> Page::textList() const for (int i = 0; i < word_list->getLength(); i++) { TextWord *word = word_list->get(i); GooString *word_str = word->getText(); - QString string = QString::fromUtf8(word_str->getCString()); + TQString string = TQString::fromUtf8(word_str->getCString()); delete word_str; double xMin, yMin, xMax, yMax; word->getBBox(&xMin, &yMin, &xMax, &yMax); @@ -204,15 +204,15 @@ PageTransition *Page::getTransition() const return data->transition; } -QSize Page::pageSize() const +TQSize Page::pageSize() const { ::Page *p; p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); if ( ( Page::Landscape == orientation() ) || (Page::Seascape == orientation() ) ) { - return QSize( (int)p->getCropHeight(), (int)p->getCropWidth() ); + return TQSize( (int)p->getCropHeight(), (int)p->getCropWidth() ); } else { - return QSize( (int)p->getCropWidth(), (int)p->getCropHeight() ); + return TQSize( (int)p->getCropWidth(), (int)p->getCropHeight() ); } } @@ -236,9 +236,9 @@ Page::Orientation Page::orientation() const } } -QValueList<Link*> Page::links() const +TQValueList<Link*> Page::links() const { - QValueList<Link*> popplerLinks; + TQValueList<Link*> popplerLinks; #if defined(HAVE_SPLASH) Links *xpdfLinks = data->doc->data->doc.getLinks(data->index + 1); @@ -249,7 +249,7 @@ QValueList<Link*> Page::links() const double left, top, right, bottom; int leftAux, topAux, rightAux, bottomAux; xpdfLink->getRect( &left, &top, &right, &bottom ); - QRect linkArea; + TQRect linkArea; data->doc->data->m_outputDev->cvtUserToDev( left, top, &leftAux, &topAux ); data->doc->data->m_outputDev->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); @@ -270,7 +270,7 @@ QValueList<Link*> Page::links() const { LinkGoTo * g = (LinkGoTo *) a; // create link: no ext file, namedDest, object pointer - popplerLink = new LinkGoto( linkArea, QString::null, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); + popplerLink = new LinkGoto( linkArea, TQString(), LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); } break; @@ -278,7 +278,7 @@ QValueList<Link*> Page::links() const { LinkGoToR * g = (LinkGoToR *) a; // copy link file - const QString fileName = UnicodeParsedString( g->getFileName() ); + const TQString fileName = UnicodeParsedString( g->getFileName() ); // ceate link: fileName, namedDest, object pointer popplerLink = new LinkGoto( linkArea, fileName, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); } diff --git a/kfile-plugins/pdf/poppler-qt/poppler-private.cc b/kfile-plugins/pdf/poppler-qt/poppler-private.cc index 2388a1b5..6d209c2b 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-private.cc +++ b/kfile-plugins/pdf/poppler-qt/poppler-private.cc @@ -23,7 +23,7 @@ #include "poppler-private.h" #include "poppler-link-qt3.h" -#include <qstring.h> +#include <tqstring.h> #include <Outline.h> #include <Link.h> @@ -31,22 +31,22 @@ namespace Poppler { /* borrowed from kpdf */ -QString unicodeToQString(Unicode* u, int len) +TQString tqunicodeToTQString(Unicode* u, int len) { - QString ret; + TQString ret; ret.setLength(len); - QChar* qch = (QChar*) ret.unicode(); + TQChar* qch = (TQChar*) ret.tqunicode(); for (;len;--len) - *qch++ = (QChar) *u++; + *qch++ = (TQChar) *u++; return ret; } -QString UnicodeParsedString(GooString *s1) +TQString UnicodeParsedString(GooString *s1) { GBool isUnicode; int i; Unicode u; - QString result; + TQString result; if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) { isUnicode = gTrue; @@ -69,24 +69,24 @@ QString UnicodeParsedString(GooString *s1) u = s1->getChar(i) & 0xff; ++i; } - result += unicodeToQString( &u, 1 ); + result += tqunicodeToTQString( &u, 1 ); } return result; } -GooString *QStringToGooString(const QString &s) +GooString *TQStringToGooString(const TQString &s) { int len = s.length(); char *cstring = (char *)gmallocn(s.length(), sizeof(char)); for (int i = 0; i < len; ++i) - cstring[i] = s.at(i).unicode(); + cstring[i] = s.tqat(i).tqunicode(); GooString *ret = new GooString(cstring, len); gfree(cstring); return ret; } -void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items ) +void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * tqparent, GooList * items ) { int numItems = items->getLength(); for ( int i = 0; i < numItems; ++i ) @@ -95,15 +95,15 @@ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, Goo OutlineItem * outlineItem = (OutlineItem *)items->get( i ); // 1. create element using outlineItem's title as tagName - QString name; + TQString name; Unicode * uniChar = outlineItem->getTitle(); int titleLength = outlineItem->getTitleLength(); - name = unicodeToQString(uniChar, titleLength); + name = tqunicodeToTQString(uniChar, titleLength); if ( name.isEmpty() ) continue; - QDomElement item = docSyn->createElement( name ); - parent->appendChild( item ); + TQDomElement item = docSyn->createElement( name ); + tqparent->appendChild( item ); // 2. find the page the link refers to ::LinkAction * a = outlineItem->getAction(); @@ -118,9 +118,9 @@ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, Goo // get the destination for the page now, but it's VERY time consuming, // so better storing the reference and provide the viewport on demand GooString *s = g->getNamedDest(); - QChar *charArray = new QChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); - QString aux(charArray, s->getLength()); + TQChar *charArray = new TQChar[s->getLength()]; + for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]); + TQString aux(charArray, s->getLength()); item.setAttribute( "DestinationName", aux ); delete[] charArray; } @@ -136,11 +136,11 @@ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, Goo } } - // 3. recursively descend over children + // 3. recursively descend over tqchildren outlineItem->open(); - GooList * children = outlineItem->getKids(); - if ( children ) - addTocChildren( docSyn, &item, children ); + GooList * tqchildren = outlineItem->getKids(); + if ( tqchildren ) + addTocChildren( docSyn, &item, tqchildren ); } } diff --git a/kfile-plugins/pdf/poppler-qt/poppler-private.h b/kfile-plugins/pdf/poppler-qt/poppler-private.h index 0d68e505..b1b79084 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-private.h +++ b/kfile-plugins/pdf/poppler-qt/poppler-private.h @@ -23,7 +23,7 @@ #ifndef POPPLER_PRIVATE_H #define POPPLER_PRIVATE_H -#include <qdom.h> +#include <tqdom.h> #include <config.h> #include <Object.h> @@ -39,11 +39,11 @@ namespace Poppler { class DocumentData; -QString unicodeToQString(Unicode* u, int len); +TQString tqunicodeToTQString(Unicode* u, int len); -QString UnicodeParsedString(GooString *s1); +TQString UnicodeParsedString(GooString *s1); -GooString *QStringToGooString(const QString &s); +GooString *TQStringToGooString(const TQString &s); class LinkDestinationData { public: @@ -84,7 +84,7 @@ class DocumentData { return m_outputDev; } - void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items ); + void addTocChildren( TQDomDocument * docSyn, TQDomNode * tqparent, GooList * items ); class PDFDoc doc; bool locked; diff --git a/kfile-plugins/pdf/poppler-qt/poppler-qt.h b/kfile-plugins/pdf/poppler-qt/poppler-qt.h index a6b1e6ec..9150ee3b 100644 --- a/kfile-plugins/pdf/poppler-qt/poppler-qt.h +++ b/kfile-plugins/pdf/poppler-qt/poppler-qt.h @@ -20,16 +20,16 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __POPPLER_QT_H__ -#define __POPPLER_QT_H__ +#ifndef __POPPLER_TQT_H__ +#define __POPPLER_TQT_H__ #include "poppler-link-qt3.h" #include "poppler-page-transition.h" -#include <qcstring.h> -#include <qdatetime.h> -#include <qdom.h> -#include <qpixmap.h> +#include <tqcstring.h> +#include <tqdatetime.h> +#include <tqdom.h> +#include <tqpixmap.h> namespace Poppler { @@ -53,14 +53,14 @@ class Rectangle class TextBox { public: - TextBox(const QString& text, const Rectangle &bBox) : + TextBox(const TQString& text, const Rectangle &bBox) : m_text(text), m_bBox(bBox) {}; - QString getText() const { return m_text; }; + TQString getText() const { return m_text; }; Rectangle getBoundingBox() const { return m_bBox; }; private: - QString m_text; + TQString m_text; Rectangle m_bBox; }; @@ -89,7 +89,7 @@ public: /** Create a new font information container */ - FontInfo( const QString &fontName, const bool isEmbedded, + FontInfo( const TQString &fontName, const bool isEmbedded, const bool isSubset, Type type ); FontInfo(); @@ -99,9 +99,9 @@ public: ~FontInfo(); /** - The name of the font. Can be QString::null if the font has no name + The name of the font. Can be TQString() if the font has no name */ - const QString &name() const; + const TQString &name() const; /** Whether the font is embedded in the file, or not @@ -123,7 +123,7 @@ public: */ Type type() const; - const QString &typeName() const; + const TQString &typeName() const; private: FontInfoData *data; @@ -134,7 +134,7 @@ class Page { friend class Document; public: ~Page(); - void renderToPixmap(QPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks = false) const; + void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks = false) const; /** This is a convenience function that is equivalent to @@ -143,12 +143,12 @@ class Page { \sa renderToImage() */ - void renderToPixmap(QPixmap **q, int x, int y, int w, int h, bool doLinks = false) const; + void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks = false) const; /** - \brief Render the page to a QImage using the Splash renderer + \brief Render the page to a TQImage using the Splash renderer - This method can be used to render the page to a QImage. It + This method can be used to render the page to a TQImage. It uses the "Splash" rendering engine. \param xres horizontal resolution of the graphics device, @@ -157,24 +157,24 @@ class Page { \param yres vertical resolution of the graphics device, in dots per inch (defaults to 72 dpi) - \returns a QImage of the page. + \returns a TQImage of the page. \sa renderToPixmap() */ - QImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const; + TQImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const; /** * Returns the size of the page in points **/ - QSize pageSize() const; + TQSize pageSize() const; /** * Returns the text that is inside the Rectangle r * If r is a null Rectangle all text of the page is given **/ - QString getText(const Rectangle &r) const; + TQString getText(const Rectangle &r) const; - QValueList<TextBox*> textList() const; + TQValueList<TextBox*> textList() const; /** * Returns the transition of this page @@ -196,7 +196,7 @@ class Page { /** Gets the links of the page once it has been rendered if doLinks was true */ - QValueList<Link*> links() const; + TQValueList<Link*> links() const; private: Page(const Document *doc, int index); @@ -217,7 +217,7 @@ public: UseOC }; - static Document *load(const QString & filePath); + static Document *load(const TQString & filePath); Page *getPage(int index) const{ return new Page(this, index); } @@ -225,12 +225,12 @@ public: PageMode getPageMode() const; - bool unlock(const QCString &password); + bool unlock(const TQCString &password); bool isLocked() const; - QDateTime getDate( const QString & data ) const; - QString getInfo( const QString & data ) const; + TQDateTime getDate( const TQString & data ) const; + TQString getInfo( const TQString & data ) const; bool isEncrypted() const; bool isLinearized() const; bool okToPrint() const; @@ -251,16 +251,16 @@ public: */ void getPdfVersion(int *major, int *minor) const; - bool print(const QString &fileName, QValueList<int> pageList, double hDPI, double vDPI, int rotate); + bool print(const TQString &fileName, TQValueList<int> pageList, double hDPI, double vDPI, int rotate); - // If you are using QPrinter you can get paper size doing - // QPrinter dummy(QPrinter::PrinterResolution); + // If you are using TQPrinter you can get paper size doing + // TQPrinter dummy(TQPrinter::PrinterResolution); // dummy.setFullPage(true); // dummy.setPageSize(thePageSizeYouWant); - // QPaintDeviceMetrics metrics(&dummy); + // TQPaintDeviceMetrics metrics(&dummy); // int width = metrics.width(); // int height = metrics.height(); - bool print(const QString &fileName, QValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight); + bool print(const TQString &fileName, TQValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight); /** The fonts within the PDF document. @@ -269,7 +269,7 @@ public: document. You may wish to use the call below if you have more than say 20 pages */ - QValueList<FontInfo> fonts() const; + TQValueList<FontInfo> fonts() const; /** \overload @@ -280,7 +280,7 @@ public: \return false if the end of the document has been reached */ - bool scanForFonts( int numPages, QValueList<FontInfo> *fontList ) const; + bool scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) const; /** Gets the TOC of the Document, it is application responsabiliy to delete @@ -295,9 +295,9 @@ public: \returns NULL if the Document does not have TOC */ - QDomDocument *toc() const; + TQDomDocument *toc() const; - LinkDestination *linkDestination( const QString &name ); + LinkDestination *linkDestination( const TQString &name ); ~Document(); diff --git a/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp b/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp index d97954b8..d616290d 100644 --- a/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp +++ b/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp @@ -1,27 +1,27 @@ -#include <qapplication.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qwidget.h> -#include <qlabel.h> -#include <qmessagebox.h> -#include <qfile.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqwidget.h> +#include <tqlabel.h> +#include <tqmessagebox.h> +#include <tqfile.h> #include <ctype.h> #include <poppler-qt.h> #include <stdlib.h> -class PDFDisplay : public QWidget // picture display widget +class PDFDisplay : public TQWidget // picture display widget { public: PDFDisplay( Poppler::Document *d ); ~PDFDisplay(); protected: - void paintEvent( QPaintEvent * ); - void keyPressEvent( QKeyEvent * ); + void paintEvent( TQPaintEvent * ); + void keyPressEvent( TQKeyEvent * ); private: void display(); int currentPage; - QPixmap *pixmap; + TQPixmap *pixmap; Poppler::Document *doc; }; @@ -39,16 +39,16 @@ PDFDisplay::~PDFDisplay() delete pixmap; } -void PDFDisplay::paintEvent( QPaintEvent *e ) +void PDFDisplay::paintEvent( TQPaintEvent *e ) { - QPainter paint( this ); // paint widget + TQPainter paint( this ); // paint widget if (pixmap) paint.drawPixmap(0, 0, *pixmap); } -void PDFDisplay::keyPressEvent( QKeyEvent *e ) +void PDFDisplay::keyPressEvent( TQKeyEvent *e ) { - if (e->key() == Qt::Key_Down) + if (e->key() == TQt::Key_Down) { if (currentPage + 1 < doc->getNumPages()) { @@ -56,7 +56,7 @@ void PDFDisplay::keyPressEvent( QKeyEvent *e ) display(); } } - else if (e->key() == Qt::Key_Up) + else if (e->key() == TQt::Key_Up) { if (currentPage > 0) { @@ -83,7 +83,7 @@ void PDFDisplay::display() int main( int argc, char **argv ) { - QApplication a( argc, argv ); // QApplication required! + TQApplication a( argc, argv ); // TQApplication required! if ( argc < 2 || (argc == 3 && strcmp(argv[2], "-extract") != 0) || argc > 3) { @@ -103,7 +103,7 @@ int main( int argc, char **argv ) { PDFDisplay test( doc ); // create picture display a.setMainWidget( &test); // set main widget - test.setCaption("Poppler-Qt Test"); + test.setCaption("Poppler-TQt Test"); test.show(); // show it return a.exec(); // start event loop @@ -112,7 +112,7 @@ int main( int argc, char **argv ) { Poppler::Page *page = doc->getPage(0); - QLabel *l = new QLabel(page->getText(Poppler::Rectangle()), 0); + TQLabel *l = new TQLabel(page->getText(Poppler::Rectangle()), 0); l->show(); a.setMainWidget(l); // set main widget delete page; |