28
28
#include <QMessageBox>
29
29
#include <QSettings>
31
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
31
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
33
#include <poppler-qt6.h>
35
#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0)
33
37
#include <poppler-qt5.h>
65
69
using namespace qpdfview;
66
70
using namespace qpdfview::Model;
74
Outline loadOutline(QVector< Poppler::OutlineItem > items, Poppler::Document* document)
78
outline.reserve(items.size());
80
for(QVector< Poppler::OutlineItem >::const_iterator item = items.constBegin(); item != items.constEnd(); ++item)
82
outline.push_back(Section());
83
Section& section = outline.back();
85
section.title = item->name();
87
QSharedPointer< const Poppler::LinkDestination > destination = item->destination();
91
int page = destination->pageNumber();
95
page = page >= 1 ? page : 1;
96
page = page <= document->numPages() ? page : document->numPages();
98
if(destination->isChangeLeft())
100
left = destination->left();
102
left = left >= 0.0 ? left : 0.0;
103
left = left <= 1.0 ? left : 1.0;
106
if(destination->isChangeTop())
108
top = destination->top();
110
top = top >= 0.0 ? top : 0.0;
111
top = top <= 1.0 ? top : 1.0;
114
Link& link = section.link;
119
const QString fileName = item->externalFileName();
121
if(!fileName.isEmpty())
123
link.urlOrFileName = fileName;
127
if(item->hasChildren())
129
section.children = loadOutline(item->children(), document);
68
138
Outline loadOutline(const QDomNode& parent, Poppler::Document* document)
1309
1389
document->setRenderBackend(Poppler::Document::SplashBackend);
1392
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1394
document->setRenderBackend(Poppler::Document::QPainterBackend);
1312
1398
document->setRenderBackend(Poppler::Document::ArthurBackend);
1400
#endif // QT_VERSION