summaryrefslogtreecommitdiff
path: root/qt4
diff options
context:
space:
mode:
authorPino Toscano <pino@kde.org>2009-05-13 18:19:11 +0200
committerPino Toscano <pino@kde.org>2009-05-13 18:19:11 +0200
commit9a2a851da93ef1a0c291fc9523a468e808ffd08e (patch)
tree5f1fb335ff5d995c7cd25460d9da5df75d52ceaa /qt4
parent51f6cc26fc5fdccce1ba4d4816dec374ce85d67a (diff)
[Qt4] Do not try to resolve named destinations for GoTo links pointing to external documents.
In such cases, the named destination is a destination in the external document, so we would try to look up a destination which is not in the current document (thus the look up is unuseful). It is task of the users of poppler-qt4 detect such situations, and resolve the named when necessary, using Document::linkDestination(QString).
Diffstat (limited to 'qt4')
-rw-r--r--qt4/src/poppler-document.cc2
-rw-r--r--qt4/src/poppler-link.cc2
-rw-r--r--qt4/src/poppler-page.cc6
-rw-r--r--qt4/src/poppler-private.cc4
-rw-r--r--qt4/src/poppler-private.h5
5 files changed, 11 insertions, 8 deletions
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 2892df06..8494fb8b 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -416,7 +416,7 @@ namespace Poppler {
return NULL;
GooString * namedDest = QStringToGooString( name );
- LinkDestinationData ldd(NULL, namedDest, m_doc);
+ LinkDestinationData ldd(NULL, namedDest, m_doc, false);
LinkDestination *ld = new LinkDestination(ldd);
delete namedDest;
return ld;
diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc
index 25078716..de062423 100644
--- a/qt4/src/poppler-link.cc
+++ b/qt4/src/poppler-link.cc
@@ -193,7 +193,7 @@ class LinkMoviePrivate : public LinkPrivate
bool deleteDest = false;
LinkDest *ld = data.ld;
- if ( data.namedDest && !ld )
+ if ( data.namedDest && !ld && !data.externalDest )
{
deleteDest = true;
ld = data.doc->doc->findDest( data.namedDest );
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 07e73047..9a27538f 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -80,8 +80,9 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo
case actionGoTo:
{
LinkGoTo * g = (LinkGoTo *) a;
+ const LinkDestinationData ldd( g->getDest(), g->getNamedDest(), parentDoc, false );
// create link: no ext file, namedDest, object pointer
- popplerLink = new LinkGoto( linkArea, QString::null, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), parentDoc ) ) );
+ popplerLink = new LinkGoto( linkArea, QString::null, LinkDestination( ldd ) );
}
break;
@@ -90,8 +91,9 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo
LinkGoToR * g = (LinkGoToR *) a;
// copy link file
const QString fileName = UnicodeParsedString( g->getFileName() );
+ const LinkDestinationData ldd( g->getDest(), g->getNamedDest(), parentDoc, !fileName.isEmpty() );
// ceate link: fileName, namedDest, object pointer
- popplerLink = new LinkGoto( linkArea, fileName, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), parentDoc ) ) );
+ popplerLink = new LinkGoto( linkArea, fileName, LinkDestination( ldd ) );
}
break;
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
index d5a01918..4612fcf2 100644
--- a/qt4/src/poppler-private.cc
+++ b/qt4/src/poppler-private.cc
@@ -145,7 +145,7 @@ namespace Poppler {
}
else if ( destination && destination->isOk() )
{
- LinkDestinationData ldd(destination, NULL, doc);
+ LinkDestinationData ldd(destination, NULL, doc, false);
e->setAttribute( "Destination", LinkDestination(ldd).toString() );
}
break;
@@ -169,7 +169,7 @@ namespace Poppler {
}
else if ( destination && destination->isOk() )
{
- LinkDestinationData ldd(destination, NULL, doc);
+ LinkDestinationData ldd(destination, NULL, doc, g->getFileName() != 0);
e->setAttribute( "Destination", LinkDestination(ldd).toString() );
}
e->setAttribute( "ExternalFileName", g->getFileName()->getCString() );
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 3173b717..acf3124f 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -60,14 +60,15 @@ namespace Poppler {
class LinkDestinationData
{
public:
- LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc )
- : ld(l), namedDest(nd), doc(pdfdoc)
+ LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
+ : ld(l), namedDest(nd), doc(pdfdoc), externalDest(external)
{
}
LinkDest *ld;
GooString *namedDest;
Poppler::DocumentData *doc;
+ bool externalDest;
};
class DocumentData {