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@"
// poppler-tqt
#cmakedefine HAVE_POPPLER_064
#cmakedefine HAVE_POPPLER_058
#cmakedefine HAVE_POPPLER_030
#cmakedefine HAVE_POPPLER_020

@ -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( )

@ -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;

@ -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;

@ -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 );
}

@ -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;

Loading…
Cancel
Save