summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.cmake18
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake40
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp46
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp4
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp12
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp4
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-private.h12
7 files changed, 47 insertions, 89 deletions
diff --git a/config.h.cmake b/config.h.cmake
index 5a1f1661..7bf6fe53 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1,23 +1,7 @@
#cmakedefine VERSION "@VERSION@"
// poppler-tqt
-#cmakedefine HAVE_POPPLER_2402
-#cmakedefine HAVE_POPPLER_2203
-#cmakedefine HAVE_POPPLER_2112
-#cmakedefine HAVE_POPPLER_2111
-#cmakedefine HAVE_POPPLER_2108
-#cmakedefine HAVE_POPPLER_086
-#cmakedefine HAVE_POPPLER_083
-#cmakedefine HAVE_POPPLER_082
-#cmakedefine HAVE_POPPLER_076
-#cmakedefine HAVE_POPPLER_072
-#cmakedefine HAVE_POPPLER_071
-#cmakedefine HAVE_POPPLER_070
-#cmakedefine HAVE_POPPLER_064
-#cmakedefine HAVE_POPPLER_058
-#cmakedefine HAVE_POPPLER_030
-#cmakedefine HAVE_POPPLER_020
-#cmakedefine HAVE_POPPLER_016
+#cmakedefine POPPLER_VERSION_C @POPPLER_VERSION_C@
// kpdf, kdvi
#cmakedefine HAVE_FREETYPE 1
diff --git a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
index 383ebdfa..99a48c8e 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
+++ b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
@@ -6,38 +6,14 @@ else( )
tde_message_fatal( "poppler is required, but was not found on your system" )
endif( )
-tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
-set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS})
-set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} ${POPPLER_LDFLAGS} )
-check_cxx_source_compiles("
- #include <PSOutputDev.h>
- int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, (XRef*)0, (Catalog*)0, NULL, 0, 0, psModePS, a, b); } "
- HAVE_POPPLER_016 )
-check_cxx_source_compiles("
- #include <PSOutputDev.h>
- int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, NULL, 0, 0, psModePS, a, b); } "
- HAVE_POPPLER_020 )
-check_cxx_source_compiles("
- #include <vector>
- #include <PSOutputDev.h>
- int main(int, char**) { int a; int b; std::vector<int> p; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, NULL, p, psModePS, a, b); } "
- HAVE_POPPLER_030 )
-tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)"
+ POPPLER_VERSION_SPLIT ${POPPLER_VERSION} )
+set( POPPLER_VERSION_MAJOR ${CMAKE_MATCH_1} )
+set( POPPLER_VERSION_MINOR ${CMAKE_MATCH_2} )
+set( POPPLER_VERSION_PATCH ${CMAKE_MATCH_3} )
+math( EXPR POPPLER_VERSION_C "(${POPPLER_VERSION_MAJOR}*1000000) + (${POPPLER_VERSION_MINOR}*1000) + ${POPPLER_VERSION_PATCH}" )
+set( POPPLER_VERSION_C ${POPPLER_VERSION_C} CACHE INTERNAL "Poppler library version as code number" )
-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 24.02 )
- string( REPLACE "." "" _poppler_str "${_poppler_ver}" )
- if( NOT DEFINED HAVE_POPPLER_${_poppler_str} )
- message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str}" )
- if( NOT POPPLER_VERSION VERSION_LESS "${_poppler_ver}" )
- set( HAVE_POPPLER_${_poppler_str} 1 CACHE INTERNAL "" FORCE )
- message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str} - Success" )
- else( )
- set( HAVE_POPPLER_${_poppler_str} "" CACHE INTERNAL "" FORCE )
- message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str} - Failed" )
- endif( )
- endif( )
-endforeach( )
-
-if( HAVE_POPPLER_2112 )
+if( NOT POPPLER_VERSION_C LESS 21012000 )
set( POPPLER_CXX_FEATURES cxx_std_17 CACHE INTERNAL "C++ standard required by Poppler" )
endif()
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
index 86e831ee..5ed02af6 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
@@ -33,7 +33,7 @@
#include <DateInfo.h>
#include "poppler-private.h"
-#if !defined(HAVE_POPPLER_071)
+#if (POPPLER_VERSION_C < 71000)
#undef bool
#endif
@@ -43,14 +43,14 @@ Document *Document::load(const TQString &filePath)
{
if (!globalParams) {
globalParams =
-#if defined(HAVE_POPPLER_083)
+#if (POPPLER_VERSION_C >= 83000)
std::make_unique<GlobalParams>();
#else
new GlobalParams();
#endif
}
-# if defined(HAVE_POPPLER_2203)
+# if (POPPLER_VERSION_C >= 22003000)
DocumentData *doc = new DocumentData(std::make_unique<GooString>(TQFile::encodeName(filePath)), {});
# else
DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL);
@@ -88,7 +88,7 @@ bool Document::unlock(const TQCString &password)
{
if (data->locked) {
/* racier then it needs to be */
-# if defined(HAVE_POPPLER_2203)
+# if (POPPLER_VERSION_C >= 22003000)
DocumentData *doc2 = new DocumentData(std::make_unique<GooString>(data->doc.getFileName()),
GooString(password.data()));
# else
@@ -143,15 +143,13 @@ bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) con
{
FONTS_LIST_TYPE items = data->m_fontInfoScanner->scan( numPages );
-#if !defined(HAVE_POPPLER_082)
+#if (POPPLER_VERSION_C < 82000)
if ( NULL == items )
return false;
#endif
-#if !defined(HAVE_POPPLER_076)
+#if (POPPLER_VERSION_C < 76000)
if ( FONTS_LIST_IS_EMPTY(items) ) {
-# if !defined(HAVE_POPPLER_082)
delete items;
-# endif
return false;
}
#endif
@@ -168,16 +166,16 @@ bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) con
(Poppler::FontInfo::Type)(fontInfo->getType()));
fontList->append(font);
}
-# if defined(HAVE_POPPLER_082)
+# if (POPPLER_VERSION_C >= 82000)
for (auto entry : items) {
delete entry;
}
-# elif defined(HAVE_POPPLER_076)
+# elif (POPPLER_VERSION_C >= 76000)
for (auto entry : *items) {
delete entry;
}
delete items;
-# elif defined(HAVE_POPPLER_070)
+# elif (POPPLER_VERSION_C >= 70000)
deleteGooList<::FontInfo>(items);
# else
deleteGooList(items, ::FontInfo);
@@ -193,7 +191,7 @@ TQString Document::getInfo( const TQString & type ) const
if ( data->locked )
return NULL;
-# if defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C >= 58000)
info = data->doc.getDocInfo();
# else
data->doc.getDocInfo( &info );
@@ -209,7 +207,7 @@ TQString Document::getInfo( const TQString & type ) const
int i;
Dict *infoDict = info.getDict();
-#if defined(HAVE_POPPLER_058)
+#if (POPPLER_VERSION_C >= 58000)
obj = infoDict->lookup( (char*)type.latin1() );
#else
infoDict->lookup( (char*)type.latin1(), &obj );
@@ -241,13 +239,13 @@ TQString Document::getInfo( const TQString & type ) const
}
result += unicodeToTQString( &u, 1 );
}
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
obj.free();
info.free();
# endif
return result;
}
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
obj.free();
info.free();
# endif
@@ -262,13 +260,13 @@ TQDateTime Document::getDate( const TQString & type ) const
return TQDateTime();
Object info;
-# if defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C >= 58000)
info = data->doc.getDocInfo();
# else
data->doc.getDocInfo( &info );
# endif
if ( !info.isDict() ) {
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
info.free();
# endif
return TQDateTime();
@@ -280,14 +278,14 @@ TQDateTime Document::getDate( const TQString & type ) const
Dict *infoDict = info.getDict();
TQString result;
-#if defined(HAVE_POPPLER_058)
+#if (POPPLER_VERSION_C >= 58000)
obj = infoDict->lookup( (char*)type.latin1() );
#else
infoDict->lookup( (char*)type.latin1(), &obj );
#endif
if (!obj.isNull() && obj.isString())
{
-# if defined(HAVE_POPPLER_2108)
+# if (POPPLER_VERSION_C >= 21008000)
const GooString *s = obj.getString();
# else
TQString tqs = UnicodeParsedString(obj.getString());
@@ -299,7 +297,7 @@ TQDateTime Document::getDate( const TQString & type ) const
TQDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??)
TQTime t( hour, min, sec );
if ( d.isValid() && t.isValid() ) {
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
obj.free();
info.free();
# endif
@@ -307,7 +305,7 @@ TQDateTime Document::getDate( const TQString & type ) const
}
}
}
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
obj.free();
info.free();
# endif
@@ -390,16 +388,16 @@ bool Document::print(const TQString &fileName, TQValueList<int> pageList, double
bool Document::print(const TQString &file, TQValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight)
{
-#if defined(HAVE_POPPLER_058) || defined(HAVE_POPPLER_030)
+#if (POPPLER_VERSION_C >= 30000)
std::vector<int> pages;
TQValueList<int>::iterator it;
for (it = pageList.begin(); it != pageList.end(); ++it ) {
pages.push_back(*it);
}
PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), NULL, pages, psModePS, paperWidth, paperHeight);
-#elif defined(HAVE_POPPLER_020)
+#elif (POPPLER_VERSION_C >= 20000)
PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight);
-#elif defined(HAVE_POPPLER_016)
+#elif (POPPLER_VERSION_C >= 16000)
PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight);
#else
PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight);
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp
index 99cd8cc9..3ba58505 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp
@@ -35,7 +35,7 @@ namespace Poppler {
if ( data.namedDest && !ld )
{
deleteDest = true;
-# if defined(HAVE_POPPLER_086)
+# if (POPPLER_VERSION_C >= 86000)
ld = data.doc->doc.findDest( data.namedDest ).get();
# else
ld = data.doc->doc.findDest( data.namedDest );
@@ -81,7 +81,7 @@ namespace Poppler {
m_right = rightAux;
m_bottom = bottomAux;
-# if !defined(HAVE_POPPLER_086)
+# if (POPPLER_VERSION_C < 86000)
if (deleteDest) delete ld;
# endif
}
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp
index 9b4f6208..54f198e9 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp
@@ -129,7 +129,7 @@ TQString Page::getText(const Rectangle &r) const
TQString result;
::Page *p;
-#if defined(HAVE_POPPLER_058) || defined(HAVE_POPPLER_030) || defined(HAVE_POPPLER_020)
+#if (POPPLER_VERSION_C >= 20000)
output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse);
#else
output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse);
@@ -164,7 +164,7 @@ TQValueList<TextBox*> Page::textList() const
TQValueList<TextBox*> output_list;
-#if defined(HAVE_POPPLER_058) || defined(HAVE_POPPLER_030) || defined(HAVE_POPPLER_020)
+#if (POPPLER_VERSION_C >= 20000)
output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse);
#else
output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse);
@@ -173,7 +173,7 @@ TQValueList<TextBox*> Page::textList() const
data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72,
0, false, false, false, -1, -1, -1, -1);
-# if defined(HAVE_POPPLER_2111)
+# if (POPPLER_VERSION_C >= 21011000)
std::unique_ptr<TextWordList> word_list = output_dev->makeWordList();
# else
TextWordList *word_list = output_dev->makeWordList();
@@ -197,7 +197,7 @@ TQValueList<TextBox*> Page::textList() const
output_list.append(text_box);
}
-# if !defined(HAVE_POPPLER_2111)
+# if (POPPLER_VERSION_C < 21011000)
delete word_list;
# endif
delete output_dev;
@@ -211,14 +211,14 @@ PageTransition *Page::getTransition() const
{
Object o;
PageTransitionParams params;
-# if defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C >= 58000)
o = data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans();
# else
data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans(&o);
# endif
params.dictObj = &o;
data->transition = new PageTransition(params);
-# if !defined(HAVE_POPPLER_058)
+# if (POPPLER_VERSION_C < 58000)
o.free();
# endif
}
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
index 2f5e75ba..42ec0899 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
@@ -93,7 +93,7 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, O
{
// iterate over every object in 'items'
OutlineItem * outlineItem =
-#ifdef HAVE_POPPLER_076
+#if (POPPLER_VERSION_C >= 76000)
(*items)[i];
#else
(OutlineItem *)items->get( i );
@@ -101,7 +101,7 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, O
// 1. create element using outlineItem's title as tagName
TQString name;
-#ifdef HAVE_POPPLER_2402
+#if (POPPLER_VERSION_C >= 24002000)
const std::vector<Unicode> &uVec = outlineItem->getTitle();
name = unicodeToTQString( uVec.data(), uVec.size() );
#else
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h
index f1096ceb..d3487ef1 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h
@@ -39,27 +39,27 @@
#else
class SplashOutputDev;
#endif
-#if defined(HAVE_POPPLER_064)
+#if (POPPLER_VERSION_C >= 64000)
#define CONST_064 const
#else
#define CONST_064
#endif
-#if defined(HAVE_POPPLER_071)
+#if (POPPLER_VERSION_C >= 71000)
#define GBool bool
#define gTrue true
#define gFalse false
#endif
-#if defined(HAVE_POPPLER_072)
+#if (POPPLER_VERSION_C >= 72000)
#define GOO_GET_CSTR c_str
#else
#define GOO_GET_CSTR getCString
#endif
-#if defined(HAVE_POPPLER_076)
+#if (POPPLER_VERSION_C >= 76000)
#include <vector>
class OutlineItem;
#define OUTLINE_ITEMS_TYPE const std::vector<OutlineItem*>
#define OUTLINE_ITEMS_LENGTH(goo) goo->size()
-# if defined(HAVE_POPPLER_082)
+# if (POPPLER_VERSION_C >= 82000)
#define FONTS_LIST_TYPE std::vector<::FontInfo*>
#define FONTS_LIST_LENGTH(goo) goo.size()
#define FONTS_LIST_IS_EMPTY(goo) goo.empty()
@@ -104,7 +104,7 @@ class LinkDestinationData {
class DocumentData {
public:
-# if defined(HAVE_POPPLER_2203)
+# if (POPPLER_VERSION_C >= 22003000)
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) {}