summaryrefslogtreecommitdiffstats
path: root/kfile-plugins/pdf
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:11:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:11:56 +0000
commit546886fdccdc2bc112e6f9eaf99a34aac1d2234e (patch)
treed017156784059256a2fc6bef83d31590cdcaf93a /kfile-plugins/pdf
parente69e8b1d09fb579316595b4e6a850e717358a8b1 (diff)
downloadtdegraphics-546886fdccdc2bc112e6f9eaf99a34aac1d2234e.tar.gz
tdegraphics-546886fdccdc2bc112e6f9eaf99a34aac1d2234e.zip
Move poppler-qt to poppler-tqt and fix build sequence
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237558 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kfile-plugins/pdf')
-rw-r--r--kfile-plugins/pdf/poppler-qt/Makefile.am42
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-document.cc334
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc83
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h188
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-link.cc267
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-page-transition-private.h33
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc95
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-page-transition.h146
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-page.cc362
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-private.cc147
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-private.h97
-rw-r--r--kfile-plugins/pdf/poppler-qt/poppler-qt.h310
-rw-r--r--kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp122
13 files changed, 0 insertions, 2226 deletions
diff --git a/kfile-plugins/pdf/poppler-qt/Makefile.am b/kfile-plugins/pdf/poppler-qt/Makefile.am
deleted file mode 100644
index f23d0307..00000000
--- a/kfile-plugins/pdf/poppler-qt/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I/usr/include/poppler \
- $(cairo_includes) \
- $(QT_INCLUDES) \
- $(FREETYPE_CFLAGS) \
- $(FONTCONFIG_CFLAGS)
-
-
-poppler_includedir = $(includedir)/poppler/qt3
-poppler_include_HEADERS = \
- poppler-qt.h \
- poppler-page-transition.h \
- poppler-link-qt3.h
-
-lib_LTLIBRARIES = libpoppler-qt.la
-libpoppler_qt_la_SOURCES = \
- poppler-document.cc \
- poppler-fontinfo.cc \
- poppler-link.cc \
- poppler-page.cc \
- poppler-page-transition.cc \
- poppler-page-transition-private.h \
- poppler-private.cc \
- poppler-private.h
-
-libpoppler_qt_la_LIBADD = \
- -lpoppler \
- $(QT_LIBS) \
- $(FREETYPE_LIBS) \
- $(FONTCONFIG_LIBS)
-
-# libpoppler_qt_la_LDFLAGS = -version-info 2:0:0 @create_shared_lib@
-
-test_poppler_qt_SOURCES = \
- test-poppler-qt.cpp
-
-test_poppler_qt_LDADD = \
- $(top_builddir)/poppler/libpoppler.la \
- libpoppler-qt.la \
- $(QT_LIBS) \
- $(FREETYPE_LIBS)
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-document.cc b/kfile-plugins/pdf/poppler-qt/poppler-document.cc
deleted file mode 100644
index 40e45469..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-document.cc
+++ /dev/null
@@ -1,334 +0,0 @@
-/* poppler-document.cc: qt interface to poppler
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005-2009, Albert Astals Cid <aacid@kde.org>
- * Copyright (C) 2006, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de>
- * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <poppler-qt.h>
-#include <tqfile.h>
-#include <GlobalParams.h>
-#include <Outline.h>
-#include <PDFDoc.h>
-#include <PSOutputDev.h>
-#include <Catalog.h>
-#include <ErrorCodes.h>
-#include <SplashOutputDev.h>
-#include <splash/SplashBitmap.h>
-#include <DateInfo.h>
-#include "poppler-private.h"
-
-#undef bool
-
-namespace Poppler {
-
-Document *Document::load(const TQString &filePath)
-{
- if (!globalParams) {
- globalParams = new GlobalParams();
- }
-
- DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL);
- Document *pdoc;
- if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) {
- pdoc = new Document(doc);
- if (doc->doc.getErrorCode() == errEncrypted)
- pdoc->data->locked = true;
- else
- pdoc->data->locked = false;
- pdoc->data->m_fontInfoScanner = new FontInfoScanner(&(doc->doc));
- return pdoc;
- }
- else
- return NULL;
-}
-
-Document::Document(DocumentData *dataA)
-{
- data = dataA;
-}
-
-Document::~Document()
-{
- delete data;
-}
-
-bool Document::isLocked() const
-{
- return data->locked;
-}
-
-bool Document::unlock(const TQCString &password)
-{
- if (data->locked) {
- /* racier then it needs to be */
- GooString *filename = new GooString(data->doc.getFileName());
- GooString *pwd = new GooString(password.data());
- DocumentData *doc2 = new DocumentData(filename, pwd);
- delete pwd;
- if (!doc2->doc.isOk()) {
- delete doc2;
- } else {
- delete data;
- data = doc2;
- data->locked = false;
- data->m_fontInfoScanner = new FontInfoScanner(&(data->doc));
- }
- }
- return data->locked;
-}
-
-Document::PageMode Document::getPageMode(void) const
-{
- switch (data->doc.getCatalog()->getPageMode()) {
- case Catalog::pageModeNone:
- return UseNone;
- case Catalog::pageModeOutlines:
- return UseOutlines;
- case Catalog::pageModeThumbs:
- return UseThumbs;
- case Catalog::pageModeFullScreen:
- return FullScreen;
- case Catalog::pageModeOC:
- return UseOC;
- default:
- return UseNone;
- }
-}
-
-int Document::getNumPages() const
-{
- return data->doc.getNumPages();
-}
-
-TQValueList<FontInfo> Document::fonts() const
-{
- TQValueList<FontInfo> ourList;
- scanForFonts(getNumPages(), &ourList);
- return ourList;
-}
-
-bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) const
-{
- GooList *items = data->m_fontInfoScanner->scan( numPages );
-
- if ( NULL == items )
- return false;
-
- for ( int i = 0; i < items->getLength(); ++i ) {
- TQString fontName;
- if (((::FontInfo*)items->get(i))->getName())
- fontName = ((::FontInfo*)items->get(i))->getName()->getCString();
-
- FontInfo font(fontName,
- ((::FontInfo*)items->get(i))->getEmbedded(),
- ((::FontInfo*)items->get(i))->getSubset(),
- (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType());
- fontList->append(font);
- }
- deleteGooList(items, ::FontInfo);
- return true;
-}
-
-/* borrowed from kpdf */
-TQString Document::getInfo( const TQString & type ) const
-{
- // [Albert] Code adapted from pdfinfo.cc on xpdf
- Object info;
- if ( data->locked )
- return NULL;
-
- data->doc.getDocInfo( &info );
- if ( !info.isDict() )
- return NULL;
-
- TQString result;
- Object obj;
- GooString *s1;
- GBool isUnicode;
- Unicode u;
- int i;
- Dict *infoDict = info.getDict();
-
- if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() )
- {
- s1 = obj.getString();
- if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff )
- {
- isUnicode = gTrue;
- i = 2;
- }
- else
- {
- isUnicode = gFalse;
- i = 0;
- }
- while ( i < obj.getString()->getLength() )
- {
- if ( isUnicode )
- {
- u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff );
- i += 2;
- }
- else
- {
- u = s1->getChar(i) & 0xff;
- ++i;
- }
- result += tqunicodeToTQString( &u, 1 );
- }
- obj.free();
- info.free();
- return result;
- }
- obj.free();
- info.free();
- return NULL;
-}
-
-/* borrowed from kpdf */
-TQDateTime Document::getDate( const TQString & type ) const
-{
- // [Albert] Code adapted from pdfinfo.cc on xpdf
- if ( data->locked )
- return TQDateTime();
-
- Object info;
- data->doc.getDocInfo( &info );
- if ( !info.isDict() ) {
- info.free();
- return TQDateTime();
- }
-
- Object obj;
- int year, mon, day, hour, min, sec, tz_hour, tz_minute;
- char tz;
- Dict *infoDict = info.getDict();
- TQString result;
-
- if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() )
- {
- 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 ) )
- {
- 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 TQDateTime( d, t );
- }
- }
- }
- obj.free();
- info.free();
- return TQDateTime();
-}
-
-bool Document::isEncrypted() const
-{
- return data->doc.isEncrypted();
-}
-
-bool Document::isLinearized() const
-{
- return data->doc.isLinearized();
-}
-
-bool Document::okToPrint() const
-{
- return data->doc.okToPrint();
-}
-
-bool Document::okToChange() const
-{
- return data->doc.okToChange();
-}
-
-bool Document::okToCopy() const
-{
- return data->doc.okToCopy();
-}
-
-bool Document::okToAddNotes() const
-{
- return data->doc.okToAddNotes();
-}
-
-double Document::getPDFVersion() const
-{
- return data->doc.getPDFMajorVersion () + data->doc.getPDFMinorVersion() / 10.0;
-}
-
-void Document::getPdfVersion(int *major, int *minor) const
-{
- if (major)
- *major = data->doc.getPDFMajorVersion();
- if (minor)
- *minor = data->doc.getPDFMinorVersion();
-}
-
-TQDomDocument *Document::toc() const
-{
- Outline * outline = data->doc.getOutline();
- if ( !outline )
- return NULL;
-
- GooList * items = outline->getItems();
- if ( !items || items->getLength() < 1 )
- return NULL;
-
- TQDomDocument *toc = new TQDomDocument();
- if ( items->getLength() > 0 )
- data->addTocChildren( toc, toc, items );
-
- return toc;
-}
-
-LinkDestination *Document::linkDestination( const TQString &name )
-{
- GooString * namedDest = TQStringToGooString( name );
- LinkDestinationData ldd(NULL, namedDest, data);
- LinkDestination *ld = new LinkDestination(ldd);
- delete namedDest;
- return ld;
-}
-
-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 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()) {
- TQValueList<int>::iterator it;
- for (it = pageList.begin(); it != pageList.end(); ++it )
- data->doc.displayPage(psOut, *it, hDPI, vDPI, rotate, gFalse, gTrue, gTrue);
-
- delete psOut;
- return true;
- } else {
- delete psOut;
- return false;
- }
-}
-
-}
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc b/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc
deleted file mode 100644
index c0e777a7..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-fontinfo.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/* poppler-qt.h: qt interface to poppler
- * Copyright (C) 2005, Albert Astals Cid <aacid@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "poppler-qt.h"
-
-namespace Poppler {
-
-class FontInfoData
-{
- public:
- TQString fontName;
- bool isEmbedded;
- bool isSubset;
- FontInfo::Type type;
-};
-
-FontInfo::FontInfo( const TQString &fontName, const bool isEmbedded, const bool isSubset, Type type )
-{
- data = new FontInfoData();
- data->fontName = fontName;
- data->isEmbedded = isEmbedded;
- data->isSubset = isSubset;
- data->type = type;
-}
-
-FontInfo::FontInfo( const FontInfo &fi )
-{
- data = new FontInfoData();
- data->fontName = fi.data->fontName;
- data->isEmbedded = fi.data->isEmbedded;
- data->isSubset = fi.data->isSubset;
- data->type = fi.data->type;
-}
-
-FontInfo::FontInfo()
-{
- data = new FontInfoData();
- data->isEmbedded = false;
- data->isSubset = false;
- data->type = unknown;
-}
-
-FontInfo::~FontInfo()
-{
- delete data;
-}
-
-const TQString &FontInfo::name() const
-{
- return data->fontName;
-}
-
-bool FontInfo::isEmbedded() const
-{
- return data->isEmbedded;
-}
-
-bool FontInfo::isSubset() const
-{
- return data->isSubset;
-}
-
-FontInfo::Type FontInfo::type() const
-{
- return data->type;
-}
-
-}
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h b/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h
deleted file mode 100644
index fc22d8ed..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-link-qt3.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* poppler-link.h: qt interface to poppler
- * Copyright (C) 2006, Albert Astals Cid <aacid@kde.org>
- * Adapting code from
- * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _POPPLER_LINK_H_
-#define _POPPLER_LINK_H_
-
-#include <tqstring.h>
-#include <tqrect.h>
-
-namespace Poppler {
-
-class LinkDestinationData;
-
-class LinkDestination
-{
- public:
- enum Kind
- {
- destXYZ = 1,
- destFit = 2,
- destFitH = 3,
- destFitV = 4,
- destFitR = 5,
- destFitB = 6,
- destFitBH = 7,
- destFitBV = 8
- };
-
- LinkDestination(const LinkDestinationData &data);
- LinkDestination(const TQString &description);
-
- // Accessors.
- Kind kind() const;
- int pageNumber() const;
- double left() const;
- double bottom() const;
- double right() const;
- double top() const;
- double zoom() const;
- bool isChangeLeft() const;
- bool isChangeTop() const;
- bool isChangeZoom() const;
-
- TQString toString() const;
-
- private:
- Kind m_kind; // destination type
- int m_pageNum; // page number
- double m_left, m_bottom; // position
- double m_right, m_top;
- double m_zoom; // zoom factor
- bool m_changeLeft, m_changeTop; // for destXYZ links, which position
- bool m_changeZoom; // components to change
-};
-
-/**
- * @short Encapsulates data that describes a link.
- *
- * This is the base class for links. It makes mandatory for inherited
- * widgets to reimplement the 'linkType' method and return the type of
- * the link described by the reimplemented class.
- */
-class Link
-{
- public:
- Link( const TQRect &linkArea );
-
- // get link type (inherited classes mustreturn an unique identifier)
- enum LinkType { None, Goto, Execute, Browse, Action, Movie };
- virtual LinkType linkType() const;
-
- // virtual destructor
- virtual ~Link();
-
- TQRect linkArea() const;
-
- private:
- TQRect m_linkArea;
-};
-
-
-/** Goto: a viewport and maybe a reference to an external filename **/
-class LinkGoto : public Link
-{
- public:
- LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination );
-
- // query for goto parameters
- bool isExternal() const;
- const TQString & fileName() const;
- const LinkDestination & destination() const;
- LinkType linkType() const;
-
- private:
- TQString m_extFileName;
- LinkDestination m_destination;
-};
-
-/** Execute: filename and parameters to execute **/
-class LinkExecute : public Link
-{
- public:
- // query for filename / parameters
- const TQString & fileName() const;
- const TQString & parameters() const;
-
- // create a Link_Execute
- LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params );
- LinkType linkType() const;
-
- private:
- TQString m_fileName;
- TQString m_parameters;
-};
-
-/** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/
-class LinkBrowse : public Link
-{
- public:
- // query for URL
- const TQString & url() const;
-
- // create a Link_Browse
- LinkBrowse( const TQRect &linkArea, const TQString &url );
- LinkType linkType() const;
-
- private:
- TQString m_url;
-};
-
-/** Action: contains an action to perform on document / viewer **/
-class LinkAction : public Link
-{
- public:
- // define types of actions
- enum ActionType { PageFirst = 1,
- PagePrev = 2,
- PageNext = 3,
- PageLast = 4,
- HistoryBack = 5,
- HistoryForward = 6,
- Quit = 7,
- Presentation = 8,
- EndPresentation = 9,
- Find = 10,
- GoToPage = 11,
- Close = 12 };
-
- // query for action type
- ActionType actionType() const;
-
- // create a Link_Action
- LinkAction( const TQRect &linkArea, ActionType actionType );
- LinkType linkType() const;
-
- private:
- ActionType m_type;
-};
-
-/** Movie: Not yet defined -> think renaming to 'Media' link **/
-class LinkMovie : public Link
-// TODO this (Movie link)
-{
- public:
- LinkMovie( const TQRect &linkArea );
- LinkType linkType() const;
-};
-
-}
-
-#endif
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-link.cc b/kfile-plugins/pdf/poppler-qt/poppler-link.cc
deleted file mode 100644
index 72db1fff..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-link.cc
+++ /dev/null
@@ -1,267 +0,0 @@
-/* poppler-link.cc: qt interface to poppler
- * Copyright (C) 2006, 2008 Albert Astals Cid
- * Adapting code from
- * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <poppler-qt.h>
-#include <poppler-private.h>
-
-#include <tqstringlist.h>
-
-#include <Link.h>
-
-namespace Poppler {
-
- LinkDestination::LinkDestination(const LinkDestinationData &data)
- {
- bool deleteDest = false;
- LinkDest *ld = data.ld;
-
- if ( data.namedDest && !ld )
- {
- deleteDest = true;
- ld = data.doc->doc.findDest( data.namedDest );
- }
-
- if (!ld) return;
-
- if (ld->getKind() == ::destXYZ) m_kind = destXYZ;
- else if (ld->getKind() == ::destFit) m_kind = destFit;
- else if (ld->getKind() == ::destFitH) m_kind = destFitH;
- else if (ld->getKind() == ::destFitV) m_kind = destFitV;
- else if (ld->getKind() == ::destFitR) m_kind = destFitR;
- else if (ld->getKind() == ::destFitB) m_kind = destFitB;
- else if (ld->getKind() == ::destFitBH) m_kind = destFitBH;
- else if (ld->getKind() == ::destFitBV) m_kind = destFitBV;
-
- if ( !ld->isPageRef() ) m_pageNum = ld->getPageNum();
- else
- {
- Ref ref = ld->getPageRef();
- m_pageNum = data.doc->doc.findPage( ref.num, ref.gen );
- }
- double left = ld->getLeft();
- double bottom = ld->getBottom();
- double right = ld->getRight();
- double top = ld->getTop();
- m_zoom = ld->getZoom();
- m_changeLeft = ld->getChangeLeft();
- m_changeTop = ld->getChangeTop();
- m_changeZoom = ld->getChangeZoom();
-
- int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0;
-
-#if defined(HAVE_SPLASH)
- SplashOutputDev *sod = data.doc->getOutputDev();
- sod->cvtUserToDev( left, top, &leftAux, &topAux );
- sod->cvtUserToDev( right, bottom, &rightAux, &bottomAux );
-#endif
-
- m_left = leftAux;
- m_top = topAux;
- m_right = rightAux;
- m_bottom = bottomAux;
-
- if (deleteDest) delete ld;
- }
-
- LinkDestination::LinkDestination(const TQString &description)
- {
- TQStringList tokens = TQStringList::split(';', description);
- m_kind = static_cast<Kind>(tokens[0].toInt());
- m_pageNum = tokens[1].toInt();
- m_left = tokens[2].toDouble();
- m_bottom = tokens[3].toDouble();
- m_right = tokens[4].toDouble();
- m_top = tokens[5].toDouble();
- m_zoom = tokens[6].toDouble();
- m_changeLeft = static_cast<bool>(tokens[7].toInt());
- m_changeTop = static_cast<bool>(tokens[8].toInt());
- m_changeZoom = static_cast<bool>(tokens[9].toInt());
- }
-
- LinkDestination::Kind LinkDestination::kind() const
- {
- return m_kind;
- }
-
- int LinkDestination::pageNumber() const
- {
- return m_pageNum;
- }
-
- double LinkDestination::left() const
- {
- return m_left;
- }
-
- double LinkDestination::bottom() const
- {
- return m_bottom;
- }
-
- double LinkDestination::right() const
- {
- return m_right;
- }
-
- double LinkDestination::top() const
- {
- return m_top;
- }
-
- double LinkDestination::zoom() const
- {
- return m_zoom;
- }
-
- bool LinkDestination::isChangeLeft() const
- {
- return m_changeLeft;
- }
-
- bool LinkDestination::isChangeTop() const
- {
- return m_changeTop;
- }
-
- bool LinkDestination::isChangeZoom() const
- {
- return 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;
- }
-
-
- // Link
- Link::~Link()
- {
- }
-
- Link::Link(const TQRect &linkArea) : m_linkArea(linkArea)
- {
- }
-
- Link::LinkType Link::linkType() const
- {
- return None;
- }
-
- TQRect Link::linkArea() const
- {
- return m_linkArea;
- }
-
- // LinkGoto
- LinkGoto::LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination)
- {
- }
-
- bool LinkGoto::isExternal() const
- {
- return !m_extFileName.isEmpty();
- }
-
- const TQString &LinkGoto::fileName() const
- {
- return m_extFileName;
- }
-
- const LinkDestination &LinkGoto::destination() const
- {
- return m_destination;
- }
-
- Link::LinkType LinkGoto::linkType() const
- {
- return Goto;
- }
-
- // LinkExecute
- LinkExecute::LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ) : Link(linkArea), m_fileName(file), m_parameters(params)
- {
- }
-
- const TQString & LinkExecute::fileName() const
- {
- return m_fileName;
- }
- const TQString & LinkExecute::parameters() const
- {
- return m_parameters;
- }
-
- Link::LinkType LinkExecute::linkType() const
- {
- return Execute;
- }
-
- // LinkBrowse
- LinkBrowse::LinkBrowse( const TQRect &linkArea, const TQString &url ) : Link(linkArea), m_url(url)
- {
- }
-
- const TQString & LinkBrowse::url() const
- {
- return m_url;
- }
-
- Link::LinkType LinkBrowse::linkType() const
- {
- return Browse;
- }
-
- // LinkAction
- LinkAction::LinkAction( const TQRect &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType)
- {
- }
-
- LinkAction::ActionType LinkAction::actionType() const
- {
- return m_type;
- }
-
- Link::LinkType LinkAction::linkType() const
- {
- return Action;
- }
-
- // LinkMovie
- LinkMovie::LinkMovie( const TQRect &linkArea ) : Link(linkArea)
- {
- }
-
- Link::LinkType LinkMovie::linkType() const
- {
- return Movie;
- }
-
-}
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page-transition-private.h b/kfile-plugins/pdf/poppler-qt/poppler-page-transition-private.h
deleted file mode 100644
index 8bc70825..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-page-transition-private.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2005, Albert Astals Cid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef POPPLER_PAGE_TRANSITION_PRIVATE_H
-#define POPPLER_PAGE_TRANSITION_PRIVATE_H
-
-class Object;
-
-namespace Poppler {
-
-class PageTransitionParams {
- public:
- Object *dictObj;
-};
-
-}
-
-#endif // POPPLER_PAGE_TRANSITION_PRIVATE_H
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc
deleted file mode 100644
index 9998f738..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-/* PageTransition.cc
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "PageTransition.h"
-#include "poppler-page-transition.h"
-#include "poppler-page-transition-private.h"
-
-namespace Poppler {
-
-class PageTransitionData
-{
- public:
- PageTransitionData(Object *trans)
- {
- pt = new ::PageTransition(trans);
- }
-
- PageTransitionData(const PageTransitionData &ptd)
- {
- pt = new ::PageTransition(*ptd.pt);
- }
-
- ~PageTransitionData()
- {
- delete pt;
- }
-
- ::PageTransition *pt;
-};
-
-PageTransition::PageTransition(const PageTransitionParams &params)
-{
- data = new PageTransitionData(params.dictObj);
-}
-
-PageTransition::PageTransition(const PageTransition &pt)
-{
- data = new PageTransitionData(*pt.data);
-}
-
-PageTransition::~PageTransition()
-{
- delete data;
-}
-
-PageTransition::Type PageTransition::type() const
-{
- return (Poppler::PageTransition::Type)data->pt->getType();
-}
-
-int PageTransition::duration() const
-{
- return data->pt->getDuration();
-}
-
-PageTransition::Alignment PageTransition::tqalignment() const
-{
- return (Poppler::PageTransition::Alignment)data->pt->getAlignment();
-}
-
-PageTransition::Direction PageTransition::direction() const
-{
- return (Poppler::PageTransition::Direction)data->pt->getDirection();
-}
-
-int PageTransition::angle() const
-{
- return data->pt->getAngle();
-}
-
-double PageTransition::scale() const
-{
- return data->pt->getScale();
-}
-bool PageTransition::isRectangular() const
-{
- return data->pt->isRectangular();
-}
-
-}
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h b/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h
deleted file mode 100644
index f33a014c..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-page-transition.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* PageTransition.h
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005, Brad Hards <bradh@frogmouth.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef __PAGETRANSITION_X_H__
-#define __PAGETRANSITION_X_H__
-
-namespace Poppler {
-
-class PageTransitionParams;
-class PageTransitionData;
-
-/**
- \brief Describes how a PDF file viewer shall perform the transition
- from one page to another
-
- In PDF files there is a way to specify if the viewer shall use
- certain effects to perform the transition from one page to
- another. This feature can be used, e.g., in a PDF-based beamer
- presentation.
-
- This utility class represents the transition effect, and can be
- used to extract the information from a PDF object.
-*/
-
-
-class PageTransition {
- public:
-
- /** \brief transition effect that shall be used
- */
- // if changed remember to keep in sync with PageTransition.h enum
- enum Type {
- Replace = 0,
- Split,
- Blinds,
- Box,
- Wipe,
- Dissolve,
- Glitter,
- Fly,
- Push,
- Cover,
- Uncover,
- Fade
- };
-
- /** \brief tqalignment of the transition effect that shall be used
- */
- // if changed remember to keep in sync with PageTransition.h enum
- enum Alignment {
- Horizontal = 0,
- Vertical
- };
-
- /** \brief direction of the transition effect that shall be used
- */
- // if changed remember to keep in sync with PageTransition.h enum
- enum Direction {
- Inward = 0,
- Outward
- };
-
- /** \brief Construct a new PageTransition object from a page dictionary.
-
- Users of the library will rarely need to construct a
- PageTransition object themselves. Instead, the method
- Poppler::Page::transition() can be used to find out if a certain
- transition effect is specified.
-
- @warning In case or error, this method will print an error message to stderr,
- and construct a default object.
-
- @param params an object whose dictionary will be read and
- parsed. This must be a valid object, whose dictionaries are
- accessed by the constructor. The object is only accessed by this
- constructor, and may be deleted after the constructor returns.
- */
- PageTransition(const PageTransitionParams &params);
-
- /** \brief copy constructor */
- PageTransition(const PageTransition &pt);
-
- /**
- Destructor
- */
- ~PageTransition();
-
- /**
- \brief Get type of the transition.
- */
- Type type() const;
-
- /**
- \brief Get duration of the transition in seconds.
- */
- int duration() const;
-
- /**
- \brief Get dimension in which the transition effect occurs.
- */
- Alignment tqalignment() const;
-
- /**
- \brief Get direction of motion of the transition effect.
- */
- Direction direction() const;
-
- /**
- \brief Get direction in which the transition effect moves.
- */
- int angle() const;
-
- /**
- \brief Get starting or ending scale.
- */
- double scale() const;
-
- /**
- \brief Returns true if the area to be flown is rectangular and
- opaque.
- */
- bool isRectangular() const;
-
- private:
- PageTransitionData *data;
-};
-
-}
-
-#endif
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-page.cc b/kfile-plugins/pdf/poppler-qt/poppler-page.cc
deleted file mode 100644
index b6be9bd1..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-page.cc
+++ /dev/null
@@ -1,362 +0,0 @@
-/* poppler-page.cc: qt interface to poppler
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005-2006, Albert Astals Cid <aacid@kde.org>
- * Copyright (C) 2005, Tobias Koening <tokoe@kde.org>
- * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de>
- * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
- * Copyright (C) 2006, Jerry Epplin <jepplin@globalvelocity.com>
- * Copyright (C) 2007, 2010, Pino Toscano <pino@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <poppler-qt.h>
-#include <tqfile.h>
-#include <tqimage.h>
-#include <config.h>
-#include <GlobalParams.h>
-#include <PDFDoc.h>
-#include <Catalog.h>
-#include <ErrorCodes.h>
-#include <TextOutputDev.h>
-#include <Link.h>
-#if defined(HAVE_SPLASH)
-#include <SplashOutputDev.h>
-#include <splash/SplashBitmap.h>
-#endif
-
-#include "poppler-private.h"
-#include "poppler-page-transition-private.h"
-
-namespace Poppler {
-
-class PageData {
- public:
- const Document *doc;
- int index;
- PageTransition *transition;
-};
-
-Page::Page(const Document *doc, int index) {
- data = new PageData();
- data->index = index;
- data->doc = doc;
- data->transition = 0;
-}
-
-Page::~Page()
-{
- delete data->transition;
- delete data;
-}
-
-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(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks) const
-{
- TQImage img = renderToImage(xres, yres, doLinks);
- *q = new TQPixmap( img );
-}
-
-TQImage Page::renderToImage(double xres, double yres, bool doLinks) const
-{
-#if defined(HAVE_SPLASH)
- SplashOutputDev *output_dev;
- SplashBitmap *bitmap;
- SplashColorPtr color_ptr;
- output_dev = data->doc->data->getOutputDev();
-
- data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, xres, yres,
- 0, false, true, false, -1, -1, -1, -1);
- bitmap = output_dev->getBitmap ();
- color_ptr = bitmap->getDataPtr ();
- int bw = output_dev->getBitmap()->getWidth();
- int bh = output_dev->getBitmap()->getHeight();
- SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr();
-
- if (TQImage::BigEndian == TQImage::systemByteOrder())
- {
- uchar c;
- int count = bw * bh * 4;
- for (int k = 0; k < count; k += 4)
- {
- c = dataPtr[k];
- dataPtr[k] = dataPtr[k+3];
- dataPtr[k+3] = c;
-
- c = dataPtr[k+1];
- dataPtr[k+1] = dataPtr[k+2];
- dataPtr[k+2] = c;
- }
- }
-
- // construct a qimage SHARING the raw bitmap data in memory
- TQImage img( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian );
- img = img.copy();
- // unload underlying xpdf bitmap
- output_dev->startPage( 0, NULL );
-
- return img;
-#else
- (void)xres;
- (void)xres;
- (void)doLinks;
-
- return TQImage();
-#endif
-}
-
-TQString Page::getText(const Rectangle &r) const
-{
- TextOutputDev *output_dev;
- GooString *s;
- PDFRectangle *rect;
- TQString result;
- ::Page *p;
-
- output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse);
- data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72,
- 0, false, false, false, -1, -1, -1, -1);
- p = data->doc->data->doc.getCatalog()->getPage(data->index + 1);
- if (r.isNull())
- {
- rect = p->getCropBox();
- s = output_dev->getText(rect->x1, rect->y1, rect->x2, rect->y2);
- }
- else
- {
- double height, y1, y2;
- height = p->getCropHeight();
- y1 = height - r.m_y2;
- y2 = height - r.m_y1;
- s = output_dev->getText(r.m_x1, y1, r.m_x2, y2);
- }
-
- result = TQString::fromUtf8(s->getCString());
-
- delete output_dev;
- delete s;
- return result;
-}
-
-TQValueList<TextBox*> Page::textList() const
-{
- TextOutputDev *output_dev;
-
- TQValueList<TextBox*> output_list;
-
- output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse);
-
- data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72,
- 0, false, false, false, -1, -1, -1, -1);
-
- TextWordList *word_list = output_dev->makeWordList();
-
- if (!word_list) {
- delete output_dev;
- return output_list;
- }
-
- for (int i = 0; i < word_list->getLength(); i++) {
- TextWord *word = word_list->get(i);
- GooString *word_str = word->getText();
- TQString string = TQString::fromUtf8(word_str->getCString());
- delete word_str;
- double xMin, yMin, xMax, yMax;
- word->getBBox(&xMin, &yMin, &xMax, &yMax);
-
- TextBox* text_box = new TextBox(string, Rectangle(xMin, yMin, xMax, yMax));
-
- output_list.append(text_box);
- }
-
- delete word_list;
- delete output_dev;
-
- return output_list;
-}
-
-PageTransition *Page::getTransition() const
-{
- if (!data->transition)
- {
- Object o;
- PageTransitionParams params;
- params.dictObj = data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans(&o);
- data->transition = new PageTransition(params);
- o.free();
- }
- return data->transition;
-}
-
-TQSize Page::pageSize() const
-{
- ::Page *p;
-
- p = data->doc->data->doc.getCatalog()->getPage(data->index + 1);
- if ( ( Page::Landscape == orientation() ) || (Page::Seascape == orientation() ) ) {
- return TQSize( (int)p->getCropHeight(), (int)p->getCropWidth() );
- } else {
- return TQSize( (int)p->getCropWidth(), (int)p->getCropHeight() );
- }
-}
-
-Page::Orientation Page::orientation() const
-{
- ::Page *p = data->doc->data->doc.getCatalog()->getPage(data->index + 1);
-
- int rotation = p->getRotate();
- switch (rotation) {
- case 90:
- return Page::Landscape;
- break;
- case 180:
- return Page::UpsideDown;
- break;
- case 270:
- return Page::Seascape;
- break;
- default:
- return Page::Portrait;
- }
-}
-
-TQValueList<Link*> Page::links() const
-{
- TQValueList<Link*> popplerLinks;
-
-#if defined(HAVE_SPLASH)
- Links *xpdfLinks = data->doc->data->doc.getLinks(data->index + 1);
- for (int i = 0; i < xpdfLinks->getNumLinks(); ++i)
- {
- ::Link *xpdfLink = xpdfLinks->getLink(i);
-
- double left, top, right, bottom;
- int leftAux, topAux, rightAux, bottomAux;
- xpdfLink->getRect( &left, &top, &right, &bottom );
- TQRect linkArea;
-
- data->doc->data->m_outputDev->cvtUserToDev( left, top, &leftAux, &topAux );
- data->doc->data->m_outputDev->cvtUserToDev( right, bottom, &rightAux, &bottomAux );
- linkArea.setLeft(leftAux);
- linkArea.setTop(topAux);
- linkArea.setRight(rightAux);
- linkArea.setBottom(bottomAux);
-
- if (!xpdfLink->isOk()) continue;
-
- Link *popplerLink = NULL;
- ::LinkAction *a = xpdfLink->getAction();
- if ( a )
- {
- switch ( a->getKind() )
- {
- case actionGoTo:
- {
- LinkGoTo * g = (LinkGoTo *) a;
- // create link: no ext file, namedDest, object pointer
- popplerLink = new LinkGoto( linkArea, TQString(), LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) );
- }
- break;
-
- case actionGoToR:
- {
- LinkGoToR * g = (LinkGoToR *) a;
- // copy link file
- 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 ) ) );
- }
- break;
-
- case actionLaunch:
- {
- LinkLaunch * e = (LinkLaunch *)a;
- GooString * p = e->getParams();
- popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : 0 );
- }
- break;
-
- case actionNamed:
- {
- const char * name = ((LinkNamed *)a)->getName()->getCString();
- if ( !strcmp( name, "NextPage" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::PageNext );
- else if ( !strcmp( name, "PrevPage" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::PagePrev );
- else if ( !strcmp( name, "FirstPage" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::PageFirst );
- else if ( !strcmp( name, "LastPage" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::PageLast );
- else if ( !strcmp( name, "GoBack" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::HistoryBack );
- else if ( !strcmp( name, "GoForward" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::HistoryForward );
- else if ( !strcmp( name, "Quit" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::Quit );
- else if ( !strcmp( name, "GoToPage" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::GoToPage );
- else if ( !strcmp( name, "Find" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::Find );
- else if ( !strcmp( name, "FullScreen" ) )
- popplerLink = new LinkAction( linkArea, LinkAction::Presentation );
- else if ( !strcmp( name, "Close" ) )
- {
- // acroread closes the document always, doesnt care whether
- // its presentation mode or not
- // popplerLink = new LinkAction( linkArea, LinkAction::EndPresentation );
- popplerLink = new LinkAction( linkArea, LinkAction::Close );
- }
- else
- {
- // TODO
- }
- }
- break;
-
- case actionURI:
- {
- popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->getCString() );
- }
- break;
-
- case actionMovie:
- case actionSound:
- case actionRendition:
- case actionJavaScript:
- case actionOCGState:
- break;
-
- case actionUnknown:
- break;
- }
- }
-
- if (popplerLink)
- {
- popplerLinks.append(popplerLink);
- }
- }
-
- delete xpdfLinks;
-#endif
-
- return popplerLinks;
-}
-
-}
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-private.cc b/kfile-plugins/pdf/poppler-qt/poppler-private.cc
deleted file mode 100644
index 6d209c2b..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-private.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-/* poppler-private.h: qt interface to poppler
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005-2008, Albert Astals Cid <aacid@kde.org>
- * Copyright (C) 2006, Kristian Høgsberg <krh@bitplanet.net>
- * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
- * Copyright (C) 2007, Pino Toscano <pino@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "poppler-private.h"
-#include "poppler-link-qt3.h"
-
-#include <tqstring.h>
-
-#include <Outline.h>
-#include <Link.h>
-
-namespace Poppler {
-
-/* borrowed from kpdf */
-TQString tqunicodeToTQString(Unicode* u, int len)
-{
- TQString ret;
- ret.setLength(len);
- TQChar* qch = (TQChar*) ret.tqunicode();
- for (;len;--len)
- *qch++ = (TQChar) *u++;
- return ret;
-}
-
-TQString UnicodeParsedString(GooString *s1)
-{
- GBool isUnicode;
- int i;
- Unicode u;
- TQString result;
- if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff )
- {
- isUnicode = gTrue;
- i = 2;
- }
- else
- {
- isUnicode = gFalse;
- i = 0;
- }
- while ( i < s1->getLength() )
- {
- if ( isUnicode )
- {
- u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff );
- i += 2;
- }
- else
- {
- u = s1->getChar(i) & 0xff;
- ++i;
- }
- result += tqunicodeToTQString( &u, 1 );
- }
- return result;
-}
-
-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.tqat(i).tqunicode();
- GooString *ret = new GooString(cstring, len);
- gfree(cstring);
- return ret;
-}
-
-
-void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * tqparent, GooList * items )
-{
- int numItems = items->getLength();
- for ( int i = 0; i < numItems; ++i )
- {
- // iterate over every object in 'items'
- OutlineItem * outlineItem = (OutlineItem *)items->get( i );
-
- // 1. create element using outlineItem's title as tagName
- TQString name;
- Unicode * uniChar = outlineItem->getTitle();
- int titleLength = outlineItem->getTitleLength();
- name = tqunicodeToTQString(uniChar, titleLength);
- if ( name.isEmpty() )
- continue;
-
- TQDomElement item = docSyn->createElement( name );
- tqparent->appendChild( item );
-
- // 2. find the page the link refers to
- ::LinkAction * a = outlineItem->getAction();
- if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) )
- {
- // page number is contained/referenced in a LinkGoTo
- LinkGoTo * g = static_cast< LinkGoTo * >( a );
- LinkDest * destination = g->getDest();
- if ( !destination && g->getNamedDest() )
- {
- // no 'destination' but an internal 'named reference'. we could
- // 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();
- 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;
- }
- else if ( destination && destination->isOk() )
- {
- LinkDestinationData ldd(destination, NULL, this);
- item.setAttribute( "Destination", LinkDestination(ldd).toString() );
- }
- if ( a->getKind() == actionGoToR )
- {
- LinkGoToR * g2 = static_cast< LinkGoToR * >( a );
- item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() );
- }
- }
-
- // 3. recursively descend over tqchildren
- outlineItem->open();
- 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
deleted file mode 100644
index b1b79084..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-private.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* poppler-private.h: qt interface to poppler
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005-2008, Albert Astals Cid <aacid@kde.org>
- * Copyright (C) 2006, Kristian Høgsberg <krh@bitplanet.net>
- * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
- * Copyright (C) 2007, Pino Toscano <pino@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef POPPLER_PRIVATE_H
-#define POPPLER_PRIVATE_H
-
-#include <tqdom.h>
-
-#include <config.h>
-#include <Object.h>
-#include <PDFDoc.h>
-#include <FontInfo.h>
-#if defined(HAVE_SPLASH)
-#include <SplashOutputDev.h>
-#else
-class SplashOutputDev;
-#endif
-
-namespace Poppler {
-
-class DocumentData;
-
-TQString tqunicodeToTQString(Unicode* u, int len);
-
-TQString UnicodeParsedString(GooString *s1);
-
-GooString *TQStringToGooString(const TQString &s);
-
-class LinkDestinationData {
- public:
- LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc)
- {
- }
-
- LinkDest *ld;
- GooString *namedDest;
- Poppler::DocumentData *doc;
-};
-
-class DocumentData {
- public:
- DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {}
-
- ~DocumentData()
- {
-#if defined(HAVE_SPLASH)
- delete m_outputDev;
-#endif
- delete m_fontInfoScanner;
- }
-
- SplashOutputDev *getOutputDev()
- {
-#if defined(HAVE_SPLASH)
- if (!m_outputDev)
- {
- SplashColor white;
- white[0] = 255;
- white[1] = 255;
- white[2] = 255;
- m_outputDev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white);
- m_outputDev->startDoc(doc.getXRef());
- }
-#endif
- return m_outputDev;
- }
-
- void addTocChildren( TQDomDocument * docSyn, TQDomNode * tqparent, GooList * items );
-
- class PDFDoc doc;
- bool locked;
- FontInfoScanner *m_fontInfoScanner;
- SplashOutputDev *m_outputDev;
-};
-
-}
-
-#endif // POPPLER_PRIVATE_H
diff --git a/kfile-plugins/pdf/poppler-qt/poppler-qt.h b/kfile-plugins/pdf/poppler-qt/poppler-qt.h
deleted file mode 100644
index 9150ee3b..00000000
--- a/kfile-plugins/pdf/poppler-qt/poppler-qt.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/* poppler-qt.h: qt interface to poppler
- * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005, Tobias Koening <tokoe@kde.org>
- * Copyright (C) 2005-2007, Albert Astals Cid <aacid@kde.org>
- * Copyright (C) 2005-2006, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de>
- * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef __POPPLER_TQT_H__
-#define __POPPLER_TQT_H__
-
-#include "poppler-link-qt3.h"
-#include "poppler-page-transition.h"
-
-#include <tqcstring.h>
-#include <tqdatetime.h>
-#include <tqdom.h>
-#include <tqpixmap.h>
-
-namespace Poppler {
-
-class Document;
-class Page;
-
-/* A rectangle on a page, with coordinates in PDF points. */
-class Rectangle
-{
- public:
- Rectangle(double x1 = 0, double y1 = 0, double x2 = 0, double y2 = 0) :
- m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2) {}
- bool isNull() const { return m_x1 == 0 && m_y1 == 0 && m_x2 == 0 && m_y2 == 0; }
-
- double m_x1;
- double m_y1;
- double m_x2;
- double m_y2;
-};
-
-class TextBox
-{
- public:
- TextBox(const TQString& text, const Rectangle &bBox) :
- m_text(text), m_bBox(bBox) {};
-
- TQString getText() const { return m_text; };
- Rectangle getBoundingBox() const { return m_bBox; };
-
- private:
- TQString m_text;
- Rectangle m_bBox;
-};
-
-
-/**
- Container class for information about a font within a PDF document
-*/
-class FontInfoData;
-class FontInfo {
-public:
- enum Type {
- unknown,
- Type1,
- Type1C,
- Type1COT,
- Type3,
- TrueType,
- TrueTypeOT,
- CIDType0,
- CIDType0C,
- CIDType0COT,
- CIDTrueType,
- CIDTrueTypeOT
- };
-
- /**
- Create a new font information container
- */
- FontInfo( const TQString &fontName, const bool isEmbedded,
- const bool isSubset, Type type );
-
- FontInfo();
-
- FontInfo( const FontInfo &fi );
-
- ~FontInfo();
-
- /**
- The name of the font. Can be TQString() if the font has no name
- */
- const TQString &name() const;
-
- /**
- Whether the font is embedded in the file, or not
-
- \return true if the font is embedded
- */
- bool isEmbedded() const;
-
- /**
- Whether the font provided is only a subset of the full
- font or not. This only has meaning if the font is embedded.
-
- \return true if the font is only a subset
- */
- bool isSubset() const;
-
- /**
- The type of font encoding
- */
- Type type() const;
-
- const TQString &typeName() const;
-
-private:
- FontInfoData *data;
-};
-
-class PageData;
-class Page {
- friend class Document;
- public:
- ~Page();
- 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
- renderToPixmap() with xres and yres set to 72.0. We keep it
- only for binary compatibility
-
- \sa renderToImage()
- */
- void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks = false) const;
-
- /**
- \brief Render the page to a TQImage using the Splash renderer
-
- 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,
- in dots per inch (defaults to 72 dpi)
-
- \param yres vertical resolution of the graphics device, in
- dots per inch (defaults to 72 dpi)
-
- \returns a TQImage of the page.
-
- \sa renderToPixmap()
- */
- TQImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const;
-
- /**
- * Returns the size of the page in points
- **/
- 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
- **/
- TQString getText(const Rectangle &r) const;
-
- TQValueList<TextBox*> textList() const;
-
- /**
- * Returns the transition of this page
- **/
- PageTransition *getTransition() const;
-
- enum Orientation {
- Landscape,
- Portrait,
- Seascape,
- UpsideDown
- };
-
- /**
- * The orientation of the page
- **/
- Orientation orientation() const;
-
- /**
- Gets the links of the page once it has been rendered if doLinks was true
- */
- TQValueList<Link*> links() const;
-
- private:
- Page(const Document *doc, int index);
- PageData *data;
-};
-
-class DocumentData;
-
-class Document {
- friend class Page;
-
-public:
- enum PageMode {
- UseNone,
- UseOutlines,
- UseThumbs,
- FullScreen,
- UseOC
- };
-
- static Document *load(const TQString & filePath);
-
- Page *getPage(int index) const{ return new Page(this, index); }
-
- int getNumPages() const;
-
- PageMode getPageMode() const;
-
- bool unlock(const TQCString &password);
-
- bool isLocked() const;
-
- TQDateTime getDate( const TQString & data ) const;
- TQString getInfo( const TQString & data ) const;
- bool isEncrypted() const;
- bool isLinearized() const;
- bool okToPrint() const;
- bool okToChange() const;
- bool okToCopy() const;
- bool okToAddNotes() const;
- double getPDFVersion() const;
- /**
- The version of the PDF specification that the document
- conforms to
-
- \param major an optional pointer to a variable where store the
- "major" number of the version
- \param minor an optional pointer to a variable where store the
- "minor" number of the version
-
- \since 0.12
- */
- void getPdfVersion(int *major, int *minor) const;
-
- bool print(const TQString &fileName, TQValueList<int> pageList, double hDPI, double vDPI, int rotate);
-
- // If you are using TQPrinter you can get paper size doing
- // TQPrinter dummy(TQPrinter::PrinterResolution);
- // dummy.setFullPage(true);
- // dummy.setPageSize(thePageSizeYouWant);
- // TQPaintDeviceMetrics metrics(&dummy);
- // int width = metrics.width();
- // int height = metrics.height();
- bool print(const TQString &fileName, TQValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight);
-
- /**
- The fonts within the PDF document.
-
- \note this can take a very long time to run with a large
- document. You may wish to use the call below if you have more
- than say 20 pages
- */
- TQValueList<FontInfo> fonts() const;
-
- /**
- \overload
-
- \param numPages the number of pages to scan
- \param fontList pointer to the list where the font information
- should be placed
-
- \return false if the end of the document has been reached
- */
- bool scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) const;
-
- /**
- Gets the TOC of the Document, it is application responsabiliy to delete
- it when no longer needed
-
- * In the tree the tag name is the 'screen' name of the entry. A tag can have
- * attributes. Here follows the list of tag attributes with meaning:
- * - Destination: A string description of the referred destination
- * - DestinationName: A 'named reference' to the viewport that must be converted
- * using linkDestination( *destination_name* )
- * - ExternalFileName: A link to a external filename
-
- \returns NULL if the Document does not have TOC
- */
- TQDomDocument *toc() const;
-
- LinkDestination *linkDestination( const TQString &name );
-
- ~Document();
-
-private:
- DocumentData *data;
- Document(DocumentData *dataA);
-};
-
-}
-#endif
diff --git a/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp b/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp
deleted file mode 100644
index d616290d..00000000
--- a/kfile-plugins/pdf/poppler-qt/test-poppler-qt.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#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 TQWidget // picture display widget
-{
-public:
- PDFDisplay( Poppler::Document *d );
- ~PDFDisplay();
-protected:
- void paintEvent( TQPaintEvent * );
- void keyPressEvent( TQKeyEvent * );
-private:
- void display();
-
- int currentPage;
- TQPixmap *pixmap;
- Poppler::Document *doc;
-};
-
-PDFDisplay::PDFDisplay( Poppler::Document *d )
-{
- doc = d;
- pixmap = 0;
- currentPage = 0;
- display();
-}
-
-PDFDisplay::~PDFDisplay()
-{
- delete doc;
- delete pixmap;
-}
-
-void PDFDisplay::paintEvent( TQPaintEvent *e )
-{
- TQPainter paint( this ); // paint widget
- if (pixmap)
- paint.drawPixmap(0, 0, *pixmap);
-}
-
-void PDFDisplay::keyPressEvent( TQKeyEvent *e )
-{
- if (e->key() == TQt::Key_Down)
- {
- if (currentPage + 1 < doc->getNumPages())
- {
- currentPage++;
- display();
- }
- }
- else if (e->key() == TQt::Key_Up)
- {
- if (currentPage > 0)
- {
- currentPage--;
- display();
- }
- }
-}
-
-void PDFDisplay::display()
-{
- if (doc) {
- Poppler::Page *page = doc->getPage(currentPage);
- if (page) {
- delete pixmap;
- page->renderToPixmap(&pixmap, -1, -1, -1, -1);
- delete page;
- update();
- }
- } else {
- printf("doc not loaded\n");
- }
-}
-
-int main( int argc, char **argv )
-{
- TQApplication a( argc, argv ); // TQApplication required!
-
- if ( argc < 2 || (argc == 3 && strcmp(argv[2], "-extract") != 0) || argc > 3)
- {
- // use argument as file name
- printf("usage: test-poppler-qt filename [-extract]\n");
- exit(1);
- }
-
- Poppler::Document *doc = Poppler::Document::load(argv[1]);
- if (!doc)
- {
- printf("doc not loaded\n");
- exit(1);
- }
-
- if (argc == 2)
- {
- PDFDisplay test( doc ); // create picture display
- a.setMainWidget( &test); // set main widget
- test.setCaption("Poppler-TQt Test");
- test.show(); // show it
-
- return a.exec(); // start event loop
- }
- else
- {
- Poppler::Page *page = doc->getPage(0);
-
- TQLabel *l = new TQLabel(page->getText(Poppler::Rectangle()), 0);
- l->show();
- a.setMainWidget(l); // set main widget
- delete page;
- delete doc;
- return a.exec();
- }
-}