Add support for Poppler >= 22.03.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/45/head
Slávek Banko 2 years ago
parent ce555091ab
commit 9adc0f647c
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_2203
#cmakedefine HAVE_POPPLER_2112 #cmakedefine HAVE_POPPLER_2112
#cmakedefine HAVE_POPPLER_2111 #cmakedefine HAVE_POPPLER_2111
#cmakedefine HAVE_POPPLER_2108 #cmakedefine HAVE_POPPLER_2108

@ -24,7 +24,7 @@ check_cxx_source_compiles("
HAVE_POPPLER_030 ) HAVE_POPPLER_030 )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 0.76 0.82 0.83 0.86 21.08 21.11 21.12 ) foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 0.76 0.82 0.83 0.86 21.08 21.11 21.12 22.03 )
string( REPLACE "." "" _poppler_str "${_poppler_ver}" ) string( REPLACE "." "" _poppler_str "${_poppler_ver}" )
if( NOT DEFINED HAVE_POPPLER_${_poppler_str} ) if( NOT DEFINED HAVE_POPPLER_${_poppler_str} )
message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str}" ) message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str}" )

@ -50,7 +50,11 @@ Document *Document::load(const TQString &filePath)
#endif #endif
} }
# if defined(HAVE_POPPLER_2203)
DocumentData *doc = new DocumentData(std::make_unique<GooString>(TQFile::encodeName(filePath)), {});
# else
DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL); DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL);
# endif
Document *pdoc; Document *pdoc;
if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) { if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) {
pdoc = new Document(doc); pdoc = new Document(doc);
@ -84,10 +88,15 @@ bool Document::unlock(const TQCString &password)
{ {
if (data->locked) { if (data->locked) {
/* racier then it needs to be */ /* racier then it needs to be */
# if defined(HAVE_POPPLER_2203)
DocumentData *doc2 = new DocumentData(std::make_unique<GooString>(data->doc.getFileName()),
GooString(password.data()));
# else
GooString *filename = new GooString(data->doc.getFileName()); GooString *filename = new GooString(data->doc.getFileName());
GooString *pwd = new GooString(password.data()); GooString *pwd = new GooString(password.data());
DocumentData *doc2 = new DocumentData(filename, pwd); DocumentData *doc2 = new DocumentData(filename, pwd);
delete pwd; delete pwd;
# endif
if (!doc2->doc.isOk()) { if (!doc2->doc.isOk()) {
delete doc2; delete doc2;
} else { } else {

@ -104,7 +104,11 @@ class LinkDestinationData {
class DocumentData { class DocumentData {
public: public:
# if defined(HAVE_POPPLER_2203)
DocumentData(std::unique_ptr<GooString> &&filePath, const std::optional<GooString> &password) : doc(std::move(filePath), password), m_fontInfoScanner(0), m_outputDev(0) {}
# else
DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {} DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {}
# endif
~DocumentData() ~DocumentData()
{ {

Loading…
Cancel
Save