From a0163f4c268fb162aac6510e762716bf780d6c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 8 Sep 2018 14:26:50 +0200 Subject: Add support for Poppler >= 0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- .../dependencies/poppler-tqt/ConfigureChecks.cmake | 11 +++++++++++ .../dependencies/poppler-tqt/poppler-document.cc | 4 ++-- .../dependencies/poppler-tqt/poppler-link.cc | 4 ++-- .../dependencies/poppler-tqt/poppler-private.cc | 20 ++++++++++---------- .../dependencies/poppler-tqt/poppler-private.h | 17 +++++++++++------ 5 files changed, 36 insertions(+), 20 deletions(-) (limited to 'tdefile-plugins') diff --git a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake index 6fa57f6d..2d2e5136 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake +++ b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake @@ -34,3 +34,14 @@ if( NOT DEFINED HAVE_POPPLER_058 ) message( STATUS "Performing Test HAVE_POPPLER_058 - Failed" ) endif( ) endif( ) + +if( NOT DEFINED HAVE_POPPLER_064 ) + message( STATUS "Performing Test HAVE_POPPLER_064" ) + if( NOT POPPLER_VERSION VERSION_LESS "0.64" ) + set( HAVE_POPPLER_064 1 CACHE INTERNAL "" FORCE ) + message( STATUS "Performing Test HAVE_POPPLER_064 - Success" ) + else( ) + set( HAVE_POPPLER_064 "" CACHE INTERNAL "" FORCE ) + message( STATUS "Performing Test HAVE_POPPLER_064 - Failed" ) + endif( ) +endif( ) diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc index e04f66ac..69e0ee50 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc @@ -163,7 +163,7 @@ TQString Document::getInfo( const TQString & type ) const TQString result; Object obj; - GooString *s1; + CONST_064 GooString *s1; GBool isUnicode; Unicode u; int i; @@ -320,7 +320,7 @@ TQDomDocument *Document::toc() const if ( !outline ) return NULL; - GooList * items = outline->getItems(); + CONST_064 GooList * items = outline->getItems(); if ( !items || items->getLength() < 1 ) return NULL; diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc index 72db1fff..c8fa8984 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc @@ -30,8 +30,8 @@ namespace Poppler { LinkDestination::LinkDestination(const LinkDestinationData &data) { bool deleteDest = false; - LinkDest *ld = data.ld; - + CONST_064 LinkDest *ld = data.ld; + if ( data.namedDest && !ld ) { deleteDest = true; diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc index 7e366014..f945f267 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc @@ -31,7 +31,7 @@ namespace Poppler { /* borrowed from kpdf */ -TQString unicodeToTQString(Unicode* u, int len) +TQString unicodeToTQString(CONST_064 Unicode* u, int len) { TQString ret; ret.setLength(len); @@ -41,7 +41,7 @@ TQString unicodeToTQString(Unicode* u, int len) return ret; } -TQString UnicodeParsedString(GooString *s1) +TQString UnicodeParsedString(CONST_064 GooString *s1) { GBool isUnicode; int i; @@ -86,7 +86,7 @@ GooString *TQStringToGooString(const TQString &s) } -void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ) +void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, CONST_064 GooList * items ) { int numItems = items->getLength(); for ( int i = 0; i < numItems; ++i ) @@ -96,7 +96,7 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, G // 1. create element using outlineItem's title as tagName TQString name; - Unicode * uniChar = outlineItem->getTitle(); + CONST_064 Unicode * uniChar = outlineItem->getTitle(); int titleLength = outlineItem->getTitleLength(); name = unicodeToTQString(uniChar, titleLength); if ( name.isEmpty() ) @@ -106,18 +106,18 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, G parent->appendChild( item ); // 2. find the page the link refers to - ::LinkAction * a = outlineItem->getAction(); + CONST_064 ::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(); + CONST_064 LinkGoTo * g = static_cast< CONST_064 LinkGoTo * >( a ); + CONST_064 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(); + CONST_064 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()); @@ -131,14 +131,14 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, G } if ( a->getKind() == actionGoToR ) { - LinkGoToR * g2 = static_cast< LinkGoToR * >( a ); + CONST_064 LinkGoToR * g2 = static_cast< CONST_064 LinkGoToR * >( a ); item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() ); } } // 3. recursively descend over children outlineItem->open(); - GooList * children = outlineItem->getKids(); + CONST_064 GooList * children = outlineItem->getKids(); if ( children ) addTocChildren( docSyn, &item, children ); } diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h index 9e9e3292..56e7cf5e 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h @@ -34,24 +34,29 @@ #else class SplashOutputDev; #endif +#if defined(HAVE_POPPLER_064) +#define CONST_064 const +#else +#define CONST_064 +#endif namespace Poppler { class DocumentData; -TQString unicodeToTQString(Unicode* u, int len); +TQString unicodeToTQString(CONST_064 Unicode* u, int len); -TQString UnicodeParsedString(GooString *s1); +TQString UnicodeParsedString(CONST_064 GooString *s1); GooString *TQStringToGooString(const TQString &s); class LinkDestinationData { public: - LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc) + LinkDestinationData( CONST_064 LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc) { } - - LinkDest *ld; + + CONST_064 LinkDest *ld; GooString *namedDest; Poppler::DocumentData *doc; }; @@ -84,7 +89,7 @@ class DocumentData { return m_outputDev; } - void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ); + void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, CONST_064 GooList * items ); class PDFDoc doc; bool locked; -- cgit v1.2.3