22,7 → 22,6 |
#include <poppler/PageTransition.h> |
#include <poppler/ViewerPreferences.h> |
#include <poppler/poppler-config.h> |
#include <poppler/cpp/poppler-version.h> |
#include <poppler/SplashOutputDev.h> |
#include <poppler/splash/SplashBitmap.h> |
|
60,12 → 59,6 |
#include "ui/multiprogressdialog.h" |
#include "ui/propertiespalette.h" |
|
#define POPPLER_VERSION_ENCODE(major, minor, micro) ( \ |
((major) * 10000) \ |
+ ((minor) * 100) \ |
+ ((micro) * 1)) |
#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO) |
|
PdfPlug::PdfPlug(ScribusDoc* doc, int flags) |
{ |
tmpSele = new Selection(this, false); |
514,20 → 507,12 |
{ |
for (int i = 0; i < order->getLength (); ++i) |
{ |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object orderItem = order->get(i); |
#else |
Object orderItem; |
order->get(i, &orderItem); |
#endif |
if (orderItem.isDict()) |
{ |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object ref = order->getNF(i); |
#else |
Object ref; |
order->getNF(i, &ref); |
#endif |
if (ref.isRef()) |
{ |
OptionalContentGroup *oc = ocg->findOcgByRef(ref.getRef()); |
538,9 → 523,7 |
ocgNames.append(ocgName); |
} |
} |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
ref.free(); |
#endif |
} |
else |
{ |
614,37 → 597,6 |
dev->layersSetByOCG = true; |
} |
#endif |
|
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object info = pdfDoc->getDocInfo(); |
if (info.isDict()) |
{ |
Object obj; |
Dict *infoDict = info.getDict(); |
obj = infoDict->lookup((char*) "Title"); |
if (obj.isString()) |
{ |
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString())); |
} |
obj = infoDict->lookup((char*) "Author"); |
if (obj.isString()) |
{ |
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString())); |
} |
obj = infoDict->lookup((char*) "Subject"); |
if (obj.isString()) |
{ |
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString())); |
} |
obj = infoDict->lookup((char*) "Keywords"); |
if (obj.isString()) |
{ |
// s1 = obj.getString(); |
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString())); |
} |
} |
info = Object(); |
#else |
Object info; |
pdfDoc->getDocInfo(&info); |
if (info.isDict()) |
678,7 → 630,6 |
} |
} |
info.free(); |
#endif |
if (cropped) |
{ |
QRectF crBox = getCBox(contentRect, pageNs[0]); |
795,13 → 746,8 |
pdfDoc->displayPage(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev); |
} |
PDFPresentationData ef; |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object trans = pdfDoc->getPage(pp)->getTrans(); |
Object *transi = &trans; |
#else |
Object trans; |
Object *transi = pdfDoc->getPage(pp)->getTrans(&trans); |
#endif |
if (transi->isDict()) |
{ |
m_Doc->pdfOptions().PresentMode = true; |
847,51 → 793,32 |
delete pgTrans; |
} |
m_Doc->currentPage()->PresentVals = ef; |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
trans.free(); |
transi->free(); |
#endif |
} |
int numjs = pdfDoc->getCatalog()->numJS(); |
if (numjs > 0) |
{ |
NameTree *jsNameTreeP = new NameTree(); |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object catDict = pdfDoc->getXRef()->getCatalog(); |
#else |
Object catDict; |
pdfDoc->getXRef()->getCatalog(&catDict); |
#endif |
if (catDict.isDict()) |
{ |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object names = catDict.dictLookup("Names"); |
#else |
Object names; |
catDict.dictLookup("Names", &names); |
#endif |
if (names.isDict()) |
{ |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
Object obj = names.dictLookup("JavaScript"); |
jsNameTreeP->init(pdfDoc->getXRef(), &obj); |
#else |
Object obj; |
names.dictLookup("JavaScript", &obj); |
jsNameTreeP->init(pdfDoc->getXRef(), &obj); |
obj.free(); |
#endif |
} |
for (int a = 0; a < numjs; a++) |
{ |
m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a))); |
} |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
names = catDict.dictLookup("OpenAction"); |
#else |
names.free(); |
catDict.dictLookup("OpenAction", &names); |
#endif |
if (names.isDict()) |
{ |
LinkAction *linkAction = NULL; |
912,13 → 839,9 |
} |
} |
} |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
names.free(); |
#endif |
} |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
catDict.free(); |
#endif |
delete jsNameTreeP; |
} |
m_Doc->pdfOptions().Version = (PDFOptions::PDFVersion)qMin(15, qMax(13, pdfDoc->getPDFMajorVersion() * 10 + pdfDoc->getPDFMinorVersion())); |