Add support for Poppler >= 0.64

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 6 years ago
parent 594387b4f3
commit a0163f4c26
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1,6 +1,7 @@
#cmakedefine VERSION "@VERSION@" #cmakedefine VERSION "@VERSION@"
// poppler-tqt // poppler-tqt
#cmakedefine HAVE_POPPLER_064
#cmakedefine HAVE_POPPLER_058 #cmakedefine HAVE_POPPLER_058
#cmakedefine HAVE_POPPLER_030 #cmakedefine HAVE_POPPLER_030
#cmakedefine HAVE_POPPLER_020 #cmakedefine HAVE_POPPLER_020

@ -34,3 +34,14 @@ if( NOT DEFINED HAVE_POPPLER_058 )
message( STATUS "Performing Test HAVE_POPPLER_058 - Failed" ) message( STATUS "Performing Test HAVE_POPPLER_058 - Failed" )
endif( ) endif( )
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( )

@ -163,7 +163,7 @@ TQString Document::getInfo( const TQString & type ) const
TQString result; TQString result;
Object obj; Object obj;
GooString *s1; CONST_064 GooString *s1;
GBool isUnicode; GBool isUnicode;
Unicode u; Unicode u;
int i; int i;
@ -320,7 +320,7 @@ TQDomDocument *Document::toc() const
if ( !outline ) if ( !outline )
return NULL; return NULL;
GooList * items = outline->getItems(); CONST_064 GooList * items = outline->getItems();
if ( !items || items->getLength() < 1 ) if ( !items || items->getLength() < 1 )
return NULL; return NULL;

@ -30,7 +30,7 @@ namespace Poppler {
LinkDestination::LinkDestination(const LinkDestinationData &data) LinkDestination::LinkDestination(const LinkDestinationData &data)
{ {
bool deleteDest = false; bool deleteDest = false;
LinkDest *ld = data.ld; CONST_064 LinkDest *ld = data.ld;
if ( data.namedDest && !ld ) if ( data.namedDest && !ld )
{ {

@ -31,7 +31,7 @@
namespace Poppler { namespace Poppler {
/* borrowed from kpdf */ /* borrowed from kpdf */
TQString unicodeToTQString(Unicode* u, int len) TQString unicodeToTQString(CONST_064 Unicode* u, int len)
{ {
TQString ret; TQString ret;
ret.setLength(len); ret.setLength(len);
@ -41,7 +41,7 @@ TQString unicodeToTQString(Unicode* u, int len)
return ret; return ret;
} }
TQString UnicodeParsedString(GooString *s1) TQString UnicodeParsedString(CONST_064 GooString *s1)
{ {
GBool isUnicode; GBool isUnicode;
int i; 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(); int numItems = items->getLength();
for ( int i = 0; i < numItems; ++i ) 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 // 1. create element using outlineItem's title as tagName
TQString name; TQString name;
Unicode * uniChar = outlineItem->getTitle(); CONST_064 Unicode * uniChar = outlineItem->getTitle();
int titleLength = outlineItem->getTitleLength(); int titleLength = outlineItem->getTitleLength();
name = unicodeToTQString(uniChar, titleLength); name = unicodeToTQString(uniChar, titleLength);
if ( name.isEmpty() ) if ( name.isEmpty() )
@ -106,18 +106,18 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, G
parent->appendChild( item ); parent->appendChild( item );
// 2. find the page the link refers to // 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 ) ) if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) )
{ {
// page number is contained/referenced in a LinkGoTo // page number is contained/referenced in a LinkGoTo
LinkGoTo * g = static_cast< LinkGoTo * >( a ); CONST_064 LinkGoTo * g = static_cast< CONST_064 LinkGoTo * >( a );
LinkDest * destination = g->getDest(); CONST_064 LinkDest * destination = g->getDest();
if ( !destination && g->getNamedDest() ) if ( !destination && g->getNamedDest() )
{ {
// no 'destination' but an internal 'named reference'. we could // no 'destination' but an internal 'named reference'. we could
// get the destination for the page now, but it's VERY time consuming, // get the destination for the page now, but it's VERY time consuming,
// so better storing the reference and provide the viewport on demand // 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()]; TQChar *charArray = new TQChar[s->getLength()];
for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]); for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]);
TQString aux(charArray, s->getLength()); TQString aux(charArray, s->getLength());
@ -131,14 +131,14 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, G
} }
if ( a->getKind() == actionGoToR ) 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() ); item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() );
} }
} }
// 3. recursively descend over children // 3. recursively descend over children
outlineItem->open(); outlineItem->open();
GooList * children = outlineItem->getKids(); CONST_064 GooList * children = outlineItem->getKids();
if ( children ) if ( children )
addTocChildren( docSyn, &item, children ); addTocChildren( docSyn, &item, children );
} }

@ -34,24 +34,29 @@
#else #else
class SplashOutputDev; class SplashOutputDev;
#endif #endif
#if defined(HAVE_POPPLER_064)
#define CONST_064 const
#else
#define CONST_064
#endif
namespace Poppler { namespace Poppler {
class DocumentData; 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); GooString *TQStringToGooString(const TQString &s);
class LinkDestinationData { class LinkDestinationData {
public: 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; GooString *namedDest;
Poppler::DocumentData *doc; Poppler::DocumentData *doc;
}; };
@ -84,7 +89,7 @@ class DocumentData {
return m_outputDev; return m_outputDev;
} }
void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ); void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, CONST_064 GooList * items );
class PDFDoc doc; class PDFDoc doc;
bool locked; bool locked;

Loading…
Cancel
Save