summaryrefslogtreecommitdiffstats
path: root/tdefile-plugins/dependencies/poppler-tqt
diff options
context:
space:
mode:
Diffstat (limited to 'tdefile-plugins/dependencies/poppler-tqt')
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt7
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake40
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp58
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-link.cpp4
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-page.cpp14
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp8
-rw-r--r--tdefile-plugins/dependencies/poppler-tqt/poppler-private.h14
7 files changed, 80 insertions, 65 deletions
diff --git a/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt b/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt
index 28be343b..d95dc846 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt
+++ b/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt
@@ -41,6 +41,7 @@ install( FILES
poppler-qt.h poppler-page-transition.h poppler-link-qt3.h
DESTINATION ${INCLUDE_INSTALL_DIR} )
+
##### poppler-tqt (shared) ############################
tde_add_library( poppler-tqt SHARED AUTOMOC
@@ -50,6 +51,12 @@ tde_add_library( poppler-tqt SHARED AUTOMOC
poppler-page-transition.cpp poppler-page-transition-private.h
poppler-private.cpp poppler-private.h
VERSION 0.0.0
+ CXX_FEATURES ${POPPLER_CXX_FEATURES}
LINK ${POPPLER_LIBRARIES} ${TQT_LIBRARIES}
DESTINATION ${LIB_INSTALL_DIR}
)
+
+
+##### install cmake export file #################
+
+tde_install_export( )
diff --git a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
index 1bc139b7..99a48c8e 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
+++ b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake
@@ -6,34 +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 )
- 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( 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 fac02a4b..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,18 @@ 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 (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);
+# endif
Document *pdoc;
if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) {
pdoc = new Document(doc);
@@ -84,10 +88,15 @@ bool Document::unlock(const TQCString &password)
{
if (data->locked) {
/* racier then it needs to be */
+# if (POPPLER_VERSION_C >= 22003000)
+ DocumentData *doc2 = new DocumentData(std::make_unique<GooString>(data->doc.getFileName()),
+ GooString(password.data()));
+# else
GooString *filename = new GooString(data->doc.getFileName());
GooString *pwd = new GooString(password.data());
DocumentData *doc2 = new DocumentData(filename, pwd);
delete pwd;
+# endif
if (!doc2->doc.isOk()) {
delete doc2;
} else {
@@ -134,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
@@ -159,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);
@@ -184,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 );
@@ -200,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 );
@@ -232,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
@@ -253,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();
@@ -271,21 +278,26 @@ 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())
{
- TQString s = UnicodeParsedString(obj.getString());
+# if (POPPLER_VERSION_C >= 21008000)
+ const GooString *s = obj.getString();
+# else
+ TQString tqs = UnicodeParsedString(obj.getString());
+ const char *s = tqs.latin1();
+# endif
// TODO do something with the timezone information
- if ( parseDateString( s.latin1(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) )
+ if (parseDateString(s, &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute))
{
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
@@ -293,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
@@ -376,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 426b750f..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,11 @@ 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 (POPPLER_VERSION_C >= 21011000)
+ std::unique_ptr<TextWordList> word_list = output_dev->makeWordList();
+# else
TextWordList *word_list = output_dev->makeWordList();
+# endif
if (!word_list) {
delete output_dev;
@@ -193,7 +197,9 @@ TQValueList<TextBox*> Page::textList() const
output_list.append(text_box);
}
+# if (POPPLER_VERSION_C < 21011000)
delete word_list;
+# endif
delete output_dev;
return output_list;
@@ -205,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 059bf1c0..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,9 +101,15 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, O
// 1. create element using outlineItem's title as tagName
TQString name;
+#if (POPPLER_VERSION_C >= 24002000)
+ const std::vector<Unicode> &uVec = outlineItem->getTitle();
+ name = unicodeToTQString( uVec.data(), uVec.size() );
+#else
CONST_064 Unicode * uniChar = outlineItem->getTitle();
int titleLength = outlineItem->getTitleLength();
name = unicodeToTQString(uniChar, titleLength);
+#endif
+
if ( name.isEmpty() )
continue;
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h
index c98d02b8..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,11 @@ class LinkDestinationData {
class DocumentData {
public:
+# 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) {}
+# endif
~DocumentData()
{